s3: smbd: Add a dirfsp parameter to directory_has_default_acl().
authorJeremy Allison <jra@samba.org>
Wed, 29 Apr 2020 22:14:41 +0000 (15:14 -0700)
committerRalph Boehme <slow@samba.org>
Thu, 30 Apr 2020 07:33:41 +0000 (07:33 +0000)
Not yet used, but will make it easier to move to SMB_VFS_GET_NT_ACL_AT()
later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_ceph.c
source3/modules/vfs_default.c
source3/smbd/file_access.c
source3/smbd/open.c
source3/smbd/proto.h

index d7ddb9e0365d45e5db8475cccc5b65377922b839..ef426a0d64f1a7d393ebe682ee8b57ebd752c68b 100644 (file)
@@ -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;
index 7cde6384b61bb4b5733f652380149f66090c3c60..6609cabe2e09a6547dd5182ec7b4f90edfef72ea 100644 (file)
@@ -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)));
index 2e114e965908c3d3301a0332a42d15c8a73ada59..42936478f92a2adb609638fe73875a8ab72ccb73 100644 (file)
@@ -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;
index 4e35a84e1ab1c513cbb962e4b07ea4f462f664b0..aa86cef944a2056a8fa20cc48729944bc0986a29 100644 (file)
@@ -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)));
index bc365206f276e8755c027c29d8a88bee76c78874..1bc199b32ded31cf22db809981635c0a47e22bb5 100644 (file)
@@ -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);