]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: Make mknod return errno = EROFS on a shadow copy path.
authorJeremy Allison <jra@samba.org>
Thu, 1 Aug 2019 20:31:01 +0000 (13:31 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 7 Aug 2019 16:40:31 +0000 (16:40 +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>
source3/modules/vfs_shadow_copy2.c

index 836898510c43e7965ed6c54e74d1f2c776713fee..5256eed10112e9ab5989df9f8ba1d56ff36f2ce4 100644 (file)
@@ -1701,39 +1701,17 @@ static int shadow_copy2_mknod(vfs_handle_struct *handle,
                                SMB_DEV_T dev)
 {
        time_t timestamp = 0;
-       char *stripped = NULL;
-       int saved_errno = 0;
-       int ret;
-       struct smb_filename *conv = NULL;
 
        if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
                                         smb_fname->base_name,
-                                        &timestamp, &stripped)) {
-               return -1;
-       }
-       if (timestamp == 0) {
-               return SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
-       }
-       conv = cp_smb_filename(talloc_tos(), smb_fname);
-       if (conv == NULL) {
-               errno = ENOMEM;
+                                        &timestamp, NULL)) {
                return -1;
        }
-       conv->base_name = shadow_copy2_convert(
-               conv, handle, stripped, timestamp);
-       TALLOC_FREE(stripped);
-       if (conv->base_name == NULL) {
+       if (timestamp != 0) {
+               errno = EROFS;
                return -1;
        }
-       ret = SMB_VFS_NEXT_MKNOD(handle, conv, mode, dev);
-       if (ret == -1) {
-               saved_errno = errno;
-       }
-       TALLOC_FREE(conv);
-       if (saved_errno != 0) {
-               errno = saved_errno;
-       }
-       return ret;
+       return SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
 }
 
 static struct smb_filename *shadow_copy2_realpath(vfs_handle_struct *handle,