]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: vfs_snapper: Make setxattr return errno = EROFS on a shadow copy path.
authorJeremy Allison <jra@samba.org>
Fri, 9 Aug 2019 17:32:41 +0000 (10:32 -0700)
committerDavid Disseldorp <ddiss@samba.org>
Mon, 12 Aug 2019 01:18:44 +0000 (01:18 +0000)
smbd has no business modifying a shadow copy filesystem, it should be read-only.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Mon Aug 12 01:18:45 UTC 2019 on sn-devel-184

source3/modules/vfs_snapper.c

index cb1921cdd121ddaaae7b81e49f714e1796b22de1..03bcf658ec6c1cd0ec3a75c4455ae5cc45306a04 100644 (file)
@@ -2688,49 +2688,20 @@ static int snapper_gmt_setxattr(struct vfs_handle_struct *handle,
                                size_t size, int flags)
 {
        time_t timestamp = 0;
-       char *stripped = NULL;
-       ssize_t ret;
-       int saved_errno = 0;
-       char *conv = NULL;
-       struct smb_filename *conv_smb_fname = NULL;
 
        if (!snapper_gmt_strip_snapshot(talloc_tos(),
                                        handle,
                                        smb_fname->base_name,
                                        &timestamp,
-                                       &stripped)) {
-               return -1;
-       }
-       if (timestamp == 0) {
-               return SMB_VFS_NEXT_SETXATTR(handle, smb_fname,
-                                       aname, value, size, flags);
-       }
-       conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
-       TALLOC_FREE(stripped);
-       if (conv == NULL) {
+                                       NULL)) {
                return -1;
        }
-       conv_smb_fname = synthetic_smb_fname(talloc_tos(),
-                                       conv,
-                                       NULL,
-                                       NULL,
-                                       smb_fname->flags);
-       TALLOC_FREE(conv);
-       if (conv_smb_fname == NULL) {
-               errno = ENOMEM;
+       if (timestamp != 0) {
+               errno = EROFS;
                return -1;
        }
-       ret = SMB_VFS_NEXT_SETXATTR(handle, conv_smb_fname,
+       return SMB_VFS_NEXT_SETXATTR(handle, smb_fname,
                                aname, value, size, flags);
-       if (ret == -1) {
-               saved_errno = errno;
-       }
-       TALLOC_FREE(conv_smb_fname);
-       TALLOC_FREE(conv);
-       if (saved_errno != 0) {
-               errno = saved_errno;
-       }
-       return ret;
 }
 
 static int snapper_gmt_get_real_filename(struct vfs_handle_struct *handle,