mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
s3: VFS: vfs_snapper: 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 <jra@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
This commit is contained in:
parent
2022338b7f
commit
5d79171853
@ -2551,43 +2551,16 @@ static int snapper_gmt_chflags(vfs_handle_struct *handle,
|
||||
unsigned int flags)
|
||||
{
|
||||
time_t timestamp = 0;
|
||||
char *stripped = NULL;
|
||||
int ret = -1;
|
||||
int saved_errno = 0;
|
||||
char *conv = NULL;
|
||||
struct smb_filename *conv_smb_fname = NULL;
|
||||
|
||||
if (!snapper_gmt_strip_snapshot(talloc_tos(), handle,
|
||||
smb_fname->base_name, ×tamp, &stripped)) {
|
||||
smb_fname->base_name, ×tamp, NULL)) {
|
||||
return -1;
|
||||
}
|
||||
if (timestamp == 0) {
|
||||
return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
|
||||
}
|
||||
conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
|
||||
TALLOC_FREE(stripped);
|
||||
if (conv == NULL) {
|
||||
if (timestamp != 0) {
|
||||
errno = EROFS;
|
||||
return -1;
|
||||
}
|
||||
conv_smb_fname = synthetic_smb_fname(talloc_tos(),
|
||||
conv,
|
||||
NULL,
|
||||
NULL,
|
||||
smb_fname->flags);
|
||||
TALLOC_FREE(conv);
|
||||
if (conv_smb_fname == NULL) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
ret = SMB_VFS_NEXT_CHFLAGS(handle, conv_smb_fname, flags);
|
||||
if (ret == -1) {
|
||||
saved_errno = errno;
|
||||
}
|
||||
TALLOC_FREE(conv_smb_fname);
|
||||
if (saved_errno != 0) {
|
||||
errno = saved_errno;
|
||||
}
|
||||
return ret;
|
||||
return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
|
||||
}
|
||||
|
||||
static ssize_t snapper_gmt_getxattr(vfs_handle_struct *handle,
|
||||
|
Loading…
Reference in New Issue
Block a user