From: Jeremy Allison Date: Thu, 1 Aug 2019 20:29:54 +0000 (-0700) Subject: s3: VFS: Make ntimes return errno = EROFS on a shadow copy path. X-Git-Tag: tdb-1.4.2~258 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=15761609ee9bf5b1276992103f3b4ebbda9c5e83;p=thirdparty%2Fsamba.git s3: VFS: 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: Ralph Boehme --- diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 6a0519eab9e..836898510c4 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -1640,39 +1640,17 @@ static int shadow_copy2_ntimes(vfs_handle_struct *handle, struct smb_file_time *ft) { time_t timestamp = 0; - char *stripped = NULL; - int saved_errno = 0; - int ret; - struct smb_filename *conv; if (!shadow_copy2_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 = shadow_copy2_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); - if (ret == -1) { - saved_errno = errno; - } - TALLOC_FREE(conv); - if (saved_errno != 0) { - errno = saved_errno; - } - return ret; + return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft); } static int shadow_copy2_readlink(vfs_handle_struct *handle,