[PATCH] vfs: propagate snapshot enumeration permissions errors
David Disseldorp
ddiss at samba.org
Wed Feb 26 16:06:58 MST 2014
The current FSCTL_GET_SHADOW_COPY_DATA/FSCTL_SRV_ENUMERATE_SNAPSHOTS
handler squashes all non-ENOSYS errors into an NT_STATUS_UNSUCCESSFUL
response.
This commit ensures that permissions errors are propagated up to the
client as NT_STATUS_ACCESS_DENIED, to aid debugging.
The Windows Explorer "Previous Versions" dialogue doesn't appear to
distinguish between error codes. It displays "There are no previous
versions available" in both cases.
Signed-off-by: David Disseldorp <ddiss at samba.org>
---
source3/modules/vfs_default.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 0b7de27..77b1bed 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1078,12 +1078,12 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
{
const char *in_data = (const char *)_in_data;
char **out_data = (char **)_out_data;
+ NTSTATUS status;
switch (function) {
case FSCTL_SET_SPARSE:
{
bool set_sparse = true;
- NTSTATUS status;
if (in_len >= 1 && in_data[0] == 0) {
set_sparse = false;
@@ -1182,16 +1182,21 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
* Call the VFS routine to actually do the work.
*/
if (SMB_VFS_GET_SHADOW_COPY_DATA(fsp, shadow_data, labels)!=0) {
- TALLOC_FREE(shadow_data);
+ int log_lev = 0;
if (errno == ENOSYS) {
- DEBUG(5,("FSCTL_GET_SHADOW_COPY_DATA: connectpath %s, not supported.\n",
- fsp->conn->connectpath));
- return NT_STATUS_NOT_SUPPORTED;
+ log_lev = 5;
+ status = NT_STATUS_NOT_SUPPORTED;
+ } else if ((errno == EPERM) || (errno == EACCES)) {
+ status = NT_STATUS_ACCESS_DENIED;
} else {
- DEBUG(0,("FSCTL_GET_SHADOW_COPY_DATA: connectpath %s, failed.\n",
- fsp->conn->connectpath));
- return NT_STATUS_UNSUCCESSFUL;
+ status = NT_STATUS_UNSUCCESSFUL;
}
+ DEBUG(log_lev, ("FSCTL_GET_SHADOW_COPY_DATA: "
+ "connectpath %s, failed - %s.\n",
+ fsp->conn->connectpath,
+ nt_errstr(status)));
+ TALLOC_FREE(shadow_data);
+ return status;
}
labels_data_count = (shadow_data->num_volumes * 2 *
@@ -1319,7 +1324,6 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
* and SEEK_DATA/SEEK_HOLE on Solaris is needed to make
* this FSCTL correct for sparse files.
*/
- NTSTATUS status;
uint64_t offset, length;
char *out_data_tmp = NULL;
--
1.8.4.5
More information about the samba-technical
mailing list