From: Jeremy Allison Date: Fri, 9 Aug 2019 17:25:14 +0000 (-0700) Subject: s3: VFS: vfs_snapper: Make ntimes return errno = EROFS on a shadow copy path. X-Git-Tag: tdb-1.4.2~169 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78b3784f3ffd1c76a4a41f95cbcc6fe4c68b012f;p=thirdparty%2Fsamba.git s3: VFS: vfs_snapper: 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 Reviewed-by: David Disseldorp --- diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c index b1ab2b9738c..a92d0d55202 100644 --- a/source3/modules/vfs_snapper.c +++ b/source3/modules/vfs_snapper.c @@ -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, - ×tamp, &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; + ×tamp, 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,