From a32f52e573561900cbed097c453b5240df3b0ae5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 17 Jun 2024 14:42:30 +0200 Subject: [PATCH] librpc: Make NDR_PRINT_DEBUG call just one DEBUG Give debug.c the chance to use just one write call (right now it doesn't yet) Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- librpc/ndr/ndr.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c index 1478faa466f..1eaa278d820 100644 --- a/librpc/ndr/ndr.c +++ b/librpc/ndr/ndr.c @@ -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; } /* -- 2.47.3