1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

smbd: add smbd_check_access_rights_fsp()

Handle based version of smbd_check_access_rights().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2020-10-27 11:24:03 +01:00
parent 8e3798dd22
commit 2aac91003e
2 changed files with 33 additions and 0 deletions

View File

@ -280,6 +280,36 @@ NTSTATUS smbd_check_access_rights(struct connection_struct *conn,
access_mask);
}
NTSTATUS smbd_check_access_rights_fsp(struct files_struct *fsp,
bool use_privs,
uint32_t access_mask)
{
struct security_descriptor *sd = NULL;
NTSTATUS status;
status = SMB_VFS_FGET_NT_ACL(fsp,
(SECINFO_OWNER |
SECINFO_GROUP |
SECINFO_DACL),
talloc_tos(),
&sd);
if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
status = NT_STATUS_OK;
}
if (!NT_STATUS_IS_OK(status)) {
DBG_DEBUG("Could not get acl on %s: %s\n",
fsp_str_dbg(fsp),
nt_errstr(status));
return status;
}
return smbd_check_access_rights_sd(fsp->conn,
fsp->fsp_name,
sd,
use_privs,
access_mask);
}
NTSTATUS check_parent_access(struct connection_struct *conn,
struct files_struct *dirfsp,
struct smb_filename *smb_fname,

View File

@ -719,6 +719,9 @@ NTSTATUS smbd_check_access_rights(struct connection_struct *conn,
const struct smb_filename *smb_fname,
bool use_privs,
uint32_t access_mask);
NTSTATUS smbd_check_access_rights_fsp(struct files_struct *fsp,
bool use_privs,
uint32_t access_mask);
NTSTATUS check_parent_access(struct connection_struct *conn,
struct files_struct *dirfsp,
struct smb_filename *smb_fname,