]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Introduce cp_smb_basename() helper function
authorVolker Lendecke <vl@samba.org>
Sat, 8 Nov 2025 09:37:55 +0000 (10:37 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 10 Nov 2025 14:33:28 +0000 (14:33 +0000)
I always had to look up the sequence of NULLs and 0s. Save lines.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Nov 10 14:33:28 UTC 2025 on atb-devel-224

27 files changed:
source3/include/proto.h
source3/lib/filename_util.c
source3/modules/vfs_ceph.c
source3/modules/vfs_ceph_new.c
source3/modules/vfs_ceph_snapshots.c
source3/modules/vfs_default.c
source3/modules/vfs_fileid.c
source3/modules/vfs_fruit.c
source3/modules/vfs_glusterfs.c
source3/modules/vfs_recycle.c
source3/modules/vfs_shadow_copy.c
source3/modules/vfs_shadow_copy2.c
source3/modules/vfs_virusfilter.c
source3/modules/vfs_widelinks.c
source3/modules/vfs_xattr_tdb.c
source3/printing/printspoolss.c
source3/rpc_server/fss/srv_fss_agent.c
source3/smbd/conn.c
source3/smbd/dir.c
source3/smbd/files.c
source3/smbd/msdfs.c
source3/smbd/ntquotas.c
source3/smbd/pysmbd.c
source3/smbd/smb2_pipes.c
source3/smbd/smb2_service.c
source3/smbd/vfs.c
source3/utils/net_vfs.c

index f773d70b7c4185367725c3c481f0d92a20317211..8f4f500ded503a47d8f523517228149720c9c248 100644 (file)
@@ -710,6 +710,7 @@ struct smb_filename *cp_smb_filename(TALLOC_CTX *mem_ctx,
                                     const struct smb_filename *in);
 struct smb_filename *cp_smb_filename_nostream(TALLOC_CTX *mem_ctx,
                                     const struct smb_filename *in);
+struct smb_filename *cp_smb_basename(TALLOC_CTX *mem_ctx, const char *fname);
 bool is_ntfs_stream_smb_fname(const struct smb_filename *smb_fname);
 bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname);
 bool is_named_stream(const struct smb_filename *smb_fname);
index 0108ae6e6a0d8693ae6d58e343af0d60e2034f88..fc8210888629af08f47bc1301f37ace75de2cacf 100644 (file)
@@ -74,6 +74,11 @@ struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx,
        return cp_smb_filename(mem_ctx, &smb_fname_loc);
 }
 
