From: Noel Power Date: Fri, 11 Jun 2021 14:46:56 +0000 (+0100) Subject: VFS: snapper: Add SMB_VFS_FCHFLAGS implementation X-Git-Tag: tevent-0.11.0~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a346647edd2e0b9b81dc75067b584a92fcd1eb56;p=thirdparty%2Fsamba.git VFS: snapper: Add SMB_VFS_FCHFLAGS implementation Signed-off-by: Noel Power Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c index d475dff7663..ba27a12367c 100644 --- a/source3/modules/vfs_snapper.c +++ b/source3/modules/vfs_snapper.c @@ -2408,6 +2408,23 @@ static int snapper_gmt_chflags(vfs_handle_struct *handle, return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags); } +static int snapper_gmt_fchflags(vfs_handle_struct *handle, + struct files_struct *fsp, + unsigned int flags) +{ + time_t timestamp = 0; + + if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, + fsp->fsp_name, ×tamp, NULL)) { + return -1; + } + if (timestamp != 0) { + errno = EROFS; + return -1; + } + return SMB_VFS_NEXT_FCHFLAGS(handle, fsp, flags); +} + static ssize_t snapper_gmt_getxattr(vfs_handle_struct *handle, const struct smb_filename *smb_fname, const char *aname, @@ -2686,6 +2703,7 @@ static struct vfs_fn_pointers snapper_fns = { .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv, .fsetxattr_fn = snapper_gmt_fsetxattr, .chflags_fn = snapper_gmt_chflags, + .fchflags_fn = snapper_gmt_fchflags, .get_real_filename_fn = snapper_gmt_get_real_filename, };