]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Move utok_string() into smbd
authorVolker Lendecke <vl@samba.org>
Sun, 9 Nov 2025 09:47:02 +0000 (10:47 +0100)
committerVolker Lendecke <vl@samba.org>
Wed, 7 Jan 2026 09:57:40 +0000 (09:57 +0000)
Only used in chdir_current_service()

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/smbd/smb2_service.c

index 8f4f500ded503a47d8f523517228149720c9c248..279fcee0c4877bb874366ffafc6c77033ccac47b 100644 (file)
@@ -378,7 +378,6 @@ bool map_open_params_to_ntcreate(const char *smb_base_fname,
                                 uint32_t *pprivate_flags);
 struct security_unix_token *copy_unix_token(TALLOC_CTX *ctx, const struct security_unix_token *tok);
 struct security_unix_token *root_unix_token(TALLOC_CTX *mem_ctx);
-char *utok_string(TALLOC_CTX *mem_ctx, const struct security_unix_token *tok);
 bool dir_check_ftype(uint32_t mode, uint32_t dirtype);
 
 /* The following definitions come from lib/util_builtin.c  */
index 95e6872ed419f2308225d58a37ef026e612bd2d1..41e18b5559169ca551acf5fa9a3ba0fd80bb70d8 100644 (file)
@@ -1791,26 +1791,6 @@ struct security_unix_token *root_unix_token(TALLOC_CTX *mem_ctx)
        return t;
 }
 
-char *utok_string(TALLOC_CTX *mem_ctx, const struct security_unix_token *tok)
-{
-       char *str;
-       uint32_t i;
-
-       str = talloc_asprintf(
-               mem_ctx,
-               "uid=%ju, gid=%ju, %"PRIu32" groups:",
-               (uintmax_t)(tok->uid),
-               (uintmax_t)(tok->gid),
-               tok->ngroups);
-
-       for (i=0; i<tok->ngroups; i++) {
-               talloc_asprintf_addbuf(
-                       &str, " %ju", (uintmax_t)tok->groups[i]);
-       }
-
-       return str;
-}
-
 /****************************************************************************
  Check that a file matches a particular file type.
 ****************************************************************************/
index 9f4035efce3287436b4999a539d9fa64060556f1..d687f97f5c80a6c94a730f1f64abf07d48d3a9ef 100644 (file)
@@ -85,6 +85,27 @@ bool set_conn_connectpath(connection_struct *conn, const char *connectpath)
        return true;
 }
 
+static char *utok_string(TALLOC_CTX *mem_ctx,
+                        const struct security_unix_token *tok)
+{
+       char *str;
+       uint32_t i;
+
+       str = talloc_asprintf(mem_ctx,
+                             "uid=%ju, gid=%ju, %" PRIu32 " groups:",
+                             (uintmax_t)(tok->uid),
+                             (uintmax_t)(tok->gid),
+                             tok->ngroups);
+
+       for (i = 0; i < tok->ngroups; i++) {
+               talloc_asprintf_addbuf(&str,
+                                      " %ju",
+                                      (uintmax_t)tok->groups[i]);
+       }
+
+       return str;
+}
+
 bool chdir_current_service(connection_struct *conn)
 {
        const struct smb_filename connectpath_fname = {