]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Inherit acl from an fsp instead of a fname
authorVolker Lendecke <vl@samba.org>
Thu, 3 Mar 2022 10:32:20 +0000 (11:32 +0100)
committerRalph Boehme <slow@samba.org>
Fri, 4 Mar 2022 17:43:42 +0000 (17:43 +0000)
Moving slowly towards passing directory handles instead of names,
representing the idea that we hold a O_PATH file descriptor on
directories.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/open.c
source3/smbd/posix_acls.c
source3/smbd/proto.h
source3/smbd/trans2.c

index fa5a31361132fda48a881a0ad3eabc213fff70fe..08c040e85db5bc2dda04481910ad1ce17cb4e494 100644 (file)
@@ -1490,7 +1490,7 @@ static NTSTATUS open_file(files_struct *fsp,
                        /* Inherit the ACL if required */
                        if (lp_inherit_permissions(SNUM(conn))) {
                                inherit_access_posix_acl(conn,
-                                                        parent_dir,
+                                                        parent_dir->fsp,
                                                         smb_fname,
                                                         unx_mode);
                                need_re_stat = true;
@@ -4341,7 +4341,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
        }
 
        if (lp_inherit_permissions(SNUM(conn))) {
-               inherit_access_posix_acl(conn, parent_dir_fname,
+               inherit_access_posix_acl(conn, parent_dir_fname->fsp,
                                         smb_dname, mode);
                need_re_stat = true;
        }
index 4cfb821fc14838a7be5c2d611562c01426074610..da3566c1cd93c567109e21fed652606cd2e85dd7 100644 (file)
@@ -4002,17 +4002,17 @@ static bool directory_has_default_posix_acl(struct files_struct *dirfsp)
 ****************************************************************************/
 
 int inherit_access_posix_acl(connection_struct *conn,
-                       struct smb_filename *inherit_from_dir,
-                       const struct smb_filename *smb_fname,
-                       mode_t mode)
+                            struct files_struct *inherit_from_dirfsp,
+                            const struct smb_filename *smb_fname,
+                            mode_t mode)
 {
        int ret;
 
-       if (directory_has_default_posix_acl(inherit_from_dir->fsp))
+       if (directory_has_default_posix_acl(inherit_from_dirfsp))
                return 0;
 
        ret = copy_access_posix_acl(
-               inherit_from_dir->fsp, smb_fname->fsp, mode);
+               inherit_from_dirfsp, smb_fname->fsp, mode);
        return ret;
 }
 
index 63f78024101dbbd9d2b87fb428c2201bba36eb9e..f880a223f7f1a83c3d7bf8cee31e01b28727fb0a 100644 (file)
@@ -860,9 +860,9 @@ int get_acl_group_bits( connection_struct *conn,
                        const struct smb_filename *smb_fname,
                        mode_t *mode);
 int inherit_access_posix_acl(connection_struct *conn,
-                       struct smb_filename *inherit_from_dir,
-                       const struct smb_filename *smb_fname,
-                       mode_t mode);
+                            struct files_struct *inherit_from_dirfsp,
+                            const struct smb_filename *smb_fname,
+                            mode_t mode);
 NTSTATUS set_unix_posix_default_acl(connection_struct *conn,
                                files_struct *fsp,
                                uint16_t num_def_acls, const char *pdata);
index ce274d196be4a92bf4b6337829b90ecf2bc0a8ef..3e0e2db75c314d3b01ccc9872b5e0314a8877cdf 100644 (file)
@@ -8105,7 +8105,7 @@ static NTSTATUS smb_unix_mknod(connection_struct *conn,
 
        if (lp_inherit_permissions(SNUM(conn))) {
                inherit_access_posix_acl(conn,
-                                        parent_fname,
+                                        parent_fname->fsp,
                                         smb_fname,
                                         unixmode);
        }