From: Volker Lendecke Date: Fri, 7 Nov 2025 12:38:58 +0000 (+0100) Subject: vfs: Remove connectpath function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=095716c0b08696b76af3d497766a539f65cd85b6;p=thirdparty%2Fsamba.git vfs: Remove connectpath function Nobody called this Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/docs-xml/manpages/vfs_full_audit.8.xml b/docs-xml/manpages/vfs_full_audit.8.xml index a7bc95be0a8..59e72e19091 100644 --- a/docs-xml/manpages/vfs_full_audit.8.xml +++ b/docs-xml/manpages/vfs_full_audit.8.xml @@ -46,7 +46,6 @@ close closedir connect - connectpath create_dfs_pathat create_file disconnect diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index abb369c480a..7d0e6e8ff6d 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -664,15 +664,6 @@ static NTSTATUS skel_get_real_filename_at(struct vfs_handle_struct *handle, 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) @@ -1050,7 +1041,6 @@ static struct vfs_fn_pointers skel_opaque_fns = { .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, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 9a354619265..bcc59cc10bc 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -887,14 +887,6 @@ static NTSTATUS skel_get_real_filename_at(struct vfs_handle_struct *handle, 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) @@ -1363,7 +1355,6 @@ static struct vfs_fn_pointers skel_transparent_fns = { .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, diff --git a/source3/include/vfs.h b/source3/include/vfs.h index cf6590a56cd..c4320d8ed7e 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -394,6 +394,7 @@ * 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 @@ -1221,10 +1222,6 @@ struct vfs_fn_pointers { 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); @@ -1705,9 +1702,6 @@ NTSTATUS smb_vfs_call_get_real_filename_at(struct vfs_handle_struct *handle, 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); @@ -2183,10 +2177,6 @@ NTSTATUS vfs_not_implemented_get_real_filename_at( 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); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 7f2e1defb46..56983de6661 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -404,11 +404,6 @@ (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) \ diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 93a2feb4792..be7b4c515e4 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -1427,14 +1427,6 @@ static NTSTATUS cephwrap_get_real_filename_at( 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) @@ -1836,7 +1828,6 @@ static struct vfs_fn_pointers ceph_fns = { .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, diff --git a/source3/modules/vfs_ceph_new.c b/source3/modules/vfs_ceph_new.c index 74424d30321..e6fa0449d47 100644 --- a/source3/modules/vfs_ceph_new.c +++ b/source3/modules/vfs_ceph_new.c @@ -3837,14 +3837,6 @@ static NTSTATUS vfs_ceph_get_real_filename_at( 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) @@ -4295,7 +4287,6 @@ static struct vfs_fn_pointers ceph_new_fns = { .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, diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 5501723da9d..93212066425 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -3450,13 +3450,6 @@ static NTSTATUS vfswrap_get_real_filename_at( 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) @@ -4105,7 +4098,6 @@ static struct vfs_fn_pointers vfs_default_fns = { .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, diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index e25a92507f5..8bd72f93533 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -166,7 +166,6 @@ typedef enum _vfs_op_type { 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, @@ -302,7 +301,6 @@ static struct { { 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" }, @@ -2119,24 +2117,6 @@ static NTSTATUS smb_full_audit_get_real_filename_at( 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) @@ -3009,7 +2989,6 @@ static struct vfs_fn_pointers vfs_full_audit_fns = { .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, diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 6835bc0052c..3f3a4f61994 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -2253,14 +2253,6 @@ static NTSTATUS vfs_gluster_get_real_filename_at( 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, @@ -2637,7 +2629,6 @@ static struct vfs_fn_pointers glusterfs_fns = { .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, diff --git a/source3/modules/vfs_not_implemented.c b/source3/modules/vfs_not_implemented.c index 0e210496b43..38a5ee1825b 100644 --- a/source3/modules/vfs_not_implemented.c +++ b/source3/modules/vfs_not_implemented.c @@ -731,16 +731,6 @@ NTSTATUS vfs_not_implemented_get_real_filename_at( 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, @@ -1147,7 +1137,6 @@ static struct vfs_fn_pointers vfs_not_implemented_fns = { .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, diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 3bd17b40795..ba9d01372c0 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -2527,116 +2527,6 @@ static NTSTATUS shadow_copy2_read_dfs_pathat(struct vfs_handle_struct *handle, 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, @@ -3294,7 +3184,6 @@ static struct vfs_fn_pointers vfs_shadow_copy2_fns = { .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, }; diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 83f87b6e790..a4b04aa020f 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -1736,28 +1736,6 @@ static NTSTATUS smb_time_audit_get_real_filename_at( 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) @@ -2799,7 +2777,6 @@ static struct vfs_fn_pointers vfs_time_audit_fns = { .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, diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index af54fc8f2f5..7c5f141b3db 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -2194,14 +2194,6 @@ NTSTATUS smb_vfs_call_get_real_filename_at(struct vfs_handle_struct *handle, 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)