From: Stefan Metzmacher Date: Mon, 7 Nov 2022 16:15:32 +0000 (+0100) Subject: s4:messaging: add irpc_bh_do_ndr_print() in order to debug irpc calls X-Git-Tag: talloc-2.4.0~488 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73ec7253139cf4704135ec7abfa6a669e158fddc;p=thirdparty%2Fsamba.git s4:messaging: add irpc_bh_do_ndr_print() in order to debug irpc calls BUG: https://bugzilla.samba.org/show_bug.cgi?id=15253 Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 8603c167ad4..3705ffc5bef 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -1391,6 +1391,38 @@ static bool irpc_bh_ref_alloc(struct dcerpc_binding_handle *h) return true; } +static void irpc_bh_do_ndr_print(struct dcerpc_binding_handle *h, + int ndr_flags, + const void *_struct_ptr, + const struct ndr_interface_call *call) +{ + void *struct_ptr = discard_const(_struct_ptr); + bool print_in = false; + bool print_out = false; + + if (DEBUGLEVEL >= 11) { + print_in = true; + print_out = true; + } + + if (ndr_flags & NDR_IN) { + if (print_in) { + ndr_print_function_debug(call->ndr_print, + call->name, + ndr_flags, + struct_ptr); + } + } + if (ndr_flags & NDR_OUT) { + if (print_out) { + ndr_print_function_debug(call->ndr_print, + call->name, + ndr_flags, + struct_ptr); + } + } +} + static const struct dcerpc_binding_handle_ops irpc_bh_ops = { .name = "wbint", .is_connected = irpc_bh_is_connected, @@ -1401,6 +1433,7 @@ static const struct dcerpc_binding_handle_ops irpc_bh_ops = { .disconnect_recv = irpc_bh_disconnect_recv, .ref_alloc = irpc_bh_ref_alloc, + .do_ndr_print = irpc_bh_do_ndr_print, }; /* initialise a irpc binding handle */