1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-28 09:49:30 +03:00

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 <cs@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
(cherry picked from commit f8a23d960e)
This commit is contained in:
Christof Schmitt
2023-11-09 12:23:49 -07:00
committed by Jule Anger
parent 776091ad50
commit cf8f5bdf95
3 changed files with 18 additions and 15 deletions

View 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)
{

View 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);

View 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,