From: Christof Schmitt Date: Thu, 9 Nov 2023 19:23:49 +0000 (-0700) Subject: vfs_gpfs: Move vfs_gpfs_stat to nfs4_acls.c and rename function X-Git-Tag: samba-4.18.9~10 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=cf8f5bdf9563066e4b82ff20d8217bdba705ace7;p=samba.git vfs_gpfs: Move vfs_gpfs_stat to nfs4_acls.c and rename function 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 Reviewed-by: Björn Jacke (cherry picked from commit f8a23d960e02f783119c2aef38a6e293ee548df3) --- diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c index 0b29191797b..b643bd8bd7a 100644 --- a/source3/modules/nfs4_acls.c +++ b/source3/modules/nfs4_acls.c @@ -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) { diff --git a/source3/modules/nfs4_acls.h b/source3/modules/nfs4_acls.h index 828e1da6c39..9de97e0f179 100644 --- a/source3/modules/nfs4_acls.h +++ b/source3/modules/nfs4_acls.h @@ -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); diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 57f3890f66f..57a62406302 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -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,