1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

vfs_gpfs: Move vfs_gpfs_fstat to nfs4_acls.c and rename function

All stat DAC_CAP_OVERRIDE code is moving to nfs4_acls.c to allow reuse.
Move the vfs_gpfs_fstat function and rename to the more generic name
nfs4_acl_fstat.

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 f9301871c61b066c1ea464e6e9109bb2cde71598)
This commit is contained in:
Christof Schmitt 2023-11-09 12:27:58 -07:00 committed by Jule Anger
parent cf8f5bdf95
commit 8ca3c4839f
3 changed files with 26 additions and 22 deletions

View File

@ -204,6 +204,27 @@ int fstat_with_cap_dac_override(int fd, SMB_STRUCT_STAT *sbuf,
return ret;
}
int nfs4_acl_fstat(struct vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_STRUCT_STAT *sbuf)
{
int ret;
ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
if (ret == -1 && errno == EACCES) {
bool fake_dctime =
lp_fake_directory_create_times(SNUM(handle->conn));
DBG_DEBUG("fstat for %s failed with EACCES. Trying with "
"CAP_DAC_OVERRIDE.\n", fsp->fsp_name->base_name);
ret = fstat_with_cap_dac_override(fsp_get_pathref_fd(fsp),
sbuf,
fake_dctime);
}
return ret;
}
/************************************************
Split the ACE flag mapping between nfs4 and Windows
into two separate functions rather than trying to do

View File

@ -133,6 +133,10 @@ int nfs4_acl_stat(struct vfs_handle_struct *handle,
int fstat_with_cap_dac_override(int fd, SMB_STRUCT_STAT *sbuf,
bool fake_dir_create_times);
int nfs4_acl_fstat(struct vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_STRUCT_STAT *sbuf);
struct SMB4ACL_T *smb_create_smb4acl(TALLOC_CTX *mem_ctx);
/* prop's contents are copied */

View File

@ -1594,27 +1594,6 @@ static NTSTATUS vfs_gpfs_fset_dos_attributes(struct vfs_handle_struct *handle,
return NT_STATUS_OK;
}
static int vfs_gpfs_fstat(struct vfs_handle_struct *handle,
struct files_struct *fsp,
SMB_STRUCT_STAT *sbuf)
{
int ret;
ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
if (ret == -1 && errno == EACCES) {
bool fake_dctime =
lp_fake_directory_create_times(SNUM(handle->conn));
DBG_DEBUG("fstat for %s failed with EACCES. Trying with "
"CAP_DAC_OVERRIDE.\n", fsp->fsp_name->base_name);
ret = fstat_with_cap_dac_override(fsp_get_pathref_fd(fsp),
sbuf,
fake_dctime);
}
return ret;
}
static int vfs_gpfs_lstat(struct vfs_handle_struct *handle,
struct smb_filename *smb_fname)
{
@ -2584,7 +2563,7 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
.fchmod_fn = vfs_gpfs_fchmod,
.close_fn = vfs_gpfs_close,
.stat_fn = nfs4_acl_stat,
.fstat_fn = vfs_gpfs_fstat,
.fstat_fn = nfs4_acl_fstat,
.lstat_fn = vfs_gpfs_lstat,
.fstatat_fn = vfs_gpfs_fstatat,
.fntimes_fn = vfs_gpfs_fntimes,