1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

s3: VFS: vfs_ceph_snapshots: Make chmod 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 <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
This commit is contained in:
Jeremy Allison 2019-08-08 15:47:44 -07:00
parent 9f457799a9
commit a5af9ac828

View File

@ -979,41 +979,20 @@ static int ceph_snap_gmt_chmod(vfs_handle_struct *handle,
mode_t mode)
{
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));
&timestamp, NULL, 0);
if (ret < 0) {
errno = -ret;
return -1;
}
if (timestamp == 0) {
return SMB_VFS_NEXT_CHMOD(handle, csmb_fname, mode);
}
ret = ceph_snap_gmt_convert(handle, stripped,
timestamp, conv, sizeof(conv));
if (ret < 0) {
errno = -ret;
if (timestamp != 0) {
errno = EROFS;
return -1;
}
new_fname = cp_smb_filename(talloc_tos(), csmb_fname);
if (new_fname == NULL) {
errno = ENOMEM;
return -1;
}
new_fname->base_name = conv;
ret = SMB_VFS_NEXT_CHMOD(handle, new_fname, mode);
saved_errno = errno;
TALLOC_FREE(new_fname);
errno = saved_errno;
return ret;
return SMB_VFS_NEXT_CHMOD(handle, csmb_fname, mode);
}
static int ceph_snap_gmt_chown(vfs_handle_struct *handle,