From 4ab29e2a345b48ebba652d5154e96adf954a6757 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Fri, 29 Jul 2022 14:54:07 +0200 Subject: [PATCH] smbd: use metadata_fsp() with SMB_VFS_FSET_NT_ACL() BUG: https://bugzilla.samba.org/show_bug.cgi?id=15126 MR: https://gitlab.com/samba-team/samba/-/merge_requests/2643 Signed-off-by: Ralph Boehme Reviewed-by: Volker Lendecke --- source3/smbd/open.c | 2 +- source3/smbd/pysmbd.c | 2 +- source3/torture/cmd_vfs.c | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index a091ce8f9ec..093f9b17257 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -5251,7 +5251,7 @@ static NTSTATUS inherit_new_acl(files_struct *dirfsp, files_struct *fsp) /* We need to be root to force this. */ become_root(); } - status = SMB_VFS_FSET_NT_ACL(fsp, + status = SMB_VFS_FSET_NT_ACL(metadata_fsp(fsp), security_info_sent, psd); if (inherit_owner) { diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c index 6209c6626d2..658de43d2c0 100644 --- a/source3/smbd/pysmbd.c +++ b/source3/smbd/pysmbd.c @@ -281,7 +281,7 @@ static NTSTATUS set_nt_acl_conn(const char *fname, return status; } - status = SMB_VFS_FSET_NT_ACL(fsp, security_info_sent, sd); + status = SMB_VFS_FSET_NT_ACL(metadata_fsp(fsp), security_info_sent, sd); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("set_nt_acl_no_snum: fset_nt_acl returned %s.\n", nt_errstr(status))); } diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index 8d38a7a9ee7..3be450b97bd 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -1717,7 +1717,10 @@ static NTSTATUS cmd_fset_nt_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_PARAMETER; } - status = SMB_VFS_FSET_NT_ACL(vfs->files[fd], SECINFO_OWNER | SECINFO_GROUP | SECINFO_DACL, sd); + status = SMB_VFS_FSET_NT_ACL( + metadata_fsp(vfs->files[fd]), + SECINFO_OWNER | SECINFO_GROUP | SECINFO_DACL, + sd); if (!NT_STATUS_IS_OK(status)) { printf("fset_nt_acl returned (%s)\n", nt_errstr(status)); return status; @@ -1823,7 +1826,10 @@ static NTSTATUS cmd_set_nt_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int a goto out; } - status = SMB_VFS_FSET_NT_ACL(fsp, SECINFO_OWNER | SECINFO_GROUP | SECINFO_DACL, sd); + status = SMB_VFS_FSET_NT_ACL( + metadata_fsp(fsp), + SECINFO_OWNER | SECINFO_GROUP | SECINFO_DACL, + sd); if (!NT_STATUS_IS_OK(status)) { printf("fset_nt_acl returned (%s)\n", nt_errstr(status)); goto out;