]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: vfs_snapper: Make ntimes return errno = EROFS on a shadow copy path.
authorJeremy Allison <jra@samba.org>
Fri, 9 Aug 2019 17:25:14 +0000 (10:25 -0700)
committerDavid Disseldorp <ddiss@samba.org>
Mon, 12 Aug 2019 00:00:40 +0000 (00:00 +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>
source3/modules/vfs_snapper.c

index b1ab2b9738c4f6b08bd3d2baea113a518961c71b..a92d0d55202b0887511f6d56203210dce6d00b4b 100644 (file)
@@ -2310,35 +2310,18 @@ static int snapper_gmt_ntimes(vfs_handle_struct *handle,
                              const struct smb_filename *smb_fname,
                              struct smb_file_time *ft)
 {
-       time_t timestamp;
-       char *stripped;
-       int ret, saved_errno;
-       struct smb_filename *conv;
+       time_t timestamp = 0;
 
        if (!snapper_gmt_strip_snapshot(talloc_tos(), handle,
                                        smb_fname->base_name,
-                                       &timestamp, &stripped)) {
-               return -1;
-       }
-       if (timestamp == 0) {
-               return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
-       }
-       conv = cp_smb_filename(talloc_tos(), smb_fname);
-       if (conv == NULL) {
-               errno = ENOMEM;
+                                       &timestamp, NULL)) {
                return -1;
        }
-       conv->base_name = snapper_gmt_convert(conv, handle,
-                                             stripped, timestamp);
-       TALLOC_FREE(stripped);
-       if (conv->base_name == NULL) {
+       if (timestamp != 0) {
+               errno = EROFS;
                return -1;
        }
-       ret = SMB_VFS_NEXT_NTIMES(handle, conv, ft);
-       saved_errno = errno;
-       TALLOC_FREE(conv);
-       errno = saved_errno;
-       return ret;
+       return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
 }
 
 static int snapper_gmt_readlink(vfs_handle_struct *handle,