vfs_gpfs: Move vfs_gpfs_lstat to nfs4_acls.c and rename function
authorChristof Schmitt <cs@samba.org>
Thu, 9 Nov 2023 19:30:27 +0000 (12:30 -0700)
committerJule Anger <janger@samba.org>
Sat, 25 Nov 2023 18:27:15 +0000 (18:27 +0000)
All stat CAP_DAC_OVERRIDE code is being moved to nf4_acls.c to allow
reuse. Move the vfs_gpfs_lstat function and rename to the more generic
name nfs4_acl_lstat.

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 2c1195678d34516744ba4f8b1c5582f4046cba35)

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

index bf863f3227b914a7e61a2b353346f328079cbea0..83a5e034471c1d11d825e09e7c3923a48d30c063 100644 (file)
@@ -225,6 +225,21 @@ int nfs4_acl_fstat(struct vfs_handle_struct *handle,
        return ret;
 }
 
+int nfs4_acl_lstat(struct vfs_handle_struct *handle,
+                  struct smb_filename *smb_fname)
+{
+       int ret;
+
+       ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
+       if (ret == -1 && errno == EACCES) {
+               DEBUG(10, ("Trying lstat with capability for %s\n",
+                          smb_fname->base_name));
+               ret = stat_with_cap_dac_override(handle, smb_fname,
+                                                AT_SYMLINK_NOFOLLOW);
+       }
+       return ret;
+}
+
 /************************************************
  Split the ACE flag mapping between nfs4 and Windows
  into two separate functions rather than trying to do
index d1a585d7932d247157bba79ec7f1c00539cda31c..ee97207387bf1067d0699fbda4b029d8c82bfe2b 100644 (file)
@@ -137,6 +137,9 @@ int nfs4_acl_fstat(struct vfs_handle_struct *handle,
                   struct files_struct *fsp,
                   SMB_STRUCT_STAT *sbuf);
 
+int nfs4_acl_lstat(struct vfs_handle_struct *handle,
+                  struct smb_filename *smb_fname);
+
 struct SMB4ACL_T *smb_create_smb4acl(TALLOC_CTX *mem_ctx);
 
 /* prop's contents are copied */
index 3594643de956d78d98af014577864e079a898653..70294635f636da36b531283d0fe6fa9d2d86949e 100644 (file)
@@ -1594,21 +1594,6 @@ static NTSTATUS vfs_gpfs_fset_dos_attributes(struct vfs_handle_struct *handle,
        return NT_STATUS_OK;
 }
 
-static int vfs_gpfs_lstat(struct vfs_handle_struct *handle,
-                         struct smb_filename *smb_fname)
-{
-       int ret;
-
-       ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
-       if (ret == -1 && errno == EACCES) {
-               DEBUG(10, ("Trying lstat with capability for %s\n",
-                          smb_fname->base_name));
-               ret = stat_with_cap_dac_override(handle, smb_fname,
-                                                AT_SYMLINK_NOFOLLOW);
-       }
-       return ret;
-}
-
 static int vfs_gpfs_fstatat(struct vfs_handle_struct *handle,
                            const struct files_struct *dirfsp,
                            const struct smb_filename *smb_fname,
@@ -2575,7 +2560,7 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
        .close_fn = vfs_gpfs_close,
        .stat_fn = nfs4_acl_stat,
        .fstat_fn = nfs4_acl_fstat,
-       .lstat_fn = vfs_gpfs_lstat,
+       .lstat_fn = nfs4_acl_lstat,
        .fstatat_fn = vfs_gpfs_fstatat,
        .fntimes_fn = vfs_gpfs_fntimes,
        .aio_force_fn = vfs_gpfs_aio_force,