1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-01 16:23:49 +03:00

smbd: use check_any_access_fsp() for all access checks

Replaces the direct access to fsp->access_mask with a call to
check_any_access_fsp() which allows doing additional checks if needed.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13688

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Ralph Boehme
2023-12-20 18:01:57 +01:00
parent 995a31c8d4
commit 02ed99343d
12 changed files with 82 additions and 54 deletions

View File

@@ -192,6 +192,7 @@ bool directory_has_default_acl_fsp(struct files_struct *fsp)
NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32_t dosmode)
{
NTSTATUS status;
/*
* Only allow delete on close for writable files.
*/
@@ -220,11 +221,12 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32_t dosmode)
* intent.
*/
if (!(fsp->access_mask & DELETE_ACCESS)) {
DEBUG(10,("can_set_delete_on_close: file %s delete on "
status = check_any_access_fsp(fsp, DELETE_ACCESS);
if (!NT_STATUS_IS_OK(status)) {
DBG_DEBUG("file %s delete on "
"close flag set but delete access denied.\n",
fsp_str_dbg(fsp)));
return NT_STATUS_ACCESS_DENIED;
fsp_str_dbg(fsp));
return status;
}
/* Don't allow delete on close for non-empty directories. */