svn commit: samba r21334 - in branches/SAMBA_4_0/source/utils: .

metze at samba.org metze at samba.org
Wed Feb 14 13:24:38 GMT 2007


Author: metze
Date: 2007-02-14 13:24:37 +0000 (Wed, 14 Feb 2007)
New Revision: 21334

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21334

Log:
compare the original buffer and the validated one byte by byte
and print out the first mismatch

metze
Modified:
   branches/SAMBA_4_0/source/utils/ndrdump.c


Changeset:
Modified: branches/SAMBA_4_0/source/utils/ndrdump.c
===================================================================
--- branches/SAMBA_4_0/source/utils/ndrdump.c	2007-02-14 13:22:09 UTC (rev 21333)
+++ branches/SAMBA_4_0/source/utils/ndrdump.c	2007-02-14 13:24:37 UTC (rev 21334)
@@ -329,6 +329,9 @@
 		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,12 +370,37 @@
 		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);
+		}
 	}
 
 	printf("dump OK\n");



More information about the samba-cvs mailing list