vfs_gpfs: Move vfs_gpfs_stat to nfs4_acls.c and rename function
authorChristof Schmitt <cs@samba.org>
Thu, 9 Nov 2023 19:23:49 +0000 (12:23 -0700)
committerJule Anger <janger@samba.org>
Sat, 25 Nov 2023 18:28:13 +0000 (18:28 +0000)
All stat DAC_CAP_OVERRIDE code is moving to nfs4_acls.c to allow reuse
by other file system modules. Also rename the function to the more
generic name nfs4_acl_stat.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
(cherry picked from commit f8a23d960e02f783119c2aef38a6e293ee548df3)

source3/modules/nfs4_acls.c
source3/modules/nfs4_acls.h
source3/modules/vfs_gpfs.c

index 0b29191797b8bc1bef4fb98e920fb3bc8d6e87f6..b643bd8bd7a5dc8da0b8be63f71ec9fe91c2f0a5 100644 (file)
@@ -178,6 +178,20 @@ int stat_with_cap_dac_override(struct vfs_handle_struct *handle,
        return ret;
 }
 
+int nfs4_acl_stat(struct vfs_handle_struct *handle,
+                 struct smb_filename *smb_fname)
+{
+       int ret;
+
+       ret = SMB_VFS_NEXT_STAT(handle, smb_fname);
+       if (ret == -1 && errno == EACCES) {
+               DEBUG(10, ("Trying stat with capability for %s\n",
+                          smb_fname->base_name));
+               ret = stat_with_cap_dac_override(handle, smb_fname, 0);
+       }
+       return ret;
+}
+
 int fstat_with_cap_dac_override(int fd, SMB_STRUCT_STAT *sbuf,
                                bool fake_dir_create_times)
 {
index 828e1da6c39b8499d9139a06a8d298f88c4b9ae0..9de97e0f17960435f904d599334b7356115b77d8 100644 (file)
@@ -127,6 +127,9 @@ int fstatat_with_cap_dac_override(int fd,
 int stat_with_cap_dac_override(struct vfs_handle_struct *handle,
                               struct smb_filename *smb_fname, int flag);
 
+int nfs4_acl_stat(struct vfs_handle_struct *handle,
+                 struct smb_filename *smb_fname);
+
 int fstat_with_cap_dac_override(int fd, SMB_STRUCT_STAT *sbuf,
                                bool fake_dir_create_times);
 
index 57f3890f66fa408cd22b4bddfd4f6c12d2267adf..57a6240630288236f35a56292df306bba4b15d8f 100644 (file)
@@ -1594,20 +1594,6 @@ static NTSTATUS vfs_gpfs_fset_dos_attributes(struct vfs_handle_struct *handle,
        return NT_STATUS_OK;
 }
 
-static int vfs_gpfs_stat(struct vfs_handle_struct *handle,
-                        struct smb_filename *smb_fname)
-{
-       int ret;
-
-       ret = SMB_VFS_NEXT_STAT(handle, smb_fname);
-       if (ret == -1 && errno == EACCES) {
-               DEBUG(10, ("Trying stat with capability for %s\n",
-                          smb_fname->base_name));
-               ret = stat_with_cap_dac_override(handle, smb_fname, 0);
-       }
-       return ret;
-}
-
 static int vfs_gpfs_fstat(struct vfs_handle_struct *handle,
                          struct files_struct *fsp,
                          SMB_STRUCT_STAT *sbuf)
@@ -2597,7 +2583,7 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
        .sys_acl_delete_def_fd_fn = gpfsacl_sys_acl_delete_def_fd,
        .fchmod_fn = vfs_gpfs_fchmod,
        .close_fn = vfs_gpfs_close,
-       .stat_fn = vfs_gpfs_stat,
+       .stat_fn = nfs4_acl_stat,
        .fstat_fn = vfs_gpfs_fstat,
        .lstat_fn = vfs_gpfs_lstat,
        .fstatat_fn = vfs_gpfs_fstatat,