return NULL;
}
+#if 0
static bool check_access_snapdir(struct vfs_handle_struct *handle,
const char *path)
{
TALLOC_FREE(smb_fname.base_name);
return true;
}
+#endif
/**
* Find the snapshot directory (if any) for the given
struct shadow_copy2_private *priv = NULL;
struct shadow_copy2_snapentry *tmpentry = NULL;
bool get_snaplist = false;
- bool access_granted = false;
int open_flags = O_RDONLY;
int fd;
int ret = -1;
goto done;
}
- access_granted = check_access_snapdir(handle, snapdir);
- if (!access_granted) {
- DEBUG(0,("access denied on listing snapdir %s\n", snapdir));
- errno = EACCES;
- goto done;
- }
-
snapdir_smb_fname = synthetic_smb_fname(talloc_tos(),
snapdir,
NULL,
}
fsp_set_fd(dirfsp, fd);
+ /* Now we have the handle, check access here. */
+ status = smbd_check_access_rights_fsp(dirfsp,
+ false,
+ SEC_DIR_LIST);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_ERR("user does not have list permission "
+ "on snapdir %s\n",
+ fsp_str_dbg(dirfsp));
+ errno = EACCES;
+ goto done;
+ }
+
p = SMB_VFS_NEXT_FDOPENDIR(handle, dirfsp, NULL, 0);
if (!p) {
DBG_NOTICE("shadow_copy2: SMB_VFS_NEXT_FDOPENDIR() failed for '%s'"