]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs: Remove connectpath function
authorVolker Lendecke <vl@samba.org>
Fri, 7 Nov 2025 12:38:58 +0000 (13:38 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 10 Nov 2025 13:29:30 +0000 (13:29 +0000)
Nobody called this

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
14 files changed:
docs-xml/manpages/vfs_full_audit.8.xml
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source3/include/vfs.h
source3/include/vfs_macros.h
source3/modules/vfs_ceph.c
source3/modules/vfs_ceph_new.c
source3/modules/vfs_default.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_glusterfs.c
source3/modules/vfs_not_implemented.c
source3/modules/vfs_shadow_copy2.c
source3/modules/vfs_time_audit.c
source3/smbd/vfs.c

index a7bc95be0a8c90a05d770754a1d46d758f6f39c7..59e72e19091770ecbf50dbc4179f60de41035302 100644 (file)
@@ -46,7 +46,6 @@
        <member>close</member>
        <member>closedir</member>
        <member>connect</member>
-       <member>connectpath</member>
        <member>create_dfs_pathat</member>
        <member>create_file</member>
        <member>disconnect</member>
index abb369c480a0e526343e07c1b7f4ad5dc6d0a96b..7d0e6e8ff6ddb149957ee4c2cdc3037e777d9584 100644 (file)
@@ -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,
index 9a3546192659f5eb045097cde96c688f0d7c24ac..bcc59cc10bc14d23cded8f3411bebb297f817baa 100644 (file)
@@ -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,
index cf6590a56cdf7c40c40764e8017b383aaf3069fd..c4320d8ed7e278525eb9d4c29917360bfb68d994 100644 (file)
  * 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);
index 7f2e1defb46e7c22f5db31e0cb34884d8133f436..56983de6661e9206266d95b9a75f86110ad59ce4 100644 (file)
                (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) \
index 93a2feb479284cb42554a6d443f1aecc1a23e495..be7b4c515e478b3771abf721df4fe6dffcfe6825 100644 (file)
@@ -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,
 
index 74424d30321a8c949fdb88fba27433d060241139..e6fa0449d47d8ab98ae213dcd49053c0fce539e2 100644 (file)
@@ -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,
 
index 5501723da9db714002a7b4733ba57d8867fe32c9..9321206642585d94a8455b47f99bf8a2b06e738c 100644 (file)
@@ -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,
index e25a92507f54c3cb5049921b31fa687be997dc14..8bd72f93533c76ac8c20da2426e425484b03e3a9 100644 (file)
@@ -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,
index 6835bc0052c212a08041c80b0d602ee1a9fd6ec7..3f3a4f6199415232d3ec83636c8a1d09e04343cb 100644 (file)
@@ -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,
 
index 0e210496b43d7014f2e6617229d86d9a72313e29..38a5ee1825bf6b988dbc72ab0a0a58c5fc90d1bd 100644 (file)
@@ -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,
index 3bd17b40795ad773a4b0e34f234bd4f5d8fcb060..ba9d01372c091c18a7ce5a7f0639f65dd13e69cf 100644 (file)
@@ -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,
-                                        &timestamp, &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,
 };
 
index 83f87b6e7901fe66931ff0295738a65d39662580..a4b04aa020fc162d0f8296b97fd4aa4107a230f3 100644 (file)
@@ -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,
index af54fc8f2f58f2ef4a179562f318b8b50f2bce92..7c5f141b3db91c61bd654c590dbd8dc0e9520c0b 100644 (file)
@@ -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)