From: Jeremy Allison Date: Thu, 8 Aug 2019 22:58:10 +0000 (-0700) Subject: s3: VFS: vfs_ceph_snapshots: Make removexattr return errno = EROFS on a shadow copy... X-Git-Tag: tdb-1.4.2~190 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7921ded299d138430ab9b37c3f1e1e064f6b3fa;p=thirdparty%2Fsamba.git s3: VFS: vfs_ceph_snapshots: Make removexattr return errno = EROFS on a shadow copy path. smbd has no business modifying a shadow copy filesystem, it should be read-only. Signed-off-by: Jeremy Allison Reviewed-by: David Disseldorp --- diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c index 315472086c0..a528dbcaaeb 100644 --- a/source3/modules/vfs_ceph_snapshots.c +++ b/source3/modules/vfs_ceph_snapshots.c @@ -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, - ×tamp, 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)); + ×tamp, 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,