]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: vfs_ceph_snapshots: Make removexattr return errno = EROFS on a shadow copy...
authorJeremy Allison <jra@samba.org>
Thu, 8 Aug 2019 22:58:10 +0000 (15:58 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 9 Aug 2019 16:48:37 +0000 (16:48 +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_ceph_snapshots.c

index 315472086c069d16cf04dddb1c47a45fabffd12c..a528dbcaaeb727e8445c39b73af09dee9cd2cff8 100644 (file)
@@ -1430,40 +1430,20 @@ static int ceph_snap_gmt_removexattr(vfs_handle_struct *handle,
                                const char *aname)
 {
        time_t timestamp = 0;
-       char stripped[PATH_MAX + 1];
-       char conv[PATH_MAX + 1];
        int ret;
-       struct smb_filename *new_fname;
-       int saved_errno;
 
        ret = ceph_snap_gmt_strip_snapshot(handle,
                                        csmb_fname->base_name,
-                                       &timestamp, stripped, sizeof(stripped));
-       if (ret < 0) {
-               errno = -ret;
-               return -1;
-       }
-       if (timestamp == 0) {
-               return SMB_VFS_NEXT_REMOVEXATTR(handle, csmb_fname, aname);
-       }
-       ret = ceph_snap_gmt_convert(handle, stripped,
-                                       timestamp, conv, sizeof(conv));
+                                       &timestamp, NULL, 0);
        if (ret < 0) {
                errno = -ret;
                return -1;
        }
-       new_fname = cp_smb_filename(talloc_tos(), csmb_fname);
-       if (new_fname == NULL) {
-               errno = ENOMEM;
+       if (timestamp != 0) {
+               errno = EROFS;
                return -1;
        }
-       new_fname->base_name = conv;
-
-       ret = SMB_VFS_NEXT_REMOVEXATTR(handle, new_fname, aname);
-       saved_errno = errno;
-       TALLOC_FREE(new_fname);
-       errno = saved_errno;
-       return ret;
+       return SMB_VFS_NEXT_REMOVEXATTR(handle, csmb_fname, aname);
 }
 
 static int ceph_snap_gmt_setxattr(struct vfs_handle_struct *handle,