From fc405e919d606a3cdb59d557cadeeb953534c1b5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 1 Aug 2019 13:39:42 -0700 Subject: [PATCH] s3: VFS: 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: Ralph Boehme --- source3/modules/vfs_shadow_copy2.c | 35 ++++-------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index c66fc233a9d..b0714bd22ea 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -2404,46 +2404,19 @@ static int shadow_copy2_removexattr(vfs_handle_struct *handle, const char *aname) { time_t timestamp = 0; - char *stripped = NULL; - int saved_errno = 0; - int ret; - char *conv; - struct smb_filename *conv_smb_fname = NULL; if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, smb_fname->base_name, ×tamp, - &stripped)) { - return -1; - } - if (timestamp == 0) { - return SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname, aname); - } - conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp); - TALLOC_FREE(stripped); - if (conv == NULL) { + NULL)) { return -1; } - conv_smb_fname = synthetic_smb_fname(talloc_tos(), - conv, - NULL, - NULL, - smb_fname->flags); - if (conv_smb_fname == NULL) { - TALLOC_FREE(conv); + if (timestamp != 0) { + errno = EROFS; return -1; } - ret = SMB_VFS_NEXT_REMOVEXATTR(handle, conv_smb_fname, aname); - if (ret == -1) { - saved_errno = errno; - } - TALLOC_FREE(conv_smb_fname); - TALLOC_FREE(conv); - if (saved_errno != 0) { - errno = saved_errno; - } - return ret; + return SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname, aname); } static int shadow_copy2_setxattr(struct vfs_handle_struct *handle, -- 2.47.3