]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
librpc: Make NDR_PRINT_DEBUG call just one DEBUG
authorVolker Lendecke <vl@samba.org>
Mon, 17 Jun 2024 12:42:30 +0000 (14:42 +0200)
committerRalph Boehme <slow@samba.org>
Fri, 28 Jun 2024 13:26:24 +0000 (13:26 +0000)
Give debug.c the chance to use just one write call (right now it
doesn't yet)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
librpc/ndr/ndr.c

index 1478faa466f468e4b8e967ef7beca35a9ffdf549..1eaa278d8205fc769d0c2e8b905f8dc59d3272bf 100644 (file)
@@ -439,12 +439,15 @@ _PUBLIC_ bool ndr_print_debug(int level,
                              const char *function)
 {
        struct ndr_print *ndr;
-
-       DEBUGLF(level, (" "), location, function);
+       bool ret = false;
 
        ndr = talloc_zero(NULL, struct ndr_print);
        if (!ndr) return false;
-       ndr->print = ndr_print_debug_helper;
+       ndr->private_data = talloc_strdup(ndr, "");
+       if (ndr->private_data == NULL) {
+               goto fail;
+       }
+       ndr->print = ndr_print_string_helper;
        ndr->depth = 1;
        ndr->flags = 0;
 #ifdef DEBUG_PASSWORD
@@ -454,8 +457,12 @@ _PUBLIC_ bool ndr_print_debug(int level,
 #endif
 
        fn(ndr, name, ptr);
+       DEBUGLF(level, (" %s", (char *)ndr->private_data), location, function);
+
+       ret = true;
+fail:
        talloc_free(ndr);
-       return true;
+       return ret;
 }
 
 /*