summaryrefslogtreecommitdiffstats
path: root/source4/librpc/tools/ndrdump.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-11-02 11:36:06 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:44:04 +0100
commitf05a356cbbdd4b0f3b7775338f288b2756f5fc24 (patch)
tree676910a8e5d7c678f6aac3ae446c23bb2ffaa9cc /source4/librpc/tools/ndrdump.c
parentc4b9283bbb69e7754555ce7dc21c769ca205dd08 (diff)
downloadsamba-f05a356cbbdd4b0f3b7775338f288b2756f5fc24.tar.gz
samba-f05a356cbbdd4b0f3b7775338f288b2756f5fc24.tar.xz
samba-f05a356cbbdd4b0f3b7775338f288b2756f5fc24.zip
r25800: Use dump_data_skip_zeros() in ndrdump.
Still obey the --dump-data parameter which enforces the full dump display (thanks metze). Guenther (This used to be commit c44a1d839375196fb832c64d43b7e47ea67c66b2)
Diffstat (limited to 'source4/librpc/tools/ndrdump.c')
-rw-r--r--source4/librpc/tools/ndrdump.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/source4/librpc/tools/ndrdump.c b/source4/librpc/tools/ndrdump.c
index 5a3e63ed93f..0faabdd2253 100644
--- a/source4/librpc/tools/ndrdump.c
+++ b/source4/librpc/tools/ndrdump.c
@@ -130,6 +130,15 @@ static const struct ndr_interface_table *load_iface_from_plugin(const char *plug
return p;
}
+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);
+ }
+}
+
int main(int argc, const char *argv[])
{
const struct ndr_interface_table *p = NULL;
@@ -338,12 +347,14 @@ static const struct ndr_interface_table *load_iface_from_plugin(const char *plug
if (ndr_pull->offset != ndr_pull->data_size) {
printf("WARNING! %d unread bytes\n", ndr_pull->data_size - ndr_pull->offset);
- dump_data(0, ndr_pull->data+ndr_pull->offset, ndr_pull->data_size - ndr_pull->offset);
+ ndrdump_data(ndr_pull->data+ndr_pull->offset,
+ ndr_pull->data_size - ndr_pull->offset,
+ dumpdata);
}
if (dumpdata) {
printf("%d bytes consumed\n", ndr_pull->offset);
- dump_data(0, blob.data, blob.length);
+ ndrdump_data(blob.data, blob.length, dumpdata);
}
ndr_print = talloc_zero(mem_ctx, struct ndr_print);
@@ -377,7 +388,7 @@ static const struct ndr_interface_table *load_iface_from_plugin(const char *plug
if (dumpdata) {
printf("%ld bytes generated (validate)\n", (long)v_blob.length);
- dump_data(0, v_blob.data, v_blob.length);
+ ndrdump_data(v_blob.data, v_blob.length, dumpdata);
}
ndr_v_pull = ndr_pull_init_blob(&v_blob, mem_ctx);
@@ -393,7 +404,9 @@ static const struct ndr_interface_table *load_iface_from_plugin(const char *plug
if (ndr_v_pull->offset != ndr_v_pull->data_size) {
printf("WARNING! %d unread bytes in validation\n", ndr_v_pull->data_size - ndr_v_pull->offset);
- dump_data(0, ndr_v_pull->data+ndr_v_pull->offset, ndr_v_pull->data_size - ndr_v_pull->offset);
+ ndrdump_data(ndr_v_pull->data+ndr_v_pull->offset,
+ ndr_v_pull->data_size - ndr_v_pull->offset,
+ dumpdata);
}
ndr_v_print = talloc_zero(mem_ctx, struct ndr_print);