]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: Make setxattr return errno = EROFS on a shadow copy path.
authorJeremy Allison <jra@samba.org>
Thu, 1 Aug 2019 20:40:43 +0000 (13:40 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 7 Aug 2019 17:59:25 +0000 (17:59 +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: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Aug  7 17:59:25 UTC 2019 on sn-devel-184

source3/modules/vfs_shadow_copy2.c

index b0714bd22eaaf6c9ddc6eb64fee7817462988aa7..f84a76b5357c96dbfc05c93110309a1c855b5c86 100644 (file)
@@ -2425,48 +2425,20 @@ static int shadow_copy2_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;
-       struct smb_filename *conv_smb_fname = NULL;
 
        if (!shadow_copy2_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 = shadow_copy2_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);
-       if (conv_smb_fname == NULL) {
-               TALLOC_FREE(conv);
+       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 shadow_copy2_get_real_filename(struct vfs_handle_struct *handle,