The branch, master has been updated via 64e594e5dc7 s3: VFS: vfs_ceph_snapshots: Make setxattr return errno = EROFS on a shadow copy path. via a7921ded299 s3: VFS: vfs_ceph_snapshots: Make removexattr return errno = EROFS on a shadow copy path. via 0ebb15a6e23 s3: VFS: vfs_ceph_snapshots: Make chflags return errno = EROFS on a shadow copy path. via b3a5c50a51a s3: VFS: vfs_ceph_snapshots: Make rmdir return errno = EROFS on a shadow copy path. via 9c2c941492a s3: VFS: vfs_ceph_snapshots: Make mkdir return errno = EROFS on a shadow copy path. via 5b1f545589e s3: VFS: vfs_ceph_snapshots: Make mknod return errno = EROFS on a shadow copy path. via eac2ca755f5 s3: VFS: vfs_ceph_snapshots: Make ntimes return errno = EROFS on a shadow copy path. via d1d3d8f3702 s3: VFS: vfs_ceph_snapshots: Make chown return errno = EROFS on a shadow copy path. via a5af9ac8288 s3: VFS: vfs_ceph_snapshots: Make chmod return errno = EROFS on a shadow copy path. via 9f457799a92 s3: VFS: vfs_ceph_snapshots: Make unlink return errno = EROFS on a shadow copy path. from 76bf8a1ac43 mdssvc: Fix the clang build
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 64e594e5dc774cc51ec0bdf9b1c5537c4b66e8ce Author: Jeremy Allison <j...@samba.org> Date: Thu Aug 8 15:59:15 2019 -0700 s3: VFS: vfs_ceph_snapshots: Make setxattr 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 <j...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Fri Aug 9 18:08:03 UTC 2019 on sn-devel-184 commit a7921ded299d138430ab9b37c3f1e1e064f6b3fa Author: Jeremy Allison <j...@samba.org> Date: Thu Aug 8 15:58:10 2019 -0700 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 <j...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> commit 0ebb15a6e236bf920ee9ff901b81b264212c4c37 Author: Jeremy Allison <j...@samba.org> Date: Thu Aug 8 15:56:59 2019 -0700 s3: VFS: vfs_ceph_snapshots: Make chflags 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 <j...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> commit b3a5c50a51a610957a671a2f42bb4269eb8039e2 Author: Jeremy Allison <j...@samba.org> Date: Thu Aug 8 15:56:01 2019 -0700 s3: VFS: vfs_ceph_snapshots: Make rmdir 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 <j...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> commit 9c2c941492a363a96482fe17cfafff1494586b31 Author: Jeremy Allison <j...@samba.org> Date: Thu Aug 8 15:55:04 2019 -0700 s3: VFS: vfs_ceph_snapshots: Make mkdir 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 <j...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> commit 5b1f545589e0027e53d56058cbaaaa8c97eaf35d Author: Jeremy Allison <j...@samba.org> Date: Thu Aug 8 15:53:51 2019 -0700 s3: VFS: vfs_ceph_snapshots: Make mknod 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 <j...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> commit eac2ca755f5d09483465732e51ec5b51072628b2 Author: Jeremy Allison <j...@samba.org> Date: Thu Aug 8 15:52:14 2019 -0700 s3: VFS: vfs_ceph_snapshots: Make ntimes 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 <j...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> commit d1d3d8f37021bc18d30c8c97f99f1e0d28fdd646 Author: Jeremy Allison <j...@samba.org> Date: Thu Aug 8 15:48:54 2019 -0700 s3: VFS: vfs_ceph_snapshots: Make chown 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 <j...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> commit a5af9ac8288af1e8cd3ca080eb966d0b9ff34dc2 Author: Jeremy Allison <j...@samba.org> Date: Thu Aug 8 15:47:44 2019 -0700 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 <j...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> commit 9f457799a92c34bf8c881142b308a37648bea943 Author: Jeremy Allison <j...@samba.org> Date: Thu Aug 8 15:45:10 2019 -0700 s3: VFS: vfs_ceph_snapshots: Make unlink 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 <j...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> ----------------------------------------------------------------------- Summary of changes: source3/modules/vfs_ceph_snapshots.c | 285 +++++------------------------------ 1 file changed, 40 insertions(+), 245 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c index 4d935a55a1a..a70a6adb1f4 100644 --- a/source3/modules/vfs_ceph_snapshots.c +++ b/source3/modules/vfs_ceph_snapshots.c @@ -958,41 +958,20 @@ static int ceph_snap_gmt_unlink(vfs_handle_struct *handle, const struct smb_filename *csmb_fname) { 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)); + ×tamp, NULL, 0); if (ret < 0) { errno = -ret; return -1; } - if (timestamp == 0) { - return SMB_VFS_NEXT_UNLINK(handle, csmb_fname); - } - - ret = ceph_snap_gmt_convert(handle, stripped, - timestamp, conv, sizeof(conv)); - 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_UNLINK(handle, new_fname); - saved_errno = errno; - TALLOC_FREE(new_fname); - errno = saved_errno; - return ret; + return SMB_VFS_NEXT_UNLINK(handle, csmb_fname); } static int ceph_snap_gmt_chmod(vfs_handle_struct *handle, @@ -1000,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, - ×tamp, stripped, sizeof(stripped)); + ×tamp, 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; - 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_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, @@ -1043,41 +1001,20 @@ static int ceph_snap_gmt_chown(vfs_handle_struct *handle, gid_t gid) { 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)); + ×tamp, NULL, 0); if (ret < 0) { errno = -ret; return -1; } - if (timestamp == 0) { - return SMB_VFS_NEXT_CHOWN(handle, csmb_fname, uid, gid); - } - - ret = ceph_snap_gmt_convert(handle, stripped, - timestamp, conv, sizeof(conv)); - 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_CHOWN(handle, new_fname, uid, gid); - saved_errno = errno; - TALLOC_FREE(new_fname); - errno = saved_errno; - return ret; + return SMB_VFS_NEXT_CHOWN(handle, csmb_fname, uid, gid); } static int ceph_snap_gmt_chdir(vfs_handle_struct *handle, @@ -1126,41 +1063,20 @@ static int ceph_snap_gmt_ntimes(vfs_handle_struct *handle, struct smb_file_time *ft) { 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_NTIMES(handle, csmb_fname, ft); - } - - 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_NTIMES(handle, new_fname, ft); - saved_errno = errno; - TALLOC_FREE(new_fname); - errno = saved_errno; - return ret; + return SMB_VFS_NEXT_NTIMES(handle, csmb_fname, ft); } static int ceph_snap_gmt_readlink(vfs_handle_struct *handle, @@ -1211,40 +1127,20 @@ static int ceph_snap_gmt_mknod(vfs_handle_struct *handle, SMB_DEV_T dev) { 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)); + ×tamp, NULL, 0); if (ret < 0) { errno = -ret; return -1; } - if (timestamp == 0) { - return SMB_VFS_NEXT_MKNOD(handle, csmb_fname, mode, dev); - } - ret = ceph_snap_gmt_convert(handle, stripped, - timestamp, conv, sizeof(conv)); - 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_MKNOD(handle, new_fname, mode, dev); - saved_errno = errno; - TALLOC_FREE(new_fname); - errno = saved_errno; - return ret; + return SMB_VFS_NEXT_MKNOD(handle, csmb_fname, mode, dev); } static struct smb_filename *ceph_snap_gmt_realpath(vfs_handle_struct *handle, @@ -1387,80 +1283,40 @@ static int ceph_snap_gmt_mkdir(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, - ×tamp, stripped, sizeof(stripped)); - if (ret < 0) { - errno = -ret; - return -1; - } - if (timestamp == 0) { - return SMB_VFS_NEXT_MKDIR(handle, csmb_fname, mode); - } - ret = ceph_snap_gmt_convert_dir(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_MKDIR(handle, new_fname, mode); - saved_errno = errno; - TALLOC_FREE(new_fname); - errno = saved_errno; - return ret; + return SMB_VFS_NEXT_MKDIR(handle, csmb_fname, mode); } static int ceph_snap_gmt_rmdir(vfs_handle_struct *handle, const struct smb_filename *csmb_fname) { 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)); + ×tamp, NULL, 0); if (ret < 0) { errno = -ret; return -1; } - if (timestamp == 0) { - return SMB_VFS_NEXT_RMDIR(handle, csmb_fname); - } - ret = ceph_snap_gmt_convert_dir(handle, stripped, - timestamp, conv, sizeof(conv)); - 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_RMDIR(handle, new_fname); - saved_errno = errno; - TALLOC_FREE(new_fname); - errno = saved_errno; - return ret; + return SMB_VFS_NEXT_RMDIR(handle, csmb_fname); } static int ceph_snap_gmt_chflags(vfs_handle_struct *handle, @@ -1468,40 +1324,20 @@ static int ceph_snap_gmt_chflags(vfs_handle_struct *handle, unsigned int flags) { 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)); + ×tamp, NULL, 0); if (ret < 0) { errno = -ret; return -1; } - if (timestamp == 0) { - return SMB_VFS_NEXT_CHFLAGS(handle, csmb_fname, flags); - } - ret = ceph_snap_gmt_convert(handle, stripped, - timestamp, conv, sizeof(conv)); - 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_CHFLAGS(handle, new_fname, flags); - saved_errno = errno; - TALLOC_FREE(new_fname); - errno = saved_errno; - return ret; + return SMB_VFS_NEXT_CHFLAGS(handle, csmb_fname, flags); } static ssize_t ceph_snap_gmt_getxattr(vfs_handle_struct *handle, @@ -1594,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, @@ -1636,42 +1452,21 @@ static int ceph_snap_gmt_setxattr(struct vfs_handle_struct *handle, size_t size, int flags) { 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)); + ×tamp, NULL, 0); if (ret < 0) { errno = -ret; return -1; } - if (timestamp == 0) { - return SMB_VFS_NEXT_SETXATTR(handle, csmb_fname, - aname, value, size, flags); - } - ret = ceph_snap_gmt_convert(handle, stripped, - timestamp, conv, sizeof(conv)); - 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_SETXATTR(handle, new_fname, + return SMB_VFS_NEXT_SETXATTR(handle, csmb_fname, aname, value, size, flags); - saved_errno = errno; - TALLOC_FREE(new_fname); - errno = saved_errno; - return ret; } static int ceph_snap_gmt_get_real_filename(struct vfs_handle_struct *handle, -- Samba Shared Repository