[SCM] Samba Shared Repository - branch master updated -
93e52145a887b1865d41ae5272047423bbfb33b3
Jelmer Vernooij
jelmer at samba.org
Mon Oct 20 11:24:40 GMT 2008
The branch, master has been updated
via 93e52145a887b1865d41ae5272047423bbfb33b3 (commit)
via 6b82b2ff130a1217e3d4f0df645a7a7e1678b62b (commit)
via 5424c68b3d93eb3ea2f5f3ac853a85925242aa5b (commit)
via e0905c30908b4d621030689d33de28a13c04a690 (commit)
from 29838debb3d350aaee0bf9744f1a7371b8b06736 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 93e52145a887b1865d41ae5272047423bbfb33b3
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Mon Oct 20 13:24:16 2008 +0200
Provide two symbols to allow ndrdump compiled by Samba 3 to be used for
Samba 4.
commit 6b82b2ff130a1217e3d4f0df645a7a7e1678b62b
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Mon Oct 20 13:21:43 2008 +0200
Fix merged build; use full libroken rather than just a couple of object files.
commit 5424c68b3d93eb3ea2f5f3ac853a85925242aa5b
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Mon Oct 20 13:21:29 2008 +0200
Add missing asn1 object.
commit e0905c30908b4d621030689d33de28a13c04a690
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Mon Oct 20 13:19:39 2008 +0200
Use tables in Samba 3 ndrdump.
-----------------------------------------------------------------------
Summary of changes:
lib/util/debug.c | 1 +
librpc/ndr/ndr_table.c | 135 +++++++++++++++++++++++++++++++++++++
librpc/ndr/ndr_table.h | 13 ++++
librpc/tables.pl | 89 ++++++++++++++++++++++++
librpc/tools/ndrdump.c | 20 +-----
source3/Makefile.in | 12 +++-
source3/librpc/gen_ndr/tables.c | 83 +++++++++++++++++++++++
source4/heimdal_build/internal.mk | 11 +---
source4/lib/charset/util_unistr.c | 2 +-
source4/librpc/config.mk | 6 +-
source4/librpc/ndr/ndr_table.c | 134 ------------------------------------
source4/librpc/tables.pl | 89 ------------------------
12 files changed, 339 insertions(+), 256 deletions(-)
create mode 100644 librpc/ndr/ndr_table.c
create mode 100644 librpc/ndr/ndr_table.h
create mode 100644 librpc/tables.pl
create mode 100644 source3/librpc/gen_ndr/tables.c
delete mode 100644 source4/librpc/ndr/ndr_table.c
delete mode 100644 source4/librpc/tables.pl
Changeset truncated at 500 lines:
diff --git a/lib/util/debug.c b/lib/util/debug.c
index faec52a..98aabc5 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -37,6 +37,7 @@ static int debug_all_class_hack = 1;
int *DEBUGLEVEL_CLASS = &debug_all_class_hack; /* For samba 3 */
static bool debug_all_class_isset_hack = true;
bool *DEBUGLEVEL_CLASS_ISSET = &debug_all_class_isset_hack; /* For samba 3 */
+XFILE *dbf = NULL; /* For Samba 3*/
/* the registered mutex handlers */
static struct {
diff --git a/librpc/ndr/ndr_table.c b/librpc/ndr/ndr_table.c
new file mode 100644
index 0000000..f7c381f
--- /dev/null
+++ b/librpc/ndr/ndr_table.c
@@ -0,0 +1,135 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ dcerpc utility functions
+
+ Copyright (C) Andrew Tridgell 2003
+ Copyright (C) Jelmer Vernooij 2004
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "../lib/util/dlinklist.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/ndr/ndr_table.h"
+#undef strcasecmp
+
+static struct ndr_interface_list *ndr_interfaces;
+
+/*
+ register a ndr interface table
+*/
+NTSTATUS ndr_table_register(const struct ndr_interface_table *table)
+{
+ struct ndr_interface_list *l;
+
+ for (l = ndr_interfaces; l; l = l->next) {
+ if (GUID_equal(&table->syntax_id.uuid, &l->table->syntax_id.uuid)) {
+ DEBUG(0, ("Attempt to register interface %s which has the "
+ "same UUID as already registered interface %s\n",
+ table->name, l->table->name));
+ return NT_STATUS_OBJECT_NAME_COLLISION;
+ }
+ }
+
+ l = talloc(talloc_autofree_context(), struct ndr_interface_list);
+ l->table = table;
+
+ DLIST_ADD(ndr_interfaces, l);
+
+ return NT_STATUS_OK;
+}
+
+/*
+ find the pipe name for a local IDL interface
+*/
+const char *ndr_interface_name(const struct GUID *uuid, uint32_t if_version)
+{
+ const struct ndr_interface_list *l;
+ for (l=ndr_table_list();l;l=l->next) {
+ if (GUID_equal(&l->table->syntax_id.uuid, uuid) &&
+ l->table->syntax_id.if_version == if_version) {
+ return l->table->name;
+ }
+ }
+ return "UNKNOWN";
+}
+
+/*
+ find the number of calls defined by local IDL
+*/
+int ndr_interface_num_calls(const struct GUID *uuid, uint32_t if_version)
+{
+ const struct ndr_interface_list *l;
+ for (l=ndr_interfaces;l;l=l->next){
+ if (GUID_equal(&l->table->syntax_id.uuid, uuid) &&
+ l->table->syntax_id.if_version == if_version) {
+ return l->table->num_calls;
+ }
+ }
+ return -1;
+}
+
+
+/*
+ find a dcerpc interface by name
+*/
+const struct ndr_interface_table *ndr_table_by_name(const char *name)
+{
+ const struct ndr_interface_list *l;
+ for (l=ndr_interfaces;l;l=l->next) {
+ if (strcasecmp(l->table->name, name) == 0) {
+ return l->table;
+ }
+ }
+ return NULL;
+}
+
+/*
+ find a dcerpc interface by uuid
+*/
+const struct ndr_interface_table *ndr_table_by_uuid(const struct GUID *uuid)
+{
+ const struct ndr_interface_list *l;
+ for (l=ndr_interfaces;l;l=l->next) {
+ if (GUID_equal(&l->table->syntax_id.uuid, uuid)) {
+ return l->table;
+ }
+ }
+ return NULL;
+}
+
+/*
+ return the list of registered dcerpc_pipes
+*/
+const struct ndr_interface_list *ndr_table_list(void)
+{
+ return ndr_interfaces;
+}
+
+
+NTSTATUS ndr_table_register_builtin_tables(void);
+
+NTSTATUS ndr_table_init(void)
+{
+ static bool initialized = false;
+
+ if (initialized) return NT_STATUS_OK;
+ initialized = true;
+
+ ndr_table_register_builtin_tables();
+
+ return NT_STATUS_OK;
+}
diff --git a/librpc/ndr/ndr_table.h b/librpc/ndr/ndr_table.h
new file mode 100644
index 0000000..905c2e5
--- /dev/null
+++ b/librpc/ndr/ndr_table.h
@@ -0,0 +1,13 @@
+#ifndef _NDR_TABLE_PROTO_H_
+#define _NDR_TABLE_PROTO_H_
+
+NTSTATUS ndr_table_register(const struct ndr_interface_table *table);
+const char *ndr_interface_name(const struct GUID *uuid, uint32_t if_version);
+int ndr_interface_num_calls(const struct GUID *uuid, uint32_t if_version);
+const struct ndr_interface_table *ndr_table_by_name(const char *name);
+const struct ndr_interface_table *ndr_table_by_uuid(const struct GUID *uuid);
+const struct ndr_interface_list *ndr_table_list(void);
+NTSTATUS ndr_table_init(void);
+
+#endif /* _NDR_TABLE_PROTO_H_ */
+
diff --git a/librpc/tables.pl b/librpc/tables.pl
new file mode 100644
index 0000000..04764f5
--- /dev/null
+++ b/librpc/tables.pl
@@ -0,0 +1,89 @@
+#!/usr/bin/perl -w
+
+###################################################
+# package to produce a table of all idl parsers
+# Copyright tridge at samba.org 2003
+# Copyright jelmer at samba.org 2005
+# released under the GNU GPL
+
+use strict;
+
+use Getopt::Long;
+use File::Basename;
+
+my $opt_output = 'librpc/gen_ndr/tables.c';
+my $opt_help = 0;
+
+
+#########################################
+# display help text
+sub ShowHelp()
+{
+ print "
+ perl NDR interface table generator
+ Copyright (C) tridge\@samba.org
+
+ Usage: tables.pl [options] <idlfile>
+
+ \n";
+ exit(0);
+}
+
+# main program
+GetOptions (
+ 'help|h|?' => \$opt_help,
+ 'output=s' => \$opt_output,
+ );
+
+if ($opt_help) {
+ ShowHelp();
+ exit(0);
+}
+
+my $init_fns = "";
+
+###################################
+# extract table entries from 1 file
+sub process_file($)
+{
+ my $filename = shift;
+ open(FILE, $filename) || die "unable to open $filename\n";
+ my $found = 0;
+
+ while (my $line = <FILE>) {
+ if ($line =~ /extern const struct ndr_interface_table (\w+);/) {
+ $found = 1;
+ $init_fns.="\tstatus = ndr_table_register(&$1);\n";
+ $init_fns.="\tif (NT_STATUS_IS_ERR(status)) return status;\n\n";
+ }
+ }
+
+ if ($found) {
+ print "#include \"$filename\"\n";
+ }
+
+ close(FILE);
+}
+
+print <<EOF;
+
+/* Automatically generated by tables.pl. DO NOT EDIT */
+
+#include "includes.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/ndr/ndr_table.h"
+EOF
+
+process_file($_) foreach (@ARGV);
+
+print <<EOF;
+
+NTSTATUS ndr_table_register_builtin_tables(void)
+{
+ NTSTATUS status;
+
+$init_fns
+
+ return NT_STATUS_OK;
+}
+EOF
diff --git a/librpc/tools/ndrdump.c b/librpc/tools/ndrdump.c
index b24868e..3d7c644 100644
--- a/librpc/tools/ndrdump.c
+++ b/librpc/tools/ndrdump.c
@@ -19,12 +19,12 @@
*/
#include "includes.h"
-#if (_SAMBA_BUILD_ >= 4)
-#include "lib/cmdline/popt_common.h"
#include "system/filesys.h"
#include "system/locale.h"
#include "librpc/ndr/libndr.h"
#include "librpc/ndr/ndr_table.h"
+#if (_SAMBA_BUILD_ >= 4)
+#include "lib/cmdline/popt_common.h"
#include "param/param.h"
#endif
@@ -49,8 +49,6 @@ static const struct ndr_interface_call *find_function(
return &p->calls[i];
}
-#if (_SAMBA_BUILD_ >= 4)
-
_NORETURN_ static void show_pipes(void)
{
const struct ndr_interface_list *l;
@@ -66,8 +64,6 @@ _NORETURN_ static void show_pipes(void)
exit(1);
}
-#endif
-
_NORETURN_ static void show_functions(const struct ndr_interface_table *p)
{
int i;
@@ -174,9 +170,8 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
{ NULL }
};
-#if (_SAMBA_BUILD_ >= 4)
ndr_table_init();
-#else
+#if (_SAMBA_BUILD_ >= 3)
/* Initialise samba stuff */
load_case_tables();
@@ -213,21 +208,13 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
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 = ndr_table_by_name(pipe_name);
}
@@ -241,7 +228,6 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
p = ndr_table_by_uuid(&uuid);
}
}
-#endif
if (!p) {
printf("Unknown pipe or UUID '%s'\n", pipe_name);
diff --git a/source3/Makefile.in b/source3/Makefile.in
index eddcaaa..56a6401 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -984,7 +984,11 @@ REPLACETORT_OBJ = @libreplacedir@/test/testsuite.o \
NDRDUMP_OBJ = ../librpc/tools/ndrdump.o \
$(PARAM_OBJ) $(LIBNDR_GEN_OBJ) \
$(LIBSAMBA_OBJ) $(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ) \
- librpc/gen_ndr/ndr_svcctl.o
+ $(LIBNDR_DRSUAPI_OBJ) $(COMPRESSION_OBJ) \
+ librpc/gen_ndr/ndr_svcctl.o \
+ librpc/gen_ndr/tables.o ../librpc/ndr/ndr_table.o \
+ ../librpc/ndr/ndr_krb5pac.o \
+ librpc/gen_ndr/ndr_krb5pac.o libsmb/asn1.o
DEBUG2HTML_OBJ = utils/debug2html.o utils/debugparse.o
@@ -1217,6 +1221,10 @@ samba3-idl::
../librpc/idl/ntsvcs.idl librpc/idl/libnetapi.idl ../librpc/idl/drsuapi.idl \
../librpc/idl/drsblobs.idl ../librpc/idl/nbt.idl
+librpc/gen_ndr/tables.c:: librpc/gen_ndr/*.h
+ @echo "Generating $@"
+ @$(PERL) ../librpc/tables.pl $^ > $@
+
#####################################################################
@@ -1539,7 +1547,7 @@ bin/locktest2 at EXEEXT@: $(BINARY_PREREQS) $(LOCKTEST2_OBJ) @BUILD_POPT@ @LIBTALLO
bin/ndrdump at EXEEXT@: $(BINARY_PREREQS) $(NDRDUMP_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(NDRDUMP_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
- $(POPT_LIBS) $(LDAP_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
+ $(POPT_LIBS) $(LDAP_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS)
bin/debug2html at EXEEXT@: $(BINARY_PREREQS) $(DEBUG2HTML_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@
@echo Linking $@
diff --git a/source3/librpc/gen_ndr/tables.c b/source3/librpc/gen_ndr/tables.c
new file mode 100644
index 0000000..f2064d9
--- /dev/null
+++ b/source3/librpc/gen_ndr/tables.c
@@ -0,0 +1,83 @@
+
+/* Automatically generated by tables.pl. DO NOT EDIT */
+
+#include "includes.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/ndr/ndr_table.h"
+#include "librpc/gen_ndr/ndr_dfs.h"
+#include "librpc/gen_ndr/ndr_drsblobs.h"
+#include "librpc/gen_ndr/ndr_drsuapi.h"
+#include "librpc/gen_ndr/ndr_dssetup.h"
+#include "librpc/gen_ndr/ndr_echo.h"
+#include "librpc/gen_ndr/ndr_epmapper.h"
+#include "librpc/gen_ndr/ndr_eventlog.h"
+#include "librpc/gen_ndr/ndr_initshutdown.h"
+#include "librpc/gen_ndr/ndr_krb5pac.h"
+#include "librpc/gen_ndr/ndr_lsa.h"
+#include "librpc/gen_ndr/ndr_netlogon.h"
+#include "librpc/gen_ndr/ndr_ntsvcs.h"
+#include "librpc/gen_ndr/ndr_samr.h"
+#include "librpc/gen_ndr/ndr_srvsvc.h"
+#include "librpc/gen_ndr/ndr_svcctl.h"
+#include "librpc/gen_ndr/ndr_winreg.h"
+#include "librpc/gen_ndr/ndr_wkssvc.h"
+
+NTSTATUS ndr_table_register_builtin_tables(void)
+{
+ NTSTATUS status;
+
+ status = ndr_table_register(&ndr_table_netdfs);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_drsblobs);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_drsuapi);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_dssetup);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_rpcecho);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_epmapper);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_eventlog);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_initshutdown);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_krb5pac);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_lsarpc);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_netlogon);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_ntsvcs);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_samr);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_srvsvc);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_svcctl);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_winreg);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_wkssvc);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+
+
+ return NT_STATUS_OK;
+}
diff --git a/source4/heimdal_build/internal.mk b/source4/heimdal_build/internal.mk
index 7b1c9f5..85ce6d3 100644
--- a/source4/heimdal_build/internal.mk
+++ b/source4/heimdal_build/internal.mk
@@ -655,7 +655,7 @@ HEIMDAL_COM_ERR_OBJ_FILES = \
# Start BINARY asn1_compile
[BINARY::asn1_compile]
USE_HOSTCC = YES
-PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN_GETPROGNAME_H LIBREPLACE_NETWORK
+PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN LIBREPLACE_NETWORK
ASN1C = $(builddir)/bin/asn1_compile
@@ -679,11 +679,6 @@ dist:: $(heimdalsrcdir)/lib/asn1/lex.c
asn1_compile_OBJ_FILES = \
$(asn1_compile_ASN1_OBJ_FILES) \
- $(heimdalsrcdir)/lib/roken/emalloc.ho \
- $(heimdalsrcdir)/lib/roken/strupr.ho \
- $(heimdalsrcdir)/lib/roken/get_window_size.ho \
- $(heimdalsrcdir)/lib/roken/estrdup.ho \
- $(heimdalsrcdir)/lib/roken/ecalloc.ho \
$(heimdalsrcdir)/lib/vers/print_version.ho \
$(socketwrappersrcdir)/socket_wrapper.ho \
$(heimdalbuildsrcdir)/replace.ho
@@ -704,7 +699,7 @@ $(eval $(call heimdal_proto_header_template, \
# Start BINARY compile_et
[BINARY::compile_et]
USE_HOSTCC = YES
--
Samba Shared Repository
More information about the samba-cvs
mailing list