svn commit: samba r21651 - in branches/SAMBA_3_0: . source source/librpc/tools

jelmer at samba.org jelmer at samba.org
Fri Mar 2 12:54:39 GMT 2007


Author: jelmer
Date: 2007-03-02 12:54:37 +0000 (Fri, 02 Mar 2007)
New Revision: 21651

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

Log:
Add ndrdump to samba 3. This only works from external source at the 
moment. To use, use something like:

./bin/ndrdump -l bin/smbd winreg winreg_EnumValue in <filename>

or to see what functions are available:

./bin/ndrdump -l bin/smbd winreg

Modified:
   branches/SAMBA_3_0/
   branches/SAMBA_3_0/source/Makefile.in
   branches/SAMBA_3_0/source/librpc/tools/ndrdump.c


Changeset:

Property changes on: branches/SAMBA_3_0
___________________________________________________________________
Name: bzr:merge
   - jelmer at samba.org-20060718161613-53e1c111cabecd57
jelmer at samba.org-20060729112811-c224341dc6387f22
jelmer at samba.org-20060824202535-0923b9ac63b0de61
jelmer at samba.org-20060824205058-95b956f158533304
jelmer at samba.org-20060824220658-230fbfb53bdad5e7
jelmer at samba.org-20060824220942-b7a63fab1a82825e
jelmer at samba.org-20060824232016-69881278506065b0
jelmer at samba.org-20060825031555-18b374fbcabd3b04
jelmer at samba.org-20060906183058-bd444ea54d961569
jelmer at samba.org-20070116153619-w9vubayci8fujmes
jelmer at samba.org-20070116174619-tx8yabv4p50jlqp2
jelmer at samba.org-20070116182350-dq986bj4yj3m4s12
jelmer at samba.org-20070118101400-trvls9ul7o9f0j7y
jelmer at samba.org-20070206225320-l6zta3y928rbh5bk
jelmer at samba.org-20070216144754-yuizh6f7xn03o4n7
jelmer at samba.org-20070216153310-1104i8xz3sl68pup
jelmer at samba.org-20070220134145-znvxi315xp1ahxd3
jelmer at samba.org-20070227171447-yh04c17p154kpzlk
jelmer at samba.org-20070227185035-nmhiey8cbairzzxg

   + jelmer at samba.org-20060718161613-53e1c111cabecd57
jelmer at samba.org-20060729112811-c224341dc6387f22
jelmer at samba.org-20060824202535-0923b9ac63b0de61
jelmer at samba.org-20060824205058-95b956f158533304
jelmer at samba.org-20060824220658-230fbfb53bdad5e7
jelmer at samba.org-20060824220942-b7a63fab1a82825e
jelmer at samba.org-20060824232016-69881278506065b0
jelmer at samba.org-20060825031555-18b374fbcabd3b04
jelmer at samba.org-20060906183058-bd444ea54d961569
jelmer at samba.org-20070116153619-w9vubayci8fujmes
jelmer at samba.org-20070116174619-tx8yabv4p50jlqp2
jelmer at samba.org-20070116182350-dq986bj4yj3m4s12
jelmer at samba.org-20070118101400-trvls9ul7o9f0j7y
jelmer at samba.org-20070206225320-l6zta3y928rbh5bk
jelmer at samba.org-20070216144754-yuizh6f7xn03o4n7
jelmer at samba.org-20070216153310-1104i8xz3sl68pup
jelmer at samba.org-20070220134145-znvxi315xp1ahxd3
jelmer at samba.org-20070227171447-yh04c17p154kpzlk
jelmer at samba.org-20070227185035-nmhiey8cbairzzxg
jelmer at samba.org-20070302125048-0yjfn5jayr9s8y9o


Modified: branches/SAMBA_3_0/source/Makefile.in
===================================================================
--- branches/SAMBA_3_0/source/Makefile.in	2007-03-02 12:47:51 UTC (rev 21650)
+++ branches/SAMBA_3_0/source/Makefile.in	2007-03-02 12:54:37 UTC (rev 21651)
@@ -167,7 +167,7 @@
 
 EVERYTHING_PROGS = bin/debug2html at EXEEXT@ bin/smbfilter at EXEEXT@ \
 	bin/talloctort at EXEEXT@ bin/replacetort at EXEEXT@ \
-	bin/log2pcap at EXEEXT@ bin/sharesec at EXEEXT@
+	bin/log2pcap at EXEEXT@ bin/sharesec at EXEEXT@ bin/ndrdump at EXEEXT@
 
 SHLIBS = @SHLIB_PROGS@ @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ @LIBMSRPC@ @LIBADDNS@
 

