]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: avoid work in unix token debug no-op
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 20 Feb 2025 21:51:33 +0000 (10:51 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Thu, 27 Feb 2025 00:02:38 +0000 (00:02 +0000)
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 <vl@samba.org>
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Pair-programmed-with: Volker Lendecke <vl@samba.org>

source3/auth/token_util.c

index 023ad7cbb028a026666c52eba148f0d2f5c34565..4dd8036616be65cf68e28bb0225352389be2883d 100644 (file)
@@ -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);