summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
Diffstat (limited to 'librpc')
-rw-r--r--librpc/ndr/libndr.h1
-rw-r--r--librpc/ndr/ndr.c19
-rw-r--r--librpc/tools/ndrdump.c19
3 files changed, 27 insertions, 12 deletions
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index 6bc96cada6..06cc93a891 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -406,6 +406,7 @@ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx);
DATA_BLOB ndr_push_blob(struct ndr_push *ndr);
enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_size);
void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
+void ndr_print_printf_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr);
void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr);
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c
index 3f553a7cbc..0e16a43525 100644
--- a/librpc/ndr/ndr.c
+++ b/librpc/ndr/ndr.c
@@ -190,6 +190,25 @@ _PUBLIC_ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format,
free(s);
}
+_PUBLIC_ void ndr_print_printf_helper(struct ndr_print *ndr, const char *format, ...)
+{
+ va_list ap;
+ int i;
+
+ if (!ndr->no_newline) {
+ for (i=0;i<ndr->depth;i++) {
+ printf(" ");
+ }
+ }
+
+ va_start(ap, format);
+ vprintf(format, ap);
+ va_end(ap);
+ if (!ndr->no_newline) {
+ printf("\n");
+ }
+}
+
_PUBLIC_ void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...)
{
va_list ap;
diff --git a/librpc/tools/ndrdump.c b/librpc/tools/ndrdump.c
index 6fc903fa32..b9b4bc7fd6 100644
--- a/librpc/tools/ndrdump.c
+++ b/librpc/tools/ndrdump.c
@@ -127,13 +127,14 @@ static const struct ndr_interface_table *load_iface_from_plugin(const char *plug
return p;
}
+static void printf_cb(const char *buf, void *private_data)
+{
+ printf("%s", buf);
+}
+
static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
{
- if (force) {
- dump_data(0, d, l);
- } else {
- dump_data_skip_zeros(0, d, l);
- }
+ dump_data_cb(d, l, !force, printf_cb, NULL);
}
int main(int argc, const char *argv[])
@@ -172,10 +173,6 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
{ NULL }
};
- if (DEBUGLEVEL < 1) {
- DEBUGLEVEL = 1;
- }
-
ndr_table_init();
/* Initialise samba stuff */
@@ -183,8 +180,6 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
setlinebuf(stdout);
- dbf = x_stderr;
-
setup_logging_stdout();
pc = poptGetContext("ndrdump", argc, argv, long_options, 0);
@@ -354,7 +349,7 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
}
ndr_print = talloc_zero(mem_ctx, struct ndr_print);
- ndr_print->print = ndr_print_debug_helper;
+ ndr_print->print = ndr_print_printf_helper;
ndr_print->depth = 1;
f->ndr_print(ndr_print, function, flags, st);