mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
vfs: remove SMB_VFS_OPENDIR()
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Mar 24 21:23:43 UTC 2020 on sn-devel-184
This commit is contained in:
parent
54e0f25071
commit
2a5d994b1a
@ -122,14 +122,6 @@ static NTSTATUS skel_read_dfs_pathat(struct vfs_handle_struct *handle,
|
||||
return NT_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static DIR *skel_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
const char *service_path,
|
||||
@ -1059,7 +1051,6 @@ static struct vfs_fn_pointers skel_opaque_fns = {
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
.opendir_fn = skel_opendir,
|
||||
.fdopendir_fn = skel_fdopendir,
|
||||
.readdir_fn = skel_readdir,
|
||||
.seekdir_fn = skel_seekdir,
|
||||
|
@ -128,14 +128,6 @@ static NTSTATUS skel_read_dfs_pathat(struct vfs_handle_struct *handle,
|
||||
preferral_count);
|
||||
}
|
||||
|
||||
static DIR *skel_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
return SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
|
||||
}
|
||||
|
||||
static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
const char *service_path,
|
||||
@ -1366,7 +1358,6 @@ static struct vfs_fn_pointers skel_transparent_fns = {
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
.opendir_fn = skel_opendir,
|
||||
.fdopendir_fn = skel_fdopendir,
|
||||
.readdir_fn = skel_readdir,
|
||||
.seekdir_fn = skel_seekdir,
|
||||
|
@ -292,6 +292,7 @@
|
||||
/* Version 42 - Add SMB_VFS_READ_DFS_PATHAT() */
|
||||
/* Change to Version 43 - will ship with 4.13. */
|
||||
/* Version 43 - Remove deferred_close from struct files_struct */
|
||||
/* Version 43 - Remove SMB_VFS_OPENDIR() */
|
||||
|
||||
#define SMB_VFS_INTERFACE_VERSION 43
|
||||
|
||||
@ -719,10 +720,6 @@ struct vfs_fn_pointers {
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
DIR *(*opendir_fn)(struct vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attributes);
|
||||
DIR *(*fdopendir_fn)(struct vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32_t attributes);
|
||||
struct dirent *(*readdir_fn)(struct vfs_handle_struct *handle,
|
||||
DIR *dirp,
|
||||
@ -1230,10 +1227,6 @@ NTSTATUS smb_vfs_call_read_dfs_pathat(struct vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
struct referral **ppreflist,
|
||||
size_t *preferral_count);
|
||||
DIR *smb_vfs_call_opendir(struct vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attributes);
|
||||
DIR *smb_vfs_call_fdopendir(struct vfs_handle_struct *handle,
|
||||
struct files_struct *fsp,
|
||||
const char *mask,
|
||||
@ -1678,10 +1671,6 @@ NTSTATUS vfs_not_implemented_read_dfs_pathat(struct vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
struct referral **ppreflist,
|
||||
size_t *preferral_count);
|
||||
DIR *vfs_not_implemented_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr);
|
||||
NTSTATUS vfs_not_implemented_snap_check_path(struct vfs_handle_struct *handle,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
const char *service_path,
|
||||
|
@ -106,11 +106,6 @@
|
||||
(pcount))
|
||||
|
||||
/* Directory operations */
|
||||
#define SMB_VFS_OPENDIR(conn, smb_fname, mask, attr) \
|
||||
smb_vfs_call_opendir((conn)->vfs_handles, (smb_fname), (mask), (attr))
|
||||
#define SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr) \
|
||||
smb_vfs_call_opendir((handle)->next, (smb_fname), (mask), (attr))
|
||||
|
||||
#define SMB_VFS_FDOPENDIR(fsp, mask, attr) \
|
||||
smb_vfs_call_fdopendir((fsp)->conn->vfs_handles, (fsp), (mask), (attr))
|
||||
#define SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr) \
|
||||
|
@ -177,23 +177,6 @@ static void audit_disconnect(vfs_handle_struct *handle)
|
||||
return;
|
||||
}
|
||||
|
||||
static DIR *audit_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
DIR *result;
|
||||
|
||||
result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
|
||||
|
||||
syslog(audit_syslog_priority(handle), "opendir %s %s%s\n",
|
||||
smb_fname->base_name,
|
||||
(result == NULL) ? "failed: " : "",
|
||||
(result == NULL) ? strerror(errno) : "");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int audit_mkdirat(vfs_handle_struct *handle,
|
||||
struct files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
@ -321,7 +304,6 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mod
|
||||
static struct vfs_fn_pointers vfs_audit_fns = {
|
||||
.connect_fn = audit_connect,
|
||||
.disconnect_fn = audit_disconnect,
|
||||
.opendir_fn = audit_opendir,
|
||||
.mkdirat_fn = audit_mkdirat,
|
||||
.open_fn = audit_open,
|
||||
.close_fn = audit_close,
|
||||
|
@ -82,31 +82,6 @@ static int cap_get_quota(vfs_handle_struct *handle,
|
||||
return SMB_VFS_NEXT_GET_QUOTA(handle, cap_smb_fname, qtype, id, dq);
|
||||
}
|
||||
|
||||
static DIR *cap_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
char *capname = capencode(talloc_tos(), smb_fname->base_name);
|
||||
struct smb_filename *cap_smb_fname = NULL;
|
||||
|
||||
if (!capname) {
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
cap_smb_fname = synthetic_smb_fname(talloc_tos(),
|
||||
capname,
|
||||
NULL,
|
||||
NULL,
|
||||
smb_fname->flags);
|
||||
if (cap_smb_fname == NULL) {
|
||||
TALLOC_FREE(capname);
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
return SMB_VFS_NEXT_OPENDIR(handle, cap_smb_fname, mask, attr);
|
||||
}
|
||||
|
||||
static struct dirent *cap_readdir(vfs_handle_struct *handle,
|
||||
DIR *dirp,
|
||||
SMB_STRUCT_STAT *sbuf)
|
||||
@ -1046,7 +1021,6 @@ static NTSTATUS cap_read_dfs_pathat(struct vfs_handle_struct *handle,
|
||||
static struct vfs_fn_pointers vfs_cap_fns = {
|
||||
.disk_free_fn = cap_disk_free,
|
||||
.get_quota_fn = cap_get_quota,
|
||||
.opendir_fn = cap_opendir,
|
||||
.readdir_fn = cap_readdir,
|
||||
.mkdirat_fn = cap_mkdirat,
|
||||
.open_fn = cap_open,
|
||||
|
@ -171,44 +171,6 @@ static int catia_connect(struct vfs_handle_struct *handle,
|
||||
return SMB_VFS_NEXT_CONNECT(handle, service, user);
|
||||
}
|
||||
|
||||
static DIR *catia_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
char *name_mapped = NULL;
|
||||
NTSTATUS status;
|
||||
DIR *ret;
|
||||
struct smb_filename *mapped_smb_fname = NULL;
|
||||
|
||||
status = catia_string_replace_allocate(handle->conn,
|
||||
smb_fname->base_name,
|
||||
&name_mapped,
|
||||
vfs_translate_to_unix);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
errno = map_errno_from_nt_status(status);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
|
||||
name_mapped,
|
||||
NULL,
|
||||
&smb_fname->st,
|
||||
smb_fname->flags);
|
||||
if (mapped_smb_fname == NULL) {
|
||||
TALLOC_FREE(mapped_smb_fname);
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = SMB_VFS_NEXT_OPENDIR(handle, mapped_smb_fname, mask, attr);
|
||||
|
||||
TALLOC_FREE(name_mapped);
|
||||
TALLOC_FREE(mapped_smb_fname);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* TRANSLATE_NAME call which converts the given name to
|
||||
* "WINDOWS displayable" name
|
||||
@ -2450,7 +2412,6 @@ static struct vfs_fn_pointers vfs_catia_fns = {
|
||||
|
||||
/* Directory operations */
|
||||
.mkdirat_fn = catia_mkdirat,
|
||||
.opendir_fn = catia_opendir,
|
||||
.readdir_attr_fn = catia_readdir_attr,
|
||||
|
||||
/* File operations */
|
||||
|
@ -301,25 +301,6 @@ static uint32_t cephwrap_fs_capabilities(struct vfs_handle_struct *handle,
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
static DIR *cephwrap_opendir(struct vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask, uint32_t attr)
|
||||
{
|
||||
int ret = 0;
|
||||
struct ceph_dir_result *result;
|
||||
DBG_DEBUG("[CEPH] opendir(%p, %s)\n", handle, smb_fname->base_name);
|
||||
|
||||
/* Returns NULL if it does not exist or there are problems ? */
|
||||
ret = ceph_opendir(handle->data, smb_fname->base_name, &result);
|
||||
if (ret < 0) {
|
||||
result = NULL;
|
||||
errno = -ret; /* We return result which is NULL in this case */
|
||||
}
|
||||
|
||||
DBG_DEBUG("[CEPH] opendir(...) = %d\n", ret);
|
||||
return (DIR *) result;
|
||||
}
|
||||
|
||||
static DIR *cephwrap_fdopendir(struct vfs_handle_struct *handle,
|
||||
struct files_struct *fsp,
|
||||
const char *mask,
|
||||
@ -1443,7 +1424,6 @@ static struct vfs_fn_pointers ceph_fns = {
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
.opendir_fn = cephwrap_opendir,
|
||||
.fdopendir_fn = cephwrap_fdopendir,
|
||||
.readdir_fn = cephwrap_readdir,
|
||||
.seekdir_fn = cephwrap_seekdir,
|
||||
|
@ -720,53 +720,6 @@ static int ceph_snap_gmt_convert(struct vfs_handle_struct *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DIR *ceph_snap_gmt_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *csmb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
time_t timestamp = 0;
|
||||
char stripped[PATH_MAX + 1];
|
||||
int ret;
|
||||
DIR *dir;
|
||||
int saved_errno;
|
||||
struct smb_filename *conv_smb_fname = NULL;
|
||||
char conv[PATH_MAX + 1];
|
||||
|
||||
ret = ceph_snap_gmt_strip_snapshot(handle,
|
||||
csmb_fname->base_name,
|
||||
×tamp,
|
||||
stripped, sizeof(stripped));
|
||||
if (ret < 0) {
|
||||
errno = -ret;
|
||||
return NULL;
|
||||
}
|
||||
if (timestamp == 0) {
|
||||
return SMB_VFS_NEXT_OPENDIR(handle, csmb_fname, mask, attr);
|
||||
}
|
||||
ret = ceph_snap_gmt_convert_dir(handle, stripped,
|
||||
timestamp, conv, sizeof(conv));
|
||||
if (ret < 0) {
|
||||
errno = -ret;
|
||||
return NULL;
|
||||
}
|
||||
conv_smb_fname = synthetic_smb_fname(talloc_tos(),
|
||||
conv,
|
||||
NULL,
|
||||
NULL,
|
||||
csmb_fname->flags);
|
||||
if (conv_smb_fname == NULL) {
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dir = SMB_VFS_NEXT_OPENDIR(handle, conv_smb_fname, mask, attr);
|
||||
saved_errno = errno;
|
||||
TALLOC_FREE(conv_smb_fname);
|
||||
errno = saved_errno;
|
||||
return dir;
|
||||
}
|
||||
|
||||
static int ceph_snap_gmt_renameat(vfs_handle_struct *handle,
|
||||
files_struct *srcfsp,
|
||||
const struct smb_filename *smb_fname_src,
|
||||
@ -1601,7 +1554,6 @@ static int ceph_snap_gmt_get_quota(vfs_handle_struct *handle,
|
||||
|
||||
static struct vfs_fn_pointers ceph_snap_fns = {
|
||||
.get_shadow_copy_data_fn = ceph_snap_get_shadow_copy_data,
|
||||
.opendir_fn = ceph_snap_gmt_opendir,
|
||||
.disk_free_fn = ceph_snap_gmt_disk_free,
|
||||
.get_quota_fn = ceph_snap_gmt_get_quota,
|
||||
.renameat_fn = ceph_snap_gmt_renameat,
|
||||
|
@ -535,19 +535,6 @@ static NTSTATUS vfswrap_snap_delete(struct vfs_handle_struct *handle,
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
static DIR *vfswrap_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
DIR *result;
|
||||
|
||||
START_PROFILE(syscall_opendir);
|
||||
result = opendir(smb_fname->base_name);
|
||||
END_PROFILE(syscall_opendir);
|
||||
return result;
|
||||
}
|
||||
|
||||
static DIR *vfswrap_fdopendir(vfs_handle_struct *handle,
|
||||
files_struct *fsp,
|
||||
const char *mask,
|
||||
@ -3653,7 +3640,6 @@ static struct vfs_fn_pointers vfs_default_fns = {
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
.opendir_fn = vfswrap_opendir,
|
||||
.fdopendir_fn = vfswrap_fdopendir,
|
||||
.readdir_fn = vfswrap_readdir,
|
||||
.readdir_attr_fn = vfswrap_readdir_attr,
|
||||
|
@ -130,67 +130,6 @@ static bool open_and_sort_dir(vfs_handle_struct *handle,
|
||||
return true;
|
||||
}
|
||||
|
||||
static DIR *dirsort_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
struct dirsort_privates *list_head = NULL;
|
||||
struct dirsort_privates *data = NULL;
|
||||
|
||||
if (SMB_VFS_HANDLE_TEST_DATA(handle)) {
|
||||
/* Find the list head of all open directories. */
|
||||
SMB_VFS_HANDLE_GET_DATA(handle, list_head, struct dirsort_privates,
|
||||
return NULL);
|
||||
}
|
||||
|
||||
/* set up our private data about this directory */
|
||||
data = talloc_zero(handle->conn, struct dirsort_privates);
|
||||
if (!data) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data->smb_fname = cp_smb_filename(data, smb_fname);
|
||||
if (data->smb_fname == NULL) {
|
||||
TALLOC_FREE(data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ISDOT(data->smb_fname->base_name)) {
|
||||
struct smb_filename *cwd_fname = vfs_GetWd(data, handle->conn);
|
||||
if (cwd_fname == NULL) {
|
||||
TALLOC_FREE(data);
|
||||
return NULL;
|
||||
}
|
||||
TALLOC_FREE(data->smb_fname->base_name);
|
||||
data->smb_fname->base_name = talloc_move(data->smb_fname,
|
||||
&cwd_fname->base_name);
|
||||
TALLOC_FREE(cwd_fname);
|
||||
}
|
||||
|
||||
/* Open the underlying directory and count the number of entries */
|
||||
data->source_directory = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask,
|
||||
attr);
|
||||
|
||||
if (data->source_directory == NULL) {
|
||||
TALLOC_FREE(data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!open_and_sort_dir(handle, data)) {
|
||||
SMB_VFS_NEXT_CLOSEDIR(handle,data->source_directory);
|
||||
TALLOC_FREE(data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Add to the private list of all open directories. */
|
||||
DLIST_ADD(list_head, data);
|
||||
SMB_VFS_HANDLE_SET_DATA(handle, list_head, NULL,
|
||||
struct dirsort_privates, return NULL);
|
||||
|
||||
return data->source_directory;
|
||||
}
|
||||
|
||||
static DIR *dirsort_fdopendir(vfs_handle_struct *handle,
|
||||
files_struct *fsp,
|
||||
const char *mask,
|
||||
@ -380,7 +319,6 @@ static int dirsort_closedir(vfs_handle_struct *handle, DIR *dirp)
|
||||
}
|
||||
|
||||
static struct vfs_fn_pointers vfs_dirsort_fns = {
|
||||
.opendir_fn = dirsort_opendir,
|
||||
.fdopendir_fn = dirsort_fdopendir,
|
||||
.readdir_fn = dirsort_readdir,
|
||||
.seekdir_fn = dirsort_seekdir,
|
||||
|
@ -187,29 +187,6 @@ static void audit_disconnect(vfs_handle_struct *handle)
|
||||
return;
|
||||
}
|
||||
|
||||
static DIR *audit_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
DIR *result;
|
||||
|
||||
result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
|
||||
|
||||
if (lp_syslog() > 0) {
|
||||
syslog(audit_syslog_priority(handle), "opendir %s %s%s\n",
|
||||
smb_fname->base_name,
|
||||
(result == NULL) ? "failed: " : "",
|
||||
(result == NULL) ? strerror(errno) : "");
|
||||
}
|
||||
DEBUG(1, ("vfs_extd_audit: opendir %s %s %s\n",
|
||||
smb_fname->base_name,
|
||||
(result == NULL) ? "failed: " : "",
|
||||
(result == NULL) ? strerror(errno) : ""));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int audit_mkdirat(vfs_handle_struct *handle,
|
||||
struct files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
@ -380,7 +357,6 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mod
|
||||
static struct vfs_fn_pointers vfs_extd_audit_fns = {
|
||||
.connect_fn = audit_connect,
|
||||
.disconnect_fn = audit_disconnect,
|
||||
.opendir_fn = audit_opendir,
|
||||
.mkdirat_fn = audit_mkdirat,
|
||||
.open_fn = audit_open,
|
||||
.close_fn = audit_close,
|
||||
|
@ -106,7 +106,6 @@ typedef enum _vfs_op_type {
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
SMB_VFS_OP_OPENDIR,
|
||||
SMB_VFS_OP_FDOPENDIR,
|
||||
SMB_VFS_OP_READDIR,
|
||||
SMB_VFS_OP_SEEKDIR,
|
||||
@ -253,7 +252,6 @@ static struct {
|
||||
{ SMB_VFS_OP_GET_DFS_REFERRALS, "get_dfs_referrals" },
|
||||
{ SMB_VFS_OP_CREATE_DFS_PATHAT, "create_dfs_pathat" },
|
||||
{ SMB_VFS_OP_READ_DFS_PATHAT, "read_dfs_pathat" },
|
||||
{ SMB_VFS_OP_OPENDIR, "opendir" },
|
||||
{ SMB_VFS_OP_FDOPENDIR, "fdopendir" },
|
||||
{ SMB_VFS_OP_READDIR, "readdir" },
|
||||
{ SMB_VFS_OP_SEEKDIR, "seekdir" },
|
||||
@ -988,24 +986,6 @@ static NTSTATUS smb_full_audit_snap_delete(struct vfs_handle_struct *handle,
|
||||
return status;
|
||||
}
|
||||
|
||||
static DIR *smb_full_audit_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
DIR *result;
|
||||
|
||||
result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
|
||||
|
||||
do_log(SMB_VFS_OP_OPENDIR,
|
||||
(result != NULL),
|
||||
handle,
|
||||
"%s",
|
||||
smb_fname_str_do_log(handle->conn, smb_fname));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static DIR *smb_full_audit_fdopendir(vfs_handle_struct *handle,
|
||||
files_struct *fsp, const char *mask, uint32_t attr)
|
||||
{
|
||||
@ -2989,7 +2969,6 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
|
||||
.get_dfs_referrals_fn = smb_full_audit_get_dfs_referrals,
|
||||
.create_dfs_pathat_fn = smb_full_audit_create_dfs_pathat,
|
||||
.read_dfs_pathat_fn = smb_full_audit_read_dfs_pathat,
|
||||
.opendir_fn = smb_full_audit_opendir,
|
||||
.fdopendir_fn = smb_full_audit_fdopendir,
|
||||
.readdir_fn = smb_full_audit_readdir,
|
||||
.seekdir_fn = smb_full_audit_seekdir,
|
||||
|
@ -491,26 +491,6 @@ static uint32_t vfs_gluster_fs_capabilities(struct vfs_handle_struct *handle,
|
||||
return caps;
|
||||
}
|
||||
|
||||
static DIR *vfs_gluster_opendir(struct vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attributes)
|
||||
{
|
||||
glfs_fd_t *fd;
|
||||
|
||||
START_PROFILE(syscall_opendir);
|
||||
|
||||
fd = glfs_opendir(handle->data, smb_fname->base_name);
|
||||
if (fd == NULL) {
|
||||
DEBUG(0, ("glfs_opendir(%s) failed: %s\n",
|
||||
smb_fname->base_name, strerror(errno)));
|
||||
}
|
||||
|
||||
END_PROFILE(syscall_opendir);
|
||||
|
||||
return (DIR *) fd;
|
||||
}
|
||||
|
||||
static glfs_fd_t *vfs_gluster_fetch_glfd(struct vfs_handle_struct *handle,
|
||||
files_struct *fsp)
|
||||
{
|
||||
@ -2046,7 +2026,6 @@ static struct vfs_fn_pointers glusterfs_fns = {
|
||||
|
||||
/* Directory Operations */
|
||||
|
||||
.opendir_fn = vfs_gluster_opendir,
|
||||
.fdopendir_fn = vfs_gluster_fdopendir,
|
||||
.readdir_fn = vfs_gluster_readdir,
|
||||
.seekdir_fn = vfs_gluster_seekdir,
|
||||
|
@ -755,62 +755,6 @@ err:
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Success: return a mh_dirinfo_struct cast as a DIR
|
||||
* Failure: set errno, return NULL
|
||||
*/
|
||||
static DIR *mh_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
struct mh_dirinfo_struct *dirInfo;
|
||||
|
||||
DEBUG(MH_INFO_DEBUG, ("Entering with fname '%s'\n",
|
||||
smb_fname->base_name));
|
||||
|
||||
if (alloc_set_client_dirinfo(handle, smb_fname->base_name, &dirInfo))
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!dirInfo->isInMediaFiles)
|
||||
{
|
||||
dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(handle,
|
||||
smb_fname, mask, attr);
|
||||
} else {
|
||||
struct smb_filename *smb_fname_clientpath =
|
||||
synthetic_smb_fname(talloc_tos(),
|
||||
dirInfo->clientPath,
|
||||
NULL,
|
||||
NULL,
|
||||
smb_fname->flags);
|
||||
if (smb_fname_clientpath == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(handle,
|
||||
smb_fname_clientpath, mask, attr);
|
||||
TALLOC_FREE(smb_fname_clientpath);
|
||||
}
|
||||
|
||||
if (dirInfo->dirstream == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Success is freed in closedir. */
|
||||
DEBUG(MH_INFO_DEBUG, ("Leaving with dirInfo->dirpath '%s', "
|
||||
"dirInfo->clientPath '%s'\n",
|
||||
dirInfo->dirpath,
|
||||
dirInfo->clientPath));
|
||||
return (DIR*)dirInfo;
|
||||
err:
|
||||
/* Failure is freed here. */
|
||||
DEBUG(MH_ERR_DEBUG, ("Failing with fname '%s'\n",
|
||||
smb_fname->base_name));
|
||||
TALLOC_FREE(dirInfo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static DIR *mh_fdopendir(vfs_handle_struct *handle,
|
||||
files_struct *fsp,
|
||||
const char *mask,
|
||||
@ -2253,7 +2197,6 @@ static struct vfs_fn_pointers vfs_mh_fns = {
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
.opendir_fn = mh_opendir,
|
||||
.fdopendir_fn = mh_fdopendir,
|
||||
.readdir_fn = mh_readdir,
|
||||
.seekdir_fn = mh_seekdir,
|
||||
|
@ -116,14 +116,6 @@ NTSTATUS vfs_not_implemented_read_dfs_pathat(struct vfs_handle_struct *handle,
|
||||
return NT_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
DIR *vfs_not_implemented_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NTSTATUS vfs_not_implemented_snap_check_path(struct vfs_handle_struct *handle,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
const char *service_path,
|
||||
@ -1064,7 +1056,6 @@ static struct vfs_fn_pointers vfs_not_implemented_fns = {
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
.opendir_fn = vfs_not_implemented_opendir,
|
||||
.fdopendir_fn = vfs_not_implemented_fdopendir,
|
||||
.readdir_fn = vfs_not_implemented_readdir,
|
||||
.seekdir_fn = vfs_not_implemented_seekdir,
|
||||
|
@ -73,58 +73,6 @@ static bool shadow_copy_match_name(const char *name)
|
||||
return False;
|
||||
}
|
||||
|
||||
static DIR *shadow_copy_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
shadow_copy_Dir *dirp;
|
||||
DIR *p = SMB_VFS_NEXT_OPENDIR(handle,smb_fname,mask,attr);
|
||||
|
||||
if (!p) {
|
||||
DEBUG(0,("shadow_copy_opendir: SMB_VFS_NEXT_OPENDIR() "
|
||||
"failed for [%s]\n",
|
||||
smb_fname->base_name));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dirp = SMB_MALLOC_P(shadow_copy_Dir);
|
||||
if (!dirp) {
|
||||
DEBUG(0,("shadow_copy_opendir: Out of memory\n"));
|
||||
SMB_VFS_NEXT_CLOSEDIR(handle,p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ZERO_STRUCTP(dirp);
|
||||
|
||||
while (True) {
|
||||
struct dirent *d;
|
||||
|
||||
d = SMB_VFS_NEXT_READDIR(handle, p, NULL);
|
||||
if (d == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (shadow_copy_match_name(d->d_name)) {
|
||||
DEBUG(8,("shadow_copy_opendir: hide [%s]\n",d->d_name));
|
||||
continue;
|
||||
}
|
||||
|
||||
DEBUG(10,("shadow_copy_opendir: not hide [%s]\n",d->d_name));
|
||||
|
||||
dirp->dirs = SMB_REALLOC_ARRAY(dirp->dirs,struct dirent, dirp->num+1);
|
||||
if (!dirp->dirs) {
|
||||
DEBUG(0,("shadow_copy_opendir: Out of memory\n"));
|
||||
break;
|
||||
}
|
||||
|
||||
dirp->dirs[dirp->num++] = *d;
|
||||
}
|
||||
|
||||
SMB_VFS_NEXT_CLOSEDIR(handle,p);
|
||||
return((DIR *)dirp);
|
||||
}
|
||||
|
||||
static DIR *shadow_copy_fdopendir(vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32_t attr)
|
||||
{
|
||||
shadow_copy_Dir *dirp;
|
||||
@ -304,7 +252,6 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static struct vfs_fn_pointers vfs_shadow_copy_fns = {
|
||||
.opendir_fn = shadow_copy_opendir,
|
||||
.fdopendir_fn = shadow_copy_fdopendir,
|
||||
.readdir_fn = shadow_copy_readdir,
|
||||
.seekdir_fn = shadow_copy_seekdir,
|
||||
|
@ -1087,54 +1087,6 @@ static void convert_sbuf(vfs_handle_struct *handle, const char *fname,
|
||||
}
|
||||
}
|
||||
|
||||
static DIR *shadow_copy2_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
time_t timestamp = 0;
|
||||
char *stripped = NULL;
|
||||
DIR *ret;
|
||||
int saved_errno = 0;
|
||||
char *conv;
|
||||
struct smb_filename *conv_smb_fname = NULL;
|
||||
|
||||
if (!shadow_copy2_strip_snapshot(talloc_tos(),
|
||||
handle,
|
||||
smb_fname->base_name,
|
||||
×tamp,
|
||||
&stripped)) {
|
||||
return NULL;
|
||||
}
|
||||
if (timestamp == 0) {
|
||||
return SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
|
||||
}
|
||||
conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
|
||||
TALLOC_FREE(stripped);
|
||||
if (conv == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
conv_smb_fname = synthetic_smb_fname(talloc_tos(),
|
||||
conv,
|
||||
NULL,
|
||||
NULL,
|
||||
smb_fname->flags);
|
||||
if (conv_smb_fname == NULL) {
|
||||
TALLOC_FREE(conv);
|
||||
return NULL;
|
||||
}
|
||||
ret = SMB_VFS_NEXT_OPENDIR(handle, conv_smb_fname, mask, attr);
|
||||
if (ret == NULL) {
|
||||
saved_errno = errno;
|
||||
}
|
||||
TALLOC_FREE(conv);
|
||||
TALLOC_FREE(conv_smb_fname);
|
||||
if (saved_errno != 0) {
|
||||
errno = saved_errno;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int shadow_copy2_renameat(vfs_handle_struct *handle,
|
||||
files_struct *srcfsp,
|
||||
const struct smb_filename *smb_fname_src,
|
||||
@ -3233,7 +3185,6 @@ static int shadow_copy2_connect(struct vfs_handle_struct *handle,
|
||||
|
||||
static struct vfs_fn_pointers vfs_shadow_copy2_fns = {
|
||||
.connect_fn = shadow_copy2_connect,
|
||||
.opendir_fn = shadow_copy2_opendir,
|
||||
.disk_free_fn = shadow_copy2_disk_free,
|
||||
.get_quota_fn = shadow_copy2_get_quota,
|
||||
.create_dfs_pathat_fn = shadow_copy2_create_dfs_pathat,
|
||||
|
@ -1963,52 +1963,6 @@ err_out:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static DIR *snapper_gmt_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
time_t timestamp;
|
||||
char *stripped;
|
||||
DIR *ret;
|
||||
int saved_errno;
|
||||
char *conv;
|
||||
struct smb_filename *conv_smb_fname = NULL;
|
||||
|
||||
if (!snapper_gmt_strip_snapshot(talloc_tos(),
|
||||
handle,
|
||||
smb_fname->base_name,
|
||||
×tamp,
|
||||
&stripped)) {
|
||||
return NULL;
|
||||
}
|
||||
if (timestamp == 0) {
|
||||
return SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
|
||||
}
|
||||
conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
|
||||
TALLOC_FREE(stripped);
|
||||
if (conv == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
conv_smb_fname = synthetic_smb_fname(talloc_tos(),
|
||||
conv,
|
||||
NULL,
|
||||
NULL,
|
||||
smb_fname->flags);
|
||||
if (conv_smb_fname == NULL) {
|
||||
TALLOC_FREE(conv);
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = SMB_VFS_NEXT_OPENDIR(handle, conv_smb_fname, mask, attr);
|
||||
saved_errno = errno;
|
||||
TALLOC_FREE(conv);
|
||||
TALLOC_FREE(conv_smb_fname);
|
||||
errno = saved_errno;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int snapper_gmt_renameat(vfs_handle_struct *handle,
|
||||
files_struct *srcfsp,
|
||||
const struct smb_filename *smb_fname_src,
|
||||
@ -2880,7 +2834,6 @@ static struct vfs_fn_pointers snapper_fns = {
|
||||
.snap_delete_fn = snapper_snap_delete,
|
||||
.get_shadow_copy_data_fn = snapper_get_shadow_copy_data,
|
||||
.create_dfs_pathat_fn = snapper_create_dfs_pathat,
|
||||
.opendir_fn = snapper_gmt_opendir,
|
||||
.disk_free_fn = snapper_gmt_disk_free,
|
||||
.get_quota_fn = snapper_gmt_get_quota,
|
||||
.renameat_fn = snapper_gmt_renameat,
|
||||
|
@ -446,26 +446,6 @@ static NTSTATUS smb_time_audit_snap_delete(struct vfs_handle_struct *handle,
|
||||
return status;
|
||||
}
|
||||
|
||||
static DIR *smb_time_audit_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask, uint32_t attr)
|
||||
{
|
||||
DIR *result;
|
||||
struct timespec ts1,ts2;
|
||||
double timediff;
|
||||
|
||||
clock_gettime_mono(&ts1);
|
||||
result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
|
||||
clock_gettime_mono(&ts2);
|
||||
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
|
||||
|
||||
if (timediff > audit_timeout) {
|
||||
smb_time_audit_log_smb_fname("opendir", timediff, smb_fname);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static DIR *smb_time_audit_fdopendir(vfs_handle_struct *handle,
|
||||
files_struct *fsp,
|
||||
const char *mask, uint32_t attr)
|
||||
@ -2863,7 +2843,6 @@ static struct vfs_fn_pointers vfs_time_audit_fns = {
|
||||
.get_dfs_referrals_fn = smb_time_audit_get_dfs_referrals,
|
||||
.create_dfs_pathat_fn = smb_time_audit_create_dfs_pathat,
|
||||
.read_dfs_pathat_fn = smb_time_audit_read_dfs_pathat,
|
||||
.opendir_fn = smb_time_audit_opendir,
|
||||
.fdopendir_fn = smb_time_audit_fdopendir,
|
||||
.readdir_fn = smb_time_audit_readdir,
|
||||
.seekdir_fn = smb_time_audit_seekdir,
|
||||
|
@ -556,58 +556,6 @@ err:
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Success: return a um_dirinfo_struct cast as a DIR
|
||||
* Failure: set errno, return NULL
|
||||
*/
|
||||
static DIR *um_opendir(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attr)
|
||||
{
|
||||
struct um_dirinfo_struct *dirInfo;
|
||||
|
||||
DEBUG(10, ("Entering with fname '%s'\n", smb_fname->base_name));
|
||||
|
||||
if (alloc_set_client_dirinfo(handle, smb_fname->base_name, &dirInfo)) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!dirInfo->isInMediaFiles) {
|
||||
dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(
|
||||
handle, smb_fname, mask, attr);
|
||||
} else {
|
||||
struct smb_filename *client_smb_fname =
|
||||
synthetic_smb_fname(talloc_tos(),
|
||||
dirInfo->clientPath,
|
||||
NULL,
|
||||
NULL,
|
||||
smb_fname->flags);
|
||||
if (client_smb_fname == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(
|
||||
handle, client_smb_fname, mask, attr);
|
||||
|
||||
TALLOC_FREE(client_smb_fname);
|
||||
}
|
||||
|
||||
if (dirInfo->dirstream == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
DEBUG(10, ("Leaving with dirInfo->dirpath '%s', "
|
||||
"dirInfo->clientPath '%s'\n",
|
||||
dirInfo->dirpath,
|
||||
dirInfo->clientPath));
|
||||
return (DIR*)dirInfo;
|
||||
|
||||
err:
|
||||
DEBUG(1, ("Failing with fname '%s'\n", smb_fname->base_name));
|
||||
TALLOC_FREE(dirInfo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static DIR *um_fdopendir(vfs_handle_struct *handle,
|
||||
files_struct *fsp,
|
||||
const char *mask,
|
||||
@ -1868,7 +1816,6 @@ static struct vfs_fn_pointers vfs_um_fns = {
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
.opendir_fn = um_opendir,
|
||||
.fdopendir_fn = um_fdopendir,
|
||||
.readdir_fn = um_readdir,
|
||||
.seekdir_fn = um_seekdir,
|
||||
|
@ -1593,15 +1593,6 @@ NTSTATUS smb_vfs_call_read_dfs_pathat(struct vfs_handle_struct *handle,
|
||||
preferral_count);
|
||||
}
|
||||
|
||||
DIR *smb_vfs_call_opendir(struct vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
const char *mask,
|
||||
uint32_t attributes)
|
||||
{
|
||||
VFS_FIND(opendir);
|
||||
return handle->fns->opendir_fn(handle, smb_fname, mask, attributes);
|
||||
}
|
||||
|
||||
DIR *smb_vfs_call_fdopendir(struct vfs_handle_struct *handle,
|
||||
struct files_struct *fsp,
|
||||
const char *mask,
|
||||
|
Loading…
Reference in New Issue
Block a user