<member>close</member>
<member>closedir</member>
<member>connect</member>
- <member>connectpath</member>
<member>create_dfs_pathat</member>
<member>create_file</member>
<member>disconnect</member>
return NT_STATUS_NOT_IMPLEMENTED;
}
-static const char *skel_connectpath(
- struct vfs_handle_struct *handle,
- const struct files_struct *dirfsp,
- const struct smb_filename *smb_fname)
-{
- errno = ENOSYS;
- return NULL;
-}
-
static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
struct lock_struct *plock)
.fstreaminfo_fn = skel_fstreaminfo,
.get_real_filename_at_fn = skel_get_real_filename_at,
- .connectpath_fn = skel_connectpath,
.brl_lock_windows_fn = skel_brl_lock_windows,
.brl_unlock_windows_fn = skel_brl_unlock_windows,
.strict_lock_check_fn = skel_strict_lock_check,
handle, dirfsp, name, mem_ctx, found_name);
}
-static const char *skel_connectpath(
- struct vfs_handle_struct *handle,
- const struct files_struct *dirfsp,
- const struct smb_filename *smb_fname)
-{
- return SMB_VFS_NEXT_CONNECTPATH(handle, dirfsp, smb_fname);
-}
-
static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
struct lock_struct *plock)
.fstreaminfo_fn = skel_fstreaminfo,
.get_real_filename_at_fn = skel_get_real_filename_at,
- .connectpath_fn = skel_connectpath,
.brl_lock_windows_fn = skel_brl_lock_windows,
.brl_unlock_windows_fn = skel_brl_unlock_windows,
.strict_lock_check_fn = skel_strict_lock_check,
* Version 51 - Add ntcreatex_deny_[dos|fcb] and ntcreatex_stream_baseopen
* Change to Version 52 - will ship with 4.24
* Version 52 - Add rename_stream
+ * Version 52 - Remove connectpath
*/
#define SMB_VFS_INTERFACE_VERSION 51
TALLOC_CTX *mem_ctx,
char **found_name);
- const char *(*connectpath_fn)(struct vfs_handle_struct *handle,
- const struct files_struct *dirfsp,
- const struct smb_filename *smb_fname);
-
NTSTATUS (*brl_lock_windows_fn)(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
struct lock_struct *plock);
const char *name,
TALLOC_CTX *mem_ctx,
char **found_name);
-const char *smb_vfs_call_connectpath(struct vfs_handle_struct *handle,
- const struct files_struct *dirfsp,
- const struct smb_filename *smb_fname);
NTSTATUS smb_vfs_call_brl_lock_windows(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
struct lock_struct *plock);
const char *name,
TALLOC_CTX *mem_ctx,
char **found_name);
-const char *vfs_not_implemented_connectpath(
- struct vfs_handle_struct *handle,
- const struct files_struct *dirfsp,
- const struct smb_filename *smb_fname);
NTSTATUS vfs_not_implemented_brl_lock_windows(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
struct lock_struct *plock);
(mem_ctx), \
(found_name))
-#define SMB_VFS_CONNECTPATH(conn, dirfsp, smb_fname) \
- smb_vfs_call_connectpath((conn)->vfs_handles, (dirfsp), (smb_fname))
-#define SMB_VFS_NEXT_CONNECTPATH(conn, dirfsp, smb_fname) \
- smb_vfs_call_connectpath((conn)->next, (dirfsp), (smb_fname))
-
#define SMB_VFS_BRL_LOCK_WINDOWS(conn, br_lck, plock) \
smb_vfs_call_brl_lock_windows((conn)->vfs_handles, (br_lck), (plock))
#define SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock) \
return NT_STATUS_NOT_SUPPORTED;
}
-static const char *cephwrap_connectpath(
- struct vfs_handle_struct *handle,
- const struct files_struct *dirfsp,
- const struct smb_filename *smb_fname)
-{
- return handle->conn->connectpath;
-}
-
static NTSTATUS cephwrap_fget_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t *dosmode)
.realpath_fn = cephwrap_realpath,
.fchflags_fn = vfs_not_implemented_fchflags,
.get_real_filename_at_fn = cephwrap_get_real_filename_at,
- .connectpath_fn = cephwrap_connectpath,
.fget_dos_attributes_fn = cephwrap_fget_dos_attributes,
.fset_dos_attributes_fn = cephwrap_fset_dos_attributes,
return NT_STATUS_NOT_SUPPORTED;
}
-static const char *vfs_ceph_connectpath(
- struct vfs_handle_struct *handle,
- const struct files_struct *dirfsp,
- const struct smb_filename *smb_fname)
-{
- return handle->conn->connectpath;
-}
-
static NTSTATUS vfs_ceph_fget_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t *dosmode)
.realpath_fn = vfs_ceph_realpath,
.fchflags_fn = vfs_not_implemented_fchflags,
.get_real_filename_at_fn = vfs_ceph_get_real_filename_at,
- .connectpath_fn = vfs_ceph_connectpath,
.fget_dos_attributes_fn = vfs_ceph_fget_dos_attributes,
.fset_dos_attributes_fn = vfs_ceph_fset_dos_attributes,
return NT_STATUS_NOT_SUPPORTED;
}
-static const char *vfswrap_connectpath(struct vfs_handle_struct *handle,
- const struct files_struct *dirfsp,
- const struct smb_filename *smb_fname)
-{
- return handle->conn->connectpath;
-}
-
static NTSTATUS vfswrap_brl_lock_windows(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
struct lock_struct *plock)
.fs_file_id_fn = vfswrap_fs_file_id,
.fstreaminfo_fn = vfswrap_fstreaminfo,
.get_real_filename_at_fn = vfswrap_get_real_filename_at,
- .connectpath_fn = vfswrap_connectpath,
.brl_lock_windows_fn = vfswrap_brl_lock_windows,
.brl_unlock_windows_fn = vfswrap_brl_unlock_windows,
.strict_lock_check_fn = vfswrap_strict_lock_check,
SMB_VFS_OP_FSTREAMINFO,
SMB_VFS_OP_GET_REAL_FILENAME,
SMB_VFS_OP_GET_REAL_FILENAME_AT,
- SMB_VFS_OP_CONNECTPATH,
SMB_VFS_OP_BRL_LOCK_WINDOWS,
SMB_VFS_OP_BRL_UNLOCK_WINDOWS,
SMB_VFS_OP_STRICT_LOCK_CHECK,
{ SMB_VFS_OP_FSTREAMINFO, "fstreaminfo" },
{ SMB_VFS_OP_GET_REAL_FILENAME, "get_real_filename" },
{ SMB_VFS_OP_GET_REAL_FILENAME_AT, "get_real_filename_at" },
- { SMB_VFS_OP_CONNECTPATH, "connectpath" },
{ SMB_VFS_OP_BRL_LOCK_WINDOWS, "brl_lock_windows" },
{ SMB_VFS_OP_BRL_UNLOCK_WINDOWS, "brl_unlock_windows" },
{ SMB_VFS_OP_STRICT_LOCK_CHECK, "strict_lock_check" },
return result;
}
-static const char *smb_full_audit_connectpath(
- vfs_handle_struct *handle,
- const struct files_struct *dirfsp,
- const struct smb_filename *smb_fname)
-{
- const char *result;
-
- result = SMB_VFS_NEXT_CONNECTPATH(handle, dirfsp, smb_fname);
-
- do_log(SMB_VFS_OP_CONNECTPATH,
- result != NULL,
- handle,
- "%s",
- smb_fname_str_do_log(handle->conn, smb_fname));
-
- return result;
-}
-
static NTSTATUS smb_full_audit_brl_lock_windows(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
struct lock_struct *plock)
.snap_delete_fn = smb_full_audit_snap_delete,
.fstreaminfo_fn = smb_full_audit_fstreaminfo,
.get_real_filename_at_fn = smb_full_audit_get_real_filename_at,
- .connectpath_fn = smb_full_audit_connectpath,
.brl_lock_windows_fn = smb_full_audit_brl_lock_windows,
.brl_unlock_windows_fn = smb_full_audit_brl_unlock_windows,
.strict_lock_check_fn = smb_full_audit_strict_lock_check,
return NT_STATUS_OK;
}
-static const char *vfs_gluster_connectpath(
- struct vfs_handle_struct *handle,
- const struct files_struct *dirfsp,
- const struct smb_filename *smb_fname)
-{
- return handle->conn->connectpath;
-}
-
/* EA Operations */
static ssize_t vfs_gluster_fgetxattr(struct vfs_handle_struct *handle,
.file_id_create_fn = NULL,
.fstreaminfo_fn = NULL,
.get_real_filename_at_fn = vfs_gluster_get_real_filename_at,
- .connectpath_fn = vfs_gluster_connectpath,
.create_dfs_pathat_fn = vfs_gluster_create_dfs_pathat,
.read_dfs_pathat_fn = vfs_gluster_read_dfs_pathat,
return NT_STATUS_NOT_IMPLEMENTED;
}
-_PUBLIC_
-const char *vfs_not_implemented_connectpath(
- struct vfs_handle_struct *handle,
- const struct files_struct *dirfsp,
- const struct smb_filename *smb_fname)
-{
- errno = ENOSYS;
- return NULL;
-}
-
_PUBLIC_
NTSTATUS vfs_not_implemented_brl_lock_windows(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
.fstreaminfo_fn = vfs_not_implemented_fstreaminfo,
.get_real_filename_at_fn = vfs_not_implemented_get_real_filename_at,
- .connectpath_fn = vfs_not_implemented_connectpath,
.brl_lock_windows_fn = vfs_not_implemented_brl_lock_windows,
.brl_unlock_windows_fn = vfs_not_implemented_brl_unlock_windows,
.strict_lock_check_fn = vfs_not_implemented_strict_lock_check,
return status;
}
-static const char *shadow_copy2_connectpath(
- struct vfs_handle_struct *handle,
- const struct files_struct *dirfsp,
- const struct smb_filename *smb_fname_in)
-{
- time_t timestamp = 0;
- char *stripped = NULL;
- char *tmp = NULL;
- const char *fname = smb_fname_in->base_name;
- const struct smb_filename *full = NULL;
- struct smb_filename smb_fname = {0};
- struct smb_filename *result_fname = NULL;
- char *result = NULL;
- char *parent_dir = NULL;
- int saved_errno = 0;
- size_t rootpath_len = 0;
- struct shadow_copy2_private *priv = NULL;
-
- SMB_VFS_HANDLE_GET_DATA(handle, priv, struct shadow_copy2_private,
- return NULL);
-
- DBG_DEBUG("Calc connect path for [%s]\n", fname);
-
- if (priv->shadow_connectpath != NULL) {
- DBG_DEBUG("cached connect path is [%s]\n",
- priv->shadow_connectpath);
- return priv->shadow_connectpath;
- }
-
- full = full_path_from_dirfsp_atname(
- talloc_tos(), dirfsp, smb_fname_in);
- if (full == NULL) {
- return NULL;
- }
-
- if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, full,
- ×tamp, &stripped)) {
- goto done;
- }
- if (timestamp == 0) {
- return SMB_VFS_NEXT_CONNECTPATH(handle, dirfsp, smb_fname_in);
- }
-
- tmp = shadow_copy2_do_convert(talloc_tos(), handle, stripped, timestamp,
- &rootpath_len);
- if (tmp == NULL) {
- if (errno != ENOENT) {
- goto done;
- }
-
- /*
- * If the converted path does not exist, and converting
- * the parent yields something that does exist, then
- * this path refers to something that has not been
- * created yet, relative to the parent path.
- * The snapshot finding is relative to the parent.
- * (usually snapshots are read/only but this is not
- * necessarily true).
- * This code also covers getting a wildcard in the
- * last component, because this function is called
- * prior to sanitizing the path, and in SMB1 we may
- * get wildcards in path names.
- */
- if (!parent_dirname(talloc_tos(), stripped, &parent_dir,
- NULL)) {
- errno = ENOMEM;
- goto done;
- }
-
- tmp = shadow_copy2_do_convert(talloc_tos(), handle, parent_dir,
- timestamp, &rootpath_len);
- if (tmp == NULL) {
- goto done;
- }
- }
-
- DBG_DEBUG("converted path is [%s] root path is [%.*s]\n", tmp,
- (int)rootpath_len, tmp);
-
- tmp[rootpath_len] = '\0';
- smb_fname = (struct smb_filename) { .base_name = tmp };
-
- result_fname = SMB_VFS_NEXT_REALPATH(handle, priv, &smb_fname);
- if (result_fname == NULL) {
- goto done;
- }
-
- /*
- * SMB_VFS_NEXT_REALPATH returns a talloc'ed string.
- * Don't leak memory.
- */
- TALLOC_FREE(priv->shadow_realpath);
- priv->shadow_realpath = result_fname;
- result = priv->shadow_realpath->base_name;
-
- DBG_DEBUG("connect path is [%s]\n", result);
-
-done:
- if (result == NULL) {
- saved_errno = errno;
- }
- TALLOC_FREE(tmp);
- TALLOC_FREE(stripped);
- TALLOC_FREE(parent_dir);
- if (saved_errno != 0) {
- errno = saved_errno;
- }
- return result;
-}
-
static NTSTATUS shadow_copy2_parent_pathname(vfs_handle_struct *handle,
TALLOC_CTX *ctx,
const struct smb_filename *smb_fname_in,
.pwrite_fn = shadow_copy2_pwrite,
.pwrite_send_fn = shadow_copy2_pwrite_send,
.pwrite_recv_fn = shadow_copy2_pwrite_recv,
- .connectpath_fn = shadow_copy2_connectpath,
.parent_pathname_fn = shadow_copy2_parent_pathname,
};
return result;
}
-static const char *smb_time_audit_connectpath(
- vfs_handle_struct *handle,
- const struct files_struct *dirfsp,
- const struct smb_filename *smb_fname)
-{
- const char *result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_CONNECTPATH(handle, dirfsp, smb_fname);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log_fname("connectpath", timediff,
- smb_fname->base_name);
- }
-
- return result;
-}
-
static NTSTATUS smb_time_audit_brl_lock_windows(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
struct lock_struct *plock)
.snap_delete_fn = smb_time_audit_snap_delete,
.fstreaminfo_fn = smb_time_audit_fstreaminfo,
.get_real_filename_at_fn = smb_time_audit_get_real_filename_at,
- .connectpath_fn = smb_time_audit_connectpath,
.brl_lock_windows_fn = smb_time_audit_brl_lock_windows,
.brl_unlock_windows_fn = smb_time_audit_brl_unlock_windows,
.strict_lock_check_fn = smb_time_audit_strict_lock_check,
handle, dirfsp, name, mem_ctx, found_name);
}
-const char *smb_vfs_call_connectpath(struct vfs_handle_struct *handle,
- const struct files_struct *dirfsp,
- const struct smb_filename *smb_fname)
-{
- VFS_FIND(connectpath);
- return handle->fns->connectpath_fn(handle, dirfsp, smb_fname);
-}
-
bool smb_vfs_call_strict_lock_check(struct vfs_handle_struct *handle,
struct files_struct *fsp,
struct lock_struct *plock)