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

smbd: Factor out check_access_fsp() from check_access()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2015-11-17 15:10:42 +01:00 committed by Jeremy Allison
parent c8485ddbac
commit c056daf7ab
2 changed files with 13 additions and 4 deletions

View File

@ -1079,6 +1079,8 @@ int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf);
/* The following definitions come from smbd/trans2.c */
NTSTATUS check_access_fsp(const struct files_struct *fsp,
uint32_t access_mask);
NTSTATUS check_access(connection_struct *conn,
files_struct *fsp,
const struct smb_filename *smb_fname,

View File

@ -54,6 +54,15 @@ static char *store_file_unix_basic_info2(connection_struct *conn,
files_struct *fsp,
const SMB_STRUCT_STAT *psbuf);
NTSTATUS check_access_fsp(const struct files_struct *fsp,
uint32_t access_mask)
{
if (!(fsp->access_mask & access_mask)) {
return NT_STATUS_ACCESS_DENIED;
}
return NT_STATUS_OK;
}
/********************************************************************
The canonical "check access" based on object handle or path function.
********************************************************************/
@ -64,10 +73,8 @@ NTSTATUS check_access(connection_struct *conn,
uint32_t access_mask)
{
if (fsp) {
if (!(fsp->access_mask & access_mask)) {
return NT_STATUS_ACCESS_DENIED;
}
return NT_STATUS_OK;
NTSTATUS status = check_access_fsp(fsp, access_mask);
return status;
} else {
NTSTATUS status = smbd_check_access_rights(conn,
smb_fname,