summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr/ndr.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/librpc/ndr/ndr.c')
-rw-r--r--source4/librpc/ndr/ndr.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index 6d2a6a99dd..0d40b32835 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -325,7 +325,7 @@ void ndr_print_union_debug(void (*fn)(struct ndr_print *, const char *, uint16,
{
struct ndr_print ndr;
- ndr.mem_ctx = talloc_init("ndr_print_debug");
+ ndr.mem_ctx = talloc_init("ndr_print_union");
if (!ndr.mem_ctx) return;
ndr.print = ndr_print_debug_helper;
ndr.depth = 1;
@@ -334,6 +334,24 @@ void ndr_print_union_debug(void (*fn)(struct ndr_print *, const char *, uint16,
}
/*
+ a useful helper function for printing idl function calls via DEBUG()
+*/
+void ndr_print_function_debug(void (*fn)(struct ndr_print *, const char *, int , void *),
+ const char *name,
+ int flags,
+ void *ptr)
+{
+ struct ndr_print ndr;
+
+ ndr.mem_ctx = talloc_init("ndr_print_function");
+ if (!ndr.mem_ctx) return;
+ ndr.print = ndr_print_debug_helper;
+ ndr.depth = 1;
+ fn(&ndr, name, flags, ptr);
+ talloc_destroy(ndr.mem_ctx);
+}
+
+/*
return and possibly log an NDR error
*/
NTSTATUS ndr_pull_error(struct ndr_pull *ndr, enum ndr_err_code err, const char *format, ...)