]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
srvsvc: Move valid_share_pathname() to where it's used
authorVolker Lendecke <vl@samba.org>
Sat, 3 Jan 2026 09:12:49 +0000 (10:12 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 20 Jan 2026 11:53:34 +0000 (11:53 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/include/proto.h
source3/lib/util.c
source3/rpc_server/srvsvc/srv_srvsvc_nt.c

index c93c521ae677c2ac75452aa344db2b3ef4f2af7c..d851caefb1d0cff076f7b5772f38e4694df47927 100644 (file)
@@ -367,7 +367,6 @@ bool split_domain_user(TALLOC_CTX *mem_ctx,
 const char *strip_hostname(const char *s);
 bool any_nt_status_not_ok(NTSTATUS err1, NTSTATUS err2, NTSTATUS *result);
 int timeval_to_msec(struct timeval t);
-char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
 bool is_executable(const char *fname);
 bool map_open_params_to_ntcreate(const char *smb_base_fname,
                                 int deny_mode, int open_func,
index 11c0425c151d06164737beec5f3cbb565aba845c..8f65f6866a5814436b54c57dfa07d456018772eb 100644 (file)
@@ -1536,39 +1536,6 @@ int timeval_to_msec(struct timeval t)
        return t.tv_sec * 1000 + (t.tv_usec+999) / 1000;
 }
 
-/*******************************************************************
- Check a given DOS pathname is valid for a share.
-********************************************************************/
-
-char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname)
-{
-       char *ptr = NULL;
-
-       if (!dos_pathname) {
-               return NULL;
-       }
-
-       ptr = talloc_strdup(ctx, dos_pathname);
-       if (!ptr) {
-               return NULL;
-       }
-       string_replace(ptr, '\\', '/');
-       ptr = unix_clean_name(ctx, ptr);
-       if (!ptr) {
-               return NULL;
-       }
-
-       /* NT is braindead - it wants a C: prefix to a pathname ! So strip it. */
-       if (strlen(ptr) > 2 && ptr[1] == ':' && ptr[0] != '/')
-               ptr += 2;
-
-       /* Only absolute paths allowed. */
-       if (*ptr != '/')
-               return NULL;
-
-       return ptr;
-}
-
 /*******************************************************************
  Return True if the filename is one of the special executable types.
 ********************************************************************/
index 09ec334d5a9fa8bdae791a84eb5f675a13717d89..8019827108e1aac38e0365791a8782cd195dff5b 100644 (file)
@@ -1873,6 +1873,39 @@ WERROR _srvsvc_NetShareGetInfo(struct pipes_struct *p,
        return status;
 }
 
+/*******************************************************************
+ Check a given DOS pathname is valid for a share.
+********************************************************************/
+
+static char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname)
+{
+       char *ptr = NULL;
+
+       if (!dos_pathname) {
+               return NULL;
+       }
+
+       ptr = talloc_strdup(ctx, dos_pathname);
+       if (!ptr) {
+               return NULL;
+       }
+       string_replace(ptr, '\\', '/');
+       ptr = unix_clean_name(ctx, ptr);
+       if (!ptr) {
+               return NULL;
+       }
+
+       /* NT is braindead - it wants a C: prefix to a pathname ! So strip it. */
+       if (strlen(ptr) > 2 && ptr[1] == ':' && ptr[0] != '/')
+               ptr += 2;
+
+       /* Only absolute paths allowed. */
+       if (*ptr != '/')
+               return NULL;
+
+       return ptr;
+}
+
 /*******************************************************************
  _srvsvc_NetShareSetInfo. Modify share details.
 ********************************************************************/