From 152fb23fac4431adbf4978298104d14dee100b0d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Apr 2020 15:14:41 -0700 Subject: [PATCH] s3: smbd: Add a dirfsp parameter to directory_has_default_acl(). Not yet used, but will make it easier to move to SMB_VFS_GET_NT_ACL_AT() later. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/modules/vfs_ceph.c | 1 + source3/modules/vfs_default.c | 1 + source3/smbd/file_access.c | 1 + source3/smbd/open.c | 1 + source3/smbd/proto.h | 1 + 5 files changed, 5 insertions(+) diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index d7ddb9e0365..ef426a0d64f 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -366,6 +366,7 @@ static int cephwrap_mkdirat(struct vfs_handle_struct *handle, if (lp_inherit_acls(SNUM(handle->conn))) { ok = parent_smb_fname(talloc_tos(), smb_fname, &parent, NULL); if (ok && directory_has_default_acl(handle->conn, + dirfsp, parent)) { mode = 0777; diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 7cde6384b61..6609cabe2e0 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -638,6 +638,7 @@ static int vfswrap_mkdirat(vfs_handle_struct *handle, if (lp_inherit_acls(SNUM(handle->conn))) { ok = parent_smb_fname(talloc_tos(), smb_fname, &parent, NULL); if (ok && directory_has_default_acl(handle->conn, + dirfsp, parent)) { mode = (0777 & lp_directory_mask(SNUM(handle->conn))); diff --git a/source3/smbd/file_access.c b/source3/smbd/file_access.c index 2e114e96590..42936478f92 100644 --- a/source3/smbd/file_access.c +++ b/source3/smbd/file_access.c @@ -141,6 +141,7 @@ bool can_write_to_file(connection_struct *conn, ****************************************************************************/ bool directory_has_default_acl(connection_struct *conn, + struct files_struct *dirfsp, struct smb_filename *smb_fname) { struct security_descriptor *secdesc = NULL; diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 4e35a84e1ab..aa86cef944a 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3593,6 +3593,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, if ((flags2 & O_CREAT) && lp_inherit_acls(SNUM(conn)) && (def_acl = directory_has_default_acl(conn, + conn->cwd_fsp, parent_dir_fname))) { unx_mode = (0777 & lp_create_mask(SNUM(conn))); diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index bc365206f27..1bc199b32de 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -335,6 +335,7 @@ bool can_delete_file_in_directory(connection_struct *conn, bool can_write_to_file(connection_struct *conn, const struct smb_filename *smb_fname); bool directory_has_default_acl(connection_struct *conn, + struct files_struct *dirfsp, struct smb_filename *smb_fname); NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32_t dosmode); -- 2.47.3