summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-03-02 12:47:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:49:04 -0500
commit678c401d3ed6f480e237e519aa9aeeaa12b0ab52 (patch)
treea800f3da32b4706e184ecb00e3120b94ced5a119
parentb9df742fb4499563a7fc456f29039e1de9198d1e (diff)
downloadsamba-678c401d3ed6f480e237e519aa9aeeaa12b0ab52.tar.gz
samba-678c401d3ed6f480e237e519aa9aeeaa12b0ab52.tar.bz2
samba-678c401d3ed6f480e237e519aa9aeeaa12b0ab52.zip
r21650: Update ndrdump to work in samba3
(This used to be commit 10295d9bdd035c008fa7dafef0426c1e86250ac9)
-rw-r--r--source4/librpc/tools/ndrdump.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/source4/librpc/tools/ndrdump.c b/source4/librpc/tools/ndrdump.c
index 205d094fe7..7fc3e57ff3 100644
--- a/source4/librpc/tools/ndrdump.c
+++ b/source4/librpc/tools/ndrdump.c
@@ -20,11 +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,
@@ -47,6 +49,7 @@ static const struct dcerpc_interface_call *find_function(
return &p->calls[i];
}
+#if (_SAMBA_BUILD_ >= 4)
static void show_pipes(void)
{
@@ -63,6 +66,8 @@ static void show_pipes(void)
exit(1);
}
+#endif
+
static void show_functions(const struct dcerpc_interface_table *p)
{
int i;
@@ -159,7 +164,9 @@ const struct dcerpc_interface_table *load_iface_from_plugin(const char *plugin,
{ NULL }
};
+#if (_SAMBA_BUILD_ >= 4)
dcerpc_table_init();
+#endif
pc = poptGetContext("ndrdump", argc, argv, long_options, 0);
@@ -187,14 +194,21 @@ const struct dcerpc_interface_table *load_iface_from_plugin(const char *plugin,
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);
}
@@ -208,6 +222,7 @@ const struct dcerpc_interface_table *load_iface_from_plugin(const char *plugin,
p = idl_iface_by_uuid(&uuid);
}
}
+#endif
if (!p) {
printf("Unknown pipe or UUID '%s'\n", pipe_name);
@@ -257,7 +272,11 @@ const struct dcerpc_interface_table *load_iface_from_plugin(const char *plugin,
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);
@@ -283,7 +302,11 @@ const struct dcerpc_interface_table *load_iface_from_plugin(const char *plugin,
}
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);