summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-02-14 13:24:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:14 -0500
commit6496fab3b6a6bd6b53d8c4c9b4151c6d81dd2f85 (patch)
tree0ac866019fe29bc3a2786b2b77353bb21fd2fac7 /source4
parent76a1ecccc5321ce45f171078cbd38e5b165be08b (diff)
downloadsamba-6496fab3b6a6bd6b53d8c4c9b4151c6d81dd2f85.tar.gz
samba-6496fab3b6a6bd6b53d8c4c9b4151c6d81dd2f85.tar.bz2
samba-6496fab3b6a6bd6b53d8c4c9b4151c6d81dd2f85.zip
r21334: compare the original buffer and the validated one byte by byte
and print out the first mismatch metze (This used to be commit 6ac574660a0656341d7a311738d20b328f31ff78)
Diffstat (limited to 'source4')
-rw-r--r--source4/utils/ndrdump.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/source4/utils/ndrdump.c b/source4/utils/ndrdump.c
index 9e224c8137..affdc60b4a 100644
--- a/source4/utils/ndrdump.c
+++ b/source4/utils/ndrdump.c
@@ -329,6 +329,9 @@ const struct dcerpc_interface_table *load_iface_from_plugin(const char *plugin,
struct ndr_push *ndr_v_push;
struct ndr_pull *ndr_v_pull;
struct ndr_print *ndr_v_print;
+ uint32_t i;
+ uint8_t byte_a, byte_b;
+ bool differ;
ndr_v_push = ndr_push_init_ctx(mem_ctx);
@@ -367,11 +370,36 @@ const struct dcerpc_interface_table *load_iface_from_plugin(const char *plugin,
f->ndr_print(ndr_v_print, function, flags, v_st);
if (blob.length != v_blob.length) {
- printf("WARNING! orig bytes:%ld validated pushed bytes:%ld\n", (long)blob.length, (long)v_blob.length);
+ printf("WARNING! orig bytes:%u validated pushed bytes:%u\n", blob.length, v_blob.length);
}
if (ndr_pull->offset != ndr_v_pull->offset) {
- printf("WARNING! orig pulled bytes:%d validated pulled bytes:%d\n", ndr_pull->offset, ndr_v_pull->offset);
+ printf("WARNING! orig pulled bytes:%u validated pulled bytes:%u\n", ndr_pull->offset, ndr_v_pull->offset);
+ }
+
+ differ = false;
+ byte_a = 0x00;
+ byte_b = 0x00;
+ for (i=0; i < blob.length; i++) {
+ byte_a = blob.data[i];
+
+ if (i == v_blob.length) {
+ byte_b = 0x00;
+ differ = true;
+ break;
+ }
+
+ byte_b = v_blob.data[i];
+
+ if (byte_a != byte_b) {
+ differ = true;
+ break;
+ }
+ }
+ if (differ) {
+ printf("WARNING! orig and validated differ at byte 0x%02X (%u)\n", i, i);
+ printf("WARNING! orig byte[0x%02X] = 0x%02X validated byte[0x%02X] = 0x%02X\n",
+ i, byte_a, i, byte_b);
}
}