From: Noel Power Date: Fri, 9 Apr 2021 13:57:08 +0000 (+0200) Subject: s3/modules: VFS: snapper: Add new fchmod_fn implementation X-Git-Tag: tevent-0.11.0~1220 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7501407f988d19f16a2f441f260df056ef8842b5;p=thirdparty%2Fsamba.git s3/modules: VFS: snapper: Add new fchmod_fn implementation Signed-off-by: Noel Power Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c index 3b900c835a0..412a77059c9 100644 --- a/source3/modules/vfs_snapper.c +++ b/source3/modules/vfs_snapper.c @@ -2170,6 +2170,30 @@ static int snapper_gmt_chmod(vfs_handle_struct *handle, return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode); } +static int snapper_gmt_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 (!snapper_gmt_strip_snapshot(talloc_tos(), + handle, + smb_fname, + ×tamp, + NULL)) { + return -1; + } + + if (timestamp != 0) { + errno = EROFS; + return -1; + } + return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode); +} + static int snapper_gmt_chdir(vfs_handle_struct *handle, const struct smb_filename *smb_fname) { @@ -2726,6 +2750,7 @@ static struct vfs_fn_pointers snapper_fns = { .openat_fn = snapper_gmt_openat, .unlinkat_fn = snapper_gmt_unlinkat, .chmod_fn = snapper_gmt_chmod, + .fchmod_fn = snapper_gmt_fchmod, .chdir_fn = snapper_gmt_chdir, .ntimes_fn = snapper_gmt_ntimes, .readlinkat_fn = snapper_gmt_readlinkat,