]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/modules: snapper: Add missing fsetxattr_fn impl
authorNoel Power <noel.power@suse.com>
Wed, 10 Mar 2021 09:24:04 +0000 (09:24 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 11 Mar 2021 17:50:30 +0000 (17:50 +0000)
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_snapper.c

index 20de30249cf2053e13f461f5d4c933c3a7d80903..a9d88e6fcd67dfba88e41fde21987fca0eca4ee5 100644 (file)
@@ -2553,6 +2553,31 @@ static int snapper_gmt_setxattr(struct vfs_handle_struct *handle,
                                aname, value, size, flags);
 }
 
+static int snapper_gmt_fsetxattr(struct vfs_handle_struct *handle,
+                               struct files_struct *fsp,
+                               const char *aname, const void *value,
+                               size_t size, int flags)
+{
+       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,
+                                       &timestamp,
+                                       NULL)) {
+               return -1;
+       }
+       if (timestamp != 0) {
+               errno = EROFS;
+               return -1;
+       }
+       return SMB_VFS_NEXT_FSETXATTR(handle, fsp,
+                               aname, value, size, flags);
+}
+
 static int snapper_gmt_get_real_filename(struct vfs_handle_struct *handle,
                                         const struct smb_filename *fpath,
                                         const char *name,
@@ -2755,6 +2780,7 @@ static struct vfs_fn_pointers snapper_fns = {
        .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv,
        .removexattr_fn = snapper_gmt_removexattr,
        .setxattr_fn = snapper_gmt_setxattr,
+       .fsetxattr_fn = snapper_gmt_fsetxattr,
        .chflags_fn = snapper_gmt_chflags,
        .get_real_filename_fn = snapper_gmt_get_real_filename,
 };