From: Douglas Bagnall Date: Thu, 20 Feb 2025 21:51:33 +0000 (+1300) Subject: smbd: avoid work in unix token debug no-op X-Git-Tag: tevent-0.17.0~615 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c3bdb07472be7f499430834e7ed24b988185e96;p=thirdparty%2Fsamba.git smbd: avoid work in unix token debug no-op When the debug level is too low to print, we don't need to allocate the strings. Bug: https://bugzilla.samba.org/show_bug.cgi?id=15737 Signed-off-by: Volker Lendecke Signed-off-by: Douglas Bagnall Reviewed-by: Jennifer Sutton Pair-programmed-with: Volker Lendecke --- diff --git a/source3/auth/token_util.c b/source3/auth/token_util.c index 023ad7cbb02..4dd8036616b 100644 --- a/source3/auth/token_util.c +++ b/source3/auth/token_util.c @@ -888,10 +888,16 @@ NTSTATUS finalize_local_nt_token(struct security_token *result, void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid, int n_groups, gid_t *groups) { - TALLOC_CTX *frame = talloc_stackframe(); + TALLOC_CTX *frame = NULL; char *s = NULL; int i; + if (!CHECK_DEBUGLVLC(dbg_class, dbg_lev)) { + return; + } + + frame = talloc_stackframe(); + s = talloc_asprintf(frame, "UNIX token of user %ld\n", (long int)uid);