From: Volker Lendecke Date: Sun, 9 Nov 2025 09:47:02 +0000 (+0100) Subject: smbd: Move utok_string() into smbd X-Git-Tag: tdb-1.4.15~160 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f83c3e04f19c6ab2c3cf894e5223df090fe6dae6;p=thirdparty%2Fsamba.git smbd: Move utok_string() into smbd Only used in chdir_current_service() Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/source3/include/proto.h b/source3/include/proto.h index 8f4f500ded5..279fcee0c48 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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 */ diff --git a/source3/lib/util.c b/source3/lib/util.c index 95e6872ed41..41e18b55591 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -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; ingroups; i++) { - talloc_asprintf_addbuf( - &str, " %ju", (uintmax_t)tok->groups[i]); - } - - return str; -} - /**************************************************************************** Check that a file matches a particular file type. ****************************************************************************/ diff --git a/source3/smbd/smb2_service.c b/source3/smbd/smb2_service.c index 9f4035efce3..d687f97f5c8 100644 --- a/source3/smbd/smb2_service.c +++ b/source3/smbd/smb2_service.c @@ -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 = {