+struct smb_filename *cp_smb_basename(TALLOC_CTX *mem_ctx, const char *fname)
+{
+       return synthetic_smb_fname(mem_ctx, fname, NULL, NULL, 0, 0);
+}
+
 /**
  * Utility function used by VFS calls that must *NOT* operate
  * on a stream filename, only the base_name.
index be7b4c515e478b3771abf721df4fe6dffcfe6825..dc10a516ff5bc8a0c4f3cd0e1fda2d77c878ab4a 100644 (file)
@@ -1126,7 +1126,7 @@ static struct smb_filename *cephwrap_getwd(struct vfs_handle_struct *handle,
 {
        const char *cwd = ceph_getcwd(handle->data);
        DBG_DEBUG("[CEPH] getwd(%p) = %s\n", handle, cwd);
-       return synthetic_smb_fname(ctx, cwd, NULL, NULL, 0, 0);
+       return cp_smb_basename(ctx, cwd);
 }
 
 static int strict_allocate_ftruncate(struct vfs_handle_struct *handle,
@@ -1408,7 +1408,7 @@ static struct smb_filename *cephwrap_realpath(struct vfs_handle_struct *handle,
        }
 
        DBG_DEBUG("[CEPH] realpath(%p, %s) = %s\n", handle, path, result);
-       result_fname = synthetic_smb_fname(ctx, result, NULL, NULL, 0, 0);
+       result_fname = cp_smb_basename(ctx, result);
        TALLOC_FREE(result);
        return result_fname;
 }
index e6fa0449d47d8ab98ae213dcd49053c0fce539e2..5dfdea583e95aabb44e45bc42dd2f0f15d38c317 100644 (file)
@@ -3436,7 +3436,7 @@ static struct smb_filename *vfs_ceph_getwd(struct vfs_handle_struct *handle,
        cwd = config->ceph_getcwd_fn(config->mount);
        DBG_DEBUG("[CEPH] getwd: handle=%p cwd=%s\n", handle, cwd);
        END_PROFILE_X(syscall_getwd);
-       return synthetic_smb_fname(ctx, cwd, NULL, NULL, 0, 0);
+       return cp_smb_basename(ctx, cwd);
 }
 
 static int strict_allocate_ftruncate(struct vfs_handle_struct *handle,
@@ -3816,7 +3816,7 @@ static struct smb_filename *vfs_ceph_realpath(struct vfs_handle_struct *handle,
        }
 
        DBG_DEBUG("[CEPH] realpath(%p, %s) = %s\n", handle, path, result);
-       result_fname = synthetic_smb_fname(ctx, result, NULL, NULL, 0, 0);
+       result_fname = cp_smb_basename(ctx, result);
        TALLOC_FREE(result);
 out:
        END_PROFILE_X(syscall_realpath);
index e6d097ad5dea86358fd452bdbe2a524dad9616c1..46d45c84dc657cb079c68f33b8a115c04c5d96ab 100644 (file)
@@ -151,12 +151,7 @@ static int ceph_snap_fill_label(struct vfs_handle_struct *handle,
                return -EINVAL;
        }
 
-       smb_fname = synthetic_smb_fname(tmp_ctx,
-                                       snap_path,
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       0);
+       smb_fname = cp_smb_basename(tmp_ctx, snap_path);
        if (smb_fname == NULL) {
                return -ENOMEM;
        }
@@ -605,12 +600,7 @@ static int ceph_snap_gmt_convert_dir(struct vfs_handle_struct *handle,
                        goto err_out;
                }
 
-               smb_fname = synthetic_smb_fname(tmp_ctx,
-                                               _converted_buf,
-                                               NULL,
-                                               NULL,
-                                               0,
-                                               0);
+               smb_fname = cp_smb_basename(tmp_ctx, _converted_buf);
                if (smb_fname == NULL) {
                        ret = -ENOMEM;
                        goto err_out;
index 3b2463876da8a5766420f10f504eb5214fdd325c..34b00f5b547347ec252912098434a39d09fff800 100644 (file)
@@ -2840,12 +2840,7 @@ static struct smb_filename *vfswrap_getwd(vfs_handle_struct *handle,
        if (result == NULL) {
                return NULL;
        }
-       smb_fname = synthetic_smb_fname(ctx,
-                               result,
-                               NULL,
-                               NULL,
-                               0,
-                               0);
+       smb_fname = cp_smb_basename(ctx, result);
        /*
         * sys_getwd() *always* returns malloced memory.
         * We must free here to avoid leaks:
@@ -3307,12 +3302,7 @@ static struct smb_filename *vfswrap_realpath(vfs_handle_struct *handle,
        result = sys_realpath(smb_fname->base_name);
        END_PROFILE_X(syscall_realpath);
        if (result) {
-               result_fname = synthetic_smb_fname(ctx,
-                                                  result,
-                                                  NULL,
-                                                  NULL,
-                                                  0,
-                                                  0);
+               result_fname = cp_smb_basename(ctx, result);
                SAFE_FREE(result);
        }
        return result_fname;
index f76899e37e47f034e5bac2648dc346e18db5f85c..5ba33039a6e9fe4a95f662b27c742d46fb70fc5a 100644 (file)
@@ -432,15 +432,11 @@ static int get_connectpath_ino(struct vfs_handle_struct *handle,
                }
        }
 
-       fname = synthetic_smb_fname(frame,
-                                   fullpath,
-                                   NULL,
-                                   NULL,
-                                   0,
-                                   0);
+       fname = cp_smb_basename(frame, fullpath);
        if (fname == NULL) {
-               DBG_ERR("synthetic_smb_fname(%s) failed - %s\n",
-                       fullpath, strerror(errno));
+               DBG_ERR("cp_smb_basename(%s) failed - %s\n",
+                       fullpath,
+                       strerror(errno));
                TALLOC_FREE(frame);
                return -1;
        }
index 2ae3fdb94a66803d06d6fcf0325aeb04c1d8d9e3..9a634bab7585950e28275fe38b3ff3ca27b64954 100644 (file)
@@ -5151,12 +5151,7 @@ static bool fruit_get_bandsize(vfs_handle_struct *handle,
                goto out;
        }
 
-       smb_fname = synthetic_smb_fname(talloc_tos(),
-                                       plist,
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       0);
+       smb_fname = cp_smb_basename(talloc_tos(), plist);
        if (smb_fname == NULL) {
                ok = false;
                goto out;
@@ -5290,12 +5285,7 @@ static bool fruit_get_num_bands(vfs_handle_struct *handle,
                return false;
        }
 
-       bands_dir = synthetic_smb_fname(talloc_tos(),
-                                       path,
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       0);
+       bands_dir = cp_smb_basename(talloc_tos(), path);
        TALLOC_FREE(path);
        if (bands_dir == NULL) {
                return false;
index 0fabb9a7e08bb38ea711fde0968900e5a4713f9a..6fe12985d9c3fbc11187ed6070b72aa0907642ba 100644 (file)
@@ -1700,12 +1700,7 @@ static struct smb_filename *vfs_gluster_getwd(struct vfs_handle_struct *handle,
        if (ret == NULL) {
                return NULL;
        }
-       smb_fname = synthetic_smb_fname(ctx,
-                                       ret,
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       0);
+       smb_fname = cp_smb_basename(ctx, ret);
        return smb_fname;
 }
 
@@ -1854,12 +1849,7 @@ static struct smb_filename *vfs_gluster_realpath(struct vfs_handle_struct *handl
                        smb_fname->base_name,
                        resolved_path);
        if (result != NULL) {
-               result_fname = synthetic_smb_fname(ctx,
-                                                  result,
-                                                  NULL,
-                                                  NULL,
-                                                  0,
-                                                  0);
+               result_fname = cp_smb_basename(ctx, result);
        }
 
        SAFE_FREE(resolved_path);
index 421659fa6abb40b755f57abda6d37c73960ae6cf..bfea7ef75f4f87a5cb3d0cd6469d5d7f1c071f6d 100644 (file)
@@ -311,12 +311,7 @@ static bool recycle_create_dir(vfs_handle_struct *handle,
 
                        DEBUG(5, ("recycle: creating new dir %s\n", new_dir));
 
-                       smb_fname = synthetic_smb_fname(talloc_tos(),
-                                               new_dir,
-                                               NULL,
-                                               NULL,
-                                               0,
-                                               0);
+                       smb_fname = cp_smb_basename(talloc_tos(), new_dir);
                        if (smb_fname == NULL) {
                                goto done;
                        }
index 87fc191904ce4a9af9bca33d2817d6e866325642..e798d7692dc3b5b7c73f6f01d31fd0bcb565c915 100644 (file)
@@ -162,12 +162,8 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
        const char *dname = NULL;
        char *talloced = NULL;
        NTSTATUS status;
-       struct smb_filename *smb_fname = synthetic_smb_fname(talloc_tos(),
-                                               fsp->conn->connectpath,
-                                               NULL,
-                                               NULL,
-                                               0,
-                                               0);
+       struct smb_filename *smb_fname = cp_smb_basename(
+               talloc_tos(), fsp->conn->connectpath);
        if (smb_fname == NULL) {
                errno = ENOMEM;
                return -1;
index ba9d01372c091c18a7ce5a7f0639f65dd13e69cf..17e2b84d7bd05d72d26648c7d5a27b31ac8c45aa 100644 (file)
@@ -730,12 +730,7 @@ static char *shadow_copy2_find_mount_point(TALLOC_CTX *mem_ctx,
        dev_t dev;
        char *p;
 
-       smb_fname_cpath = synthetic_smb_fname(mem_ctx,
-                                             handle->conn->connectpath,
-                                             NULL,
-                                             NULL,
-                                             0,
-                                             0);
+       smb_fname_cpath = cp_smb_basename(mem_ctx, handle->conn->connectpath);
        if (smb_fname_cpath == NULL) {
                errno = ENOMEM;
                return NULL;
index 3d78d22c01a26bcbe3f6655a3ffbbaf2682a9825..a6e167df12684f2435e1f5eb1e04287454f161f4 100644 (file)
@@ -155,12 +155,7 @@ static bool quarantine_create_dir(
 
                        DBG_INFO("quarantine: creating new dir %s\n", new_dir);
 
-                       smb_fname = synthetic_smb_fname(talloc_tos(),
-                                                       new_dir,
-                                                       NULL,
-                                                       NULL,
-                                                       0,
-                                                       0);
+                       smb_fname = cp_smb_basename(talloc_tos(), new_dir);
                        if (smb_fname == NULL) {
                                goto done;
                        }
index df00d72707da999984fbc474866e88dda7993c46..9b802048dbeb0319b23bee15db8a202d56849fe5 100644 (file)
@@ -236,12 +236,7 @@ static struct smb_filename *widelinks_getwd(vfs_handle_struct *handle,
                /* getwd before chdir. See note 1b above. */
                return SMB_VFS_NEXT_GETWD(handle, ctx);
        }
-       return synthetic_smb_fname(ctx,
-                               config->cwd,
-                               NULL,
-                               NULL,
-                               0,
-                               0);
+       return cp_smb_basename(ctx, config->cwd);
 }
 
 static struct smb_filename *widelinks_realpath(vfs_handle_struct *handle,
@@ -297,12 +292,7 @@ static struct smb_filename *widelinks_realpath(vfs_handle_struct *handle,
                        pathname,
                        resolved_pathname);
 
-       smb_fname = synthetic_smb_fname(ctx,
-                               resolved_pathname,
-                               NULL,
-                               NULL,
-                               0,
-                               0);
+       smb_fname = cp_smb_basename(ctx, resolved_pathname);
        TALLOC_FREE(pathname);
        TALLOC_FREE(resolved_pathname);
        return smb_fname;
index 19331d0de4f63d00a750a67591e58ad7f057fca2..5a2d10341c619f584eea287d149da668bf4d081a 100644 (file)
@@ -52,12 +52,7 @@ static int xattr_tdb_get_file_id(struct vfs_handle_struct *handle,
        TALLOC_CTX *frame = talloc_stackframe();
        struct smb_filename *smb_fname;
 
-       smb_fname = synthetic_smb_fname(frame,
-                                       path,
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       0);
+       smb_fname = cp_smb_basename(frame, path);
        if (smb_fname == NULL) {
                TALLOC_FREE(frame);
                errno = ENOMEM;
index 94404f7682ab66147774ffe01fb3e07659fd2a48..60a53571a652185966e29f2a2349c12a6b438129 100644 (file)
@@ -215,12 +215,7 @@ NTSTATUS print_spool_open(files_struct *fsp,
        }
 
        /* setup a full fsp */
-       fsp->fsp_name = synthetic_smb_fname(fsp,
-                                           pf->filename,
-                                           NULL,
-                                           NULL,
-                                           0,
-                                           0);
+       fsp->fsp_name = cp_smb_basename(fsp, pf->filename);
        if (fsp->fsp_name == NULL) {
                status = NT_STATUS_NO_MEMORY;
                goto done;
index 4de600fd06c5e39e9dbf62eec6fc079344b4aebb..583814822bb0d6a4f264a2c869d68ad116aa9684 100644 (file)
@@ -173,12 +173,7 @@ static bool snap_path_exists(TALLOC_CTX *ctx, struct messaging_context *msg_ctx,
                goto out;
        }
 
-       smb_fname = synthetic_smb_fname(service,
-                                       sc->sc_path,
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       0);
+       smb_fname = cp_smb_basename(service, sc->sc_path);
        if (smb_fname == NULL) {
                goto out;
        }
index 40a9fc482e15ab0875be0a74b1339ecdd7683677..f1c75e292051245276a1583a0af3ad03f70c46f2 100644 (file)
@@ -114,12 +114,7 @@ connection_struct *conn_new(struct smbd_server_connection *sconn)
        if (conn->cwd_fsp == NULL) {
                goto nomem;
        }
-       conn->cwd_fsp->fsp_name = synthetic_smb_fname(conn->cwd_fsp,
-                                                     ".",
-                                                     NULL,
-                                                     NULL,
-                                                     0,
-                                                     0);
+       conn->cwd_fsp->fsp_name = cp_smb_basename(conn->cwd_fsp, ".");
        if (conn->cwd_fsp->fsp_name == NULL) {
                goto nomem;
        }
index c00fed20795470a4ccb177d894eea33858d467e5..b80579c8e55e4af1a10008a2d088304fc78429ec 100644 (file)
@@ -1215,12 +1215,7 @@ const char *ReadDirName(struct smb_Dir *dir_hnd, char **ptalloced)
                        struct smb_filename *atname = NULL;
                        int ret;
 
-                       atname = synthetic_smb_fname(talloc_tos(),
-                                                    n,
-                                                    NULL,
-                                                    NULL,
-                                                    0,
-                                                    0);
+                       atname = cp_smb_basename(talloc_tos(), n);
                        if (atname == NULL) {
                                TALLOC_FREE(talloced);
                                continue;
index 7cb7ecfa965ea835e19399dc5fd55a983e23ca9c..209c7fcf2b4368a3ca944aa3be4d4119a2c9ae7c 100644 (file)
@@ -170,12 +170,7 @@ NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
         * few NULL checks, so make sure it's initialized with something. to
         * be safe until an audit can be done.
         */
-       fsp->fsp_name = synthetic_smb_fname(fsp,
-                                           "",
-                                           NULL,
-                                           NULL,
-                                           0,
-                                           0);
+       fsp->fsp_name = cp_smb_basename(fsp, "");
        if (fsp->fsp_name == NULL) {
                file_free(NULL, fsp);
                return NT_STATUS_NO_MEMORY;
index eb0333d46be90f35630c393994eea556c200781a..05cc118164568c84267a6595498905fb55692faf 100644 (file)
@@ -1345,12 +1345,7 @@ bool create_msdfs_link(const struct junction_map *jucn,
                goto out;
        }
 
-       smb_fname = synthetic_smb_fname(frame,
-                               path,
-                               NULL,
-                               NULL,
-                               0,
-                               0);
+       smb_fname = cp_smb_basename(frame, path);
        if (smb_fname == NULL) {
                goto out;
        }
@@ -1431,12 +1426,7 @@ bool remove_msdfs_link(const struct junction_map *jucn,
                return false;
        }
 
-       smb_fname = synthetic_smb_fname(frame,
-                                       path,
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       0);
+       smb_fname = cp_smb_basename(frame, path);
        if (smb_fname == NULL) {
                TALLOC_FREE(frame);
                errno = ENOMEM;
@@ -1517,12 +1507,7 @@ static size_t count_dfs_links(TALLOC_CTX *ctx,
                goto out;
        }
 
-       smb_fname = synthetic_smb_fname(frame,
-                                       ".",
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       0);
+       smb_fname = cp_smb_basename(frame, ".");
        if (smb_fname == NULL) {
                goto out;
        }
@@ -1540,13 +1525,7 @@ static size_t count_dfs_links(TALLOC_CTX *ctx,
        }
 
        while ((dname = ReadDirName(dir_hnd, &talloced)) != NULL) {
-               struct smb_filename *smb_dname =
-                       synthetic_smb_fname(frame,
-                                       dname,
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       0);
+               struct smb_filename *smb_dname = cp_smb_basename(frame, dname);
                if (smb_dname == NULL) {
                        goto out;
                }
@@ -1657,12 +1636,7 @@ static int form_junctions(TALLOC_CTX *ctx,
                goto out;
        }
 
-       smb_fname = synthetic_smb_fname(frame,
-                                       ".",
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       0);
+       smb_fname = cp_smb_basename(frame, ".");
        if (smb_fname == NULL) {
                goto out;
        }
@@ -1688,12 +1662,7 @@ static int form_junctions(TALLOC_CTX *ctx,
                        TALLOC_FREE(talloced);
                        goto out;
                }
-               smb_dname = synthetic_smb_fname(talloc_tos(),
-                               dname,
-                               NULL,
-                               NULL,
-                               0,
-                               0);
+               smb_dname = cp_smb_basename(talloc_tos(), dname);
                if (smb_dname == NULL) {
                        TALLOC_FREE(talloced);
                        goto out;
index d3e1949088532257a1a91a2fad2fe6648e2ae6d2..affd7d58f818938a5c44a8a8a8aaa3d8849a7e23 100644 (file)
@@ -84,12 +84,7 @@ NTSTATUS vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype,
                return NT_STATUS_NO_SUCH_USER;
        }
 
-       smb_fname_cwd = synthetic_smb_fname(talloc_tos(),
-                               ".",
-                               NULL,
-                               NULL,
-                               0,
-                               0);
+       smb_fname_cwd = cp_smb_basename(talloc_tos(), ".");
        if (smb_fname_cwd == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
index fe439dfe2c241dcf88be7f6882f19e25c4ab0f6f..5b599d85ef81572c77c8a2f411c451d873b42423 100644 (file)
@@ -1158,15 +1158,8 @@ static PyObject *py_smbd_mkdir(PyObject *self, PyObject *args, PyObject *kwargs)
                return NULL;
        }
 
-       smb_fname = synthetic_smb_fname(talloc_tos(),
-                                       canonicalize_path(talloc_tos(),
-                                                         conn,
-                                                         fname),
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       0);
-
+       smb_fname = cp_smb_basename(
+               talloc_tos(), canonicalize_path(talloc_tos(), conn, fname));
        if (smb_fname == NULL) {
                TALLOC_FREE(frame);
                return NULL;
index 8f8786752db94ab84addab9e3433b0595fb73726..ef5acc2c2a8868b0e5dfe5b07513bfa7b0322657 100644 (file)
@@ -55,12 +55,7 @@ NTSTATUS open_np_file(struct smb_request *smb_req, const char *name,
        fsp->fsp_flags.can_lock = false;
        fsp->access_mask = FILE_READ_DATA | FILE_WRITE_DATA;
 
-       smb_fname = synthetic_smb_fname(talloc_tos(),
-                                       name,
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       0);
+       smb_fname = cp_smb_basename(talloc_tos(), name);
        if (smb_fname == NULL) {
                file_free(smb_req, fsp);
                return NT_STATUS_NO_MEMORY;
index 561d64612866ba381b69f4f60663c1d9b470b5d6..e43c3d9faa2a4b4db95aca1a3f74cedf96e52a16 100644 (file)
@@ -78,12 +78,7 @@ bool set_conn_connectpath(connection_struct *conn, const char *connectpath)
         * start as conn->connectpath.
         */
        TALLOC_FREE(conn->cwd_fsp->fsp_name);
-       conn->cwd_fsp->fsp_name = synthetic_smb_fname(conn,
-                               conn->connectpath,
-                               NULL,
-                               NULL,
-                               0,
-                               0);
+       conn->cwd_fsp->fsp_name = cp_smb_basename(conn, conn->connectpath);
        if (conn->cwd_fsp->fsp_name == NULL) {
                return false;
        }
index da7181db1d7c859b19e0da4466ae0ff5dc4d84c6..30cec1ea68f6739b6e811a236dbe5e189590a78d 100644 (file)
@@ -1036,12 +1036,7 @@ struct smb_filename *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn)
                goto nocache;
        }
 
-       smb_fname_dot = synthetic_smb_fname(ctx,
-                                           ".",
-                                           NULL,
-                                           NULL,
-                                           0,
-                                           0);
+       smb_fname_dot = cp_smb_basename(ctx, ".");
        if (smb_fname_dot == NULL) {
                errno = ENOMEM;
                goto out;
@@ -1296,7 +1291,7 @@ NTSTATUS vfs_at_fspcwd(TALLOC_CTX *mem_ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
-       fsp->fsp_name = synthetic_smb_fname(fsp, ".", NULL, NULL, 0, 0);
+       fsp->fsp_name = cp_smb_basename(fsp, ".");
        if (fsp->fsp_name == NULL) {
                TALLOC_FREE(fsp);
                return NT_STATUS_NO_MEMORY;
@@ -1326,12 +1321,7 @@ uint32_t vfs_get_fs_capabilities(struct connection_struct *conn,
        struct vfs_statvfs_struct statbuf = {};
        int ret;
 
-       smb_fname_cpath = synthetic_smb_fname(talloc_tos(),
-                                             conn->connectpath,
-                                             NULL,
-                                             NULL,
-                                             0,
-                                             0);
+       smb_fname_cpath = cp_smb_basename(talloc_tos(), conn->connectpath);
        if (smb_fname_cpath == NULL) {
                return caps;
        }
index 8120811676e97ae0122f4653d52c3d65b9c3f54c..0689340b1f38a6d627f9e44a00b3038bb5ae4d8f 100644 (file)
@@ -228,12 +228,7 @@ static int net_vfs_get_ntacl(struct net_context *net,
        }
 
        path = argv[1];
-       smb_fname = synthetic_smb_fname(state.mem_ctx,
-                                       path,
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       0);
+       smb_fname = cp_smb_basename(state.mem_ctx, path);
        if (smb_fname == NULL) {
                goto done;
        }
@@ -333,12 +328,7 @@ static bool do_unfruit(const char *path)
                }
        }
 
-       smb_fname = synthetic_smb_fname(state.mem_ctx,
-                                       path,
-                                       NULL,
-                                       NULL,
-                                       0,
-                                       0);
+       smb_fname = cp_smb_basename(state.mem_ctx, path);
        if (smb_fname == NULL) {
                return false;
        }