1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-07 17:18:11 +03:00

vfs_gpfs: Move fstatat_with_cap_dac_override to nfs4_acls.c

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 316c96ea83)
This commit is contained in:
Christof Schmitt 2023-11-09 12:17:21 -07:00 committed by Jule Anger
parent f00db2a13b
commit 53e4d90dbd
3 changed files with 25 additions and 19 deletions

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

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

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