vfs_gpfs: Move fstatat_with_cap_dac_override to nfs4_acls.c
authorChristof Schmitt <cs@samba.org>
Thu, 9 Nov 2023 19:17:21 +0000 (12:17 -0700)
committerJule Anger <janger@samba.org>
Sat, 25 Nov 2023 18:27:15 +0000 (18:27 +0000)
All stat DAC_CAP_OVERRIDE code is being moved to nfs4_acls.c to allow
reuse by other filesystem modules.

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 316c96ea83a7b70d35879e4743193bb1e9cb566c)

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

index 1107d628e9e993795f75cb7f2f9d77209c768050..418c34b4a83fdb0479bbdc4846ce86e36c7b0159 100644 (file)
@@ -116,6 +116,25 @@ int smbacl4_get_vfs_params(struct connection_struct *conn,
        return 0;
 }
 
+int fstatat_with_cap_dac_override(int fd,
+                                 const char *pathname,
+                                 SMB_STRUCT_STAT *sbuf,
+                                 int flags,
+                                 bool fake_dir_create_times)
+{
+       int ret;
+
+       set_effective_capability(DAC_OVERRIDE_CAPABILITY);
+       ret = sys_fstatat(fd,
+                         pathname,
+                         sbuf,
+                         flags,
+                         fake_dir_create_times);
+       drop_effective_capability(DAC_OVERRIDE_CAPABILITY);
+
+       return ret;
+}
+
 int fstat_with_cap_dac_override(int fd, SMB_STRUCT_STAT *sbuf,
                                bool fake_dir_create_times)
 {
index 096688b0dff7aec4c505d99de08a05d7e80e3da1..edb767f1ce86817ec7f4697cada3db7822a0a7ad 100644 (file)
@@ -118,6 +118,12 @@ struct smbacl4_vfs_params {
 int smbacl4_get_vfs_params(struct connection_struct *conn,
                           struct smbacl4_vfs_params *params);
 
+int fstatat_with_cap_dac_override(int fd,
+                                 const char *pathname,
+                                 SMB_STRUCT_STAT *sbuf,
+                                 int flags,
+                                 bool fake_dir_create_times);
+
 int fstat_with_cap_dac_override(int fd, SMB_STRUCT_STAT *sbuf,
                                bool fake_dir_create_times);
 
index 058f93af28585d9aef965d3491fa94a61c534131..785c169f21c4aaab227573d5df7766724ac438e7 100644 (file)
@@ -1594,25 +1594,6 @@ static NTSTATUS vfs_gpfs_fset_dos_attributes(struct vfs_handle_struct *handle,
        return NT_STATUS_OK;
 }
 
-static int fstatat_with_cap_dac_override(int fd,
-                                        const char *pathname,
-                                        SMB_STRUCT_STAT *sbuf,
-                                        int flags,
-                                        bool fake_dir_create_times)
-{
-       int ret;
-
-       set_effective_capability(DAC_OVERRIDE_CAPABILITY);
-       ret = sys_fstatat(fd,
-                         pathname,
-                         sbuf,
-                         flags,
-                         fake_dir_create_times);
-       drop_effective_capability(DAC_OVERRIDE_CAPABILITY);
-
-       return ret;
-}
-
 static int stat_with_capability(struct vfs_handle_struct *handle,
                                struct smb_filename *smb_fname, int flag)
 {