Modified: branches/SAMBA_3_0/source/librpc/tools/ndrdump.c
===================================================================
--- branches/SAMBA_3_0/source/librpc/tools/ndrdump.c	2007-03-02 12:47:51 UTC (rev 21650)
+++ branches/SAMBA_3_0/source/librpc/tools/ndrdump.c	2007-03-02 12:54:37 UTC (rev 21651)
@@ -20,8 +20,13 @@
 */
 
 #include "includes.h"
+#if (_SAMBA_BUILD_ >= 4)
+#include "lib/cmdline/popt_common.h"
 #include "system/filesys.h"
 #include "system/locale.h"
+#include "librpc/rpc/dcerpc.h"
+#include "librpc/rpc/dcerpc_table.h"
+#endif
 
 static const struct dcerpc_interface_call *find_function(
 	const struct dcerpc_interface_table *p,
@@ -44,6 +49,7 @@
 	return &p->calls[i];
 }
 
+#if (_SAMBA_BUILD_ >= 4)
 
 static void show_pipes(void)
 {
@@ -60,6 +66,8 @@
 	exit(1);
 }
 
+#endif
+
 static void show_functions(const struct dcerpc_interface_table *p)
 {
 	int i;
@@ -156,7 +164,9 @@
 		{ NULL }
 	};
 
+#if (_SAMBA_BUILD_ >= 4)
 	dcerpc_table_init();
+#endif
 
 	pc = poptGetContext("ndrdump", argc, argv, long_options, 0);
 	
@@ -184,14 +194,21 @@
 
 	if (!pipe_name) {
 		poptPrintUsage(pc, stderr, 0);
+#if (_SAMBA_BUILD_ >= 4)
 		show_pipes();
+#endif
 		exit(1);
 	}
 
 	if (plugin != NULL) {
 		p = load_iface_from_plugin(plugin, pipe_name);
+	} 
+#if (_SAMBA_BUILD_ <= 3)
+	else {
+		fprintf(stderr, "Only loading from DSO's supported in Samba 3\n");
+		exit(1);
 	}
-
+#else
 	if (!p) {
 		p = idl_iface_by_name(pipe_name);
 	}
@@ -205,6 +222,7 @@
 			p = idl_iface_by_uuid(&uuid);
 		}
 	}
+#endif
 
 	if (!p) {
 		printf("Unknown pipe or UUID '%s'\n", pipe_name);
@@ -254,7 +272,11 @@
 			exit(1);
 		}
 			
+#if (_SAMBA_BUILD_ >= 4)
+		data = (uint8_t *)file_load(ctx_filename, &size, mem_ctx);
+#else
 		data = (uint8_t *)file_load(ctx_filename, &size, 0);
+#endif
 		if (!data) {
 			perror(ctx_filename);
 			exit(1);
@@ -280,7 +302,11 @@
 	} 
 
 	if (filename)
+#if (_SAMBA_BUILD_ >= 4)
+		data = (uint8_t *)file_load(filename, &size, mem_ctx);
+#else
 		data = (uint8_t *)file_load(filename, &size, 0);
+#endif
 	else
 		data = (uint8_t *)stdin_load(mem_ctx, &size);
 
@@ -304,12 +330,12 @@
 
 	if (ndr_pull->offset != ndr_pull->data_size) {
 		printf("WARNING! %d unread bytes\n", ndr_pull->data_size - ndr_pull->offset);
-		dump_data(0, (const char *)ndr_pull->data+ndr_pull->offset, ndr_pull->data_size - ndr_pull->offset);
+		dump_data(0, ndr_pull->data+ndr_pull->offset, ndr_pull->data_size - ndr_pull->offset);
 	}
 
 	if (dumpdata) {
 		printf("%d bytes consumed\n", ndr_pull->offset);
-		dump_data(0, (const char *)blob.data, blob.length);
+		dump_data(0, blob.data, blob.length);
 	}
 
 	ndr_print = talloc_zero(mem_ctx, struct ndr_print);
@@ -343,7 +369,7 @@
 
 		if (dumpdata) {
 			printf("%ld bytes generated (validate)\n", (long)v_blob.length);
-			dump_data(0, (const char *)v_blob.data, v_blob.length);
+			dump_data(0, v_blob.data, v_blob.length);
 		}
 
 		ndr_v_pull = ndr_pull_init_blob(&v_blob, mem_ctx);
@@ -359,7 +385,7 @@
 
 		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, (const char *)ndr_v_pull->data+ndr_v_pull->offset, 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);
 		}
 
 		ndr_v_print = talloc_zero(mem_ctx, struct ndr_print);



More information about the samba-cvs mailing list