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_lstat to nfs4_acls.c and rename function

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)
This commit is contained in:
Christof Schmitt 2023-11-09 12:30:27 -07:00 committed by Jule Anger
parent 8ca3c4839f
commit 790363f076
3 changed files with 19 additions and 16 deletions

View File

@ -225,6 +225,21 @@ int nfs4_acl_fstat(struct vfs_handle_struct *handle,
return ret; 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 Split the ACE flag mapping between nfs4 and Windows
into two separate functions rather than trying to do into two separate functions rather than trying to do

View File

@ -137,6 +137,9 @@ int nfs4_acl_fstat(struct vfs_handle_struct *handle,
struct files_struct *fsp, struct files_struct *fsp,
SMB_STRUCT_STAT *sbuf); 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); struct SMB4ACL_T *smb_create_smb4acl(TALLOC_CTX *mem_ctx);
/* prop's contents are copied */ /* prop's contents are copied */

View File

@ -1594,21 +1594,6 @@ static NTSTATUS vfs_gpfs_fset_dos_attributes(struct vfs_handle_struct *handle,
return NT_STATUS_OK; 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, static int vfs_gpfs_fstatat(struct vfs_handle_struct *handle,
const struct files_struct *dirfsp, const struct files_struct *dirfsp,
const struct smb_filename *smb_fname, const struct smb_filename *smb_fname,
@ -2564,7 +2549,7 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
.close_fn = vfs_gpfs_close, .close_fn = vfs_gpfs_close,
.stat_fn = nfs4_acl_stat, .stat_fn = nfs4_acl_stat,
.fstat_fn = nfs4_acl_fstat, .fstat_fn = nfs4_acl_fstat,
.lstat_fn = vfs_gpfs_lstat, .lstat_fn = nfs4_acl_lstat,
.fstatat_fn = vfs_gpfs_fstatat, .fstatat_fn = vfs_gpfs_fstatat,
.fntimes_fn = vfs_gpfs_fntimes, .fntimes_fn = vfs_gpfs_fntimes,
.aio_force_fn = vfs_gpfs_aio_force, .aio_force_fn = vfs_gpfs_aio_force,