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

s3/modules: VFS: shadow_copy2: Add new fchmod_fn implementation

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Noel Power 2021-04-09 15:54:44 +02:00 committed by Noel Power
parent f54ec00eca
commit a412b5cc79

View File

@ -1448,6 +1448,28 @@ static int shadow_copy2_chmod(vfs_handle_struct *handle,
return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
}
static int shadow_copy2_fchmod(vfs_handle_struct *handle,
struct files_struct *fsp,
mode_t mode)
{
time_t timestamp = 0;
const struct smb_filename *smb_fname = NULL;
smb_fname = fsp->fsp_name;
if (!shadow_copy2_strip_snapshot(talloc_tos(),
handle,
smb_fname,
&timestamp,
NULL)) {
return -1;
}
if (timestamp != 0) {
errno = EROFS;
return -1;
}
return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
}
static void store_cwd_data(vfs_handle_struct *handle,
const char *connectpath)
{
@ -3171,6 +3193,7 @@ static struct vfs_fn_pointers vfs_shadow_copy2_fns = {
.openat_fn = shadow_copy2_openat,
.unlinkat_fn = shadow_copy2_unlinkat,
.chmod_fn = shadow_copy2_chmod,
.fchmod_fn = shadow_copy2_fchmod,
.chdir_fn = shadow_copy2_chdir,
.ntimes_fn = shadow_copy2_ntimes,
.readlinkat_fn = shadow_copy2_readlinkat,