summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-28 00:48:05 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-28 00:48:05 +0000
commitdf5949efb425668f8e7ae38c0c858bd90529255a (patch)
tree6fc93659cff35e9a4a9a433d0a7cc4eb5e383f42
parentabff8aac56b2481de2223bf43ae2098cc7ab2391 (diff)
downloadsamba-df5949efb425668f8e7ae38c0c858bd90529255a.tar.gz
samba-df5949efb425668f8e7ae38c0c858bd90529255a.tar.bz2
samba-df5949efb425668f8e7ae38c0c858bd90529255a.zip
added auto-generation of the IDL interface tables. This makes two less
places that need to be edited when someone adds a new IDL file. (This used to be commit ccd9ddeed679baa6cbb05ac728b381b50420e00f)
-rw-r--r--source4/Makefile.in4
-rwxr-xr-xsource4/build/pidl/pidl.pl2
-rwxr-xr-xsource4/build/pidl/tables.pl97
-rw-r--r--source4/librpc/ndr/libndr.h23
-rw-r--r--source4/librpc/ndr/ndr.c20
-rwxr-xr-xsource4/script/build_idl.sh4
-rw-r--r--source4/torture/torture.c4
7 files changed, 111 insertions, 43 deletions
diff --git a/source4/Makefile.in b/source4/Makefile.in
index e631668e09..d9124e80c3 100644
--- a/source4/Makefile.in
+++ b/source4/Makefile.in
@@ -190,7 +190,7 @@ LIBCLIUTIL_OBJ = libcli/util/asn1.o \
LIBRAW_NDR_OBJ = librpc/ndr/ndr.o librpc/ndr/ndr_basic.o librpc/ndr/ndr_sec.o \
librpc/ndr/ndr_spoolss_buf.o \
- librpc/gen_ndr/ndr_dcerpc.o \
+ librpc/gen_ndr/tables.o librpc/gen_ndr/ndr_dcerpc.o \
librpc/gen_ndr/ndr_echo.o librpc/gen_ndr/ndr_misc.o \
librpc/gen_ndr/ndr_lsa.o librpc/gen_ndr/ndr_dfs.o \
librpc/gen_ndr/ndr_samr.o librpc/gen_ndr/ndr_spoolss.o \
@@ -645,7 +645,7 @@ MAKEDIR = || exec false; \
@BROKEN_CC@ -mv `echo $@ | sed 's%^.*/%%g'` $@
# 'make pch' is extremely useful for fast compiles if you have gcc-3.4
-pch:
+pch: basics
rm -f $(srcdir)/include/includes.h.gch
$(CC) -I. -I$(srcdir) $(FLAGS) -c $(srcdir)/include/includes.h -o $(srcdir)/include/includes.h.gch
diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl
index b8802ebe23..edeab1564e 100755
--- a/source4/build/pidl/pidl.pl
+++ b/source4/build/pidl/pidl.pl
@@ -3,7 +3,7 @@
###################################################
# package to parse IDL files and generate code for
# rpc functions in Samba
-# Copyright tridge@samba.org 2000
+# Copyright tridge@samba.org 2000-2003
# released under the GNU GPL
use strict;
diff --git a/source4/build/pidl/tables.pl b/source4/build/pidl/tables.pl
new file mode 100755
index 0000000000..fa53af1c09
--- /dev/null
+++ b/source4/build/pidl/tables.pl
@@ -0,0 +1,97 @@
+#!/usr/bin/perl -w
+
+###################################################
+# package to produce a table of all idl parsers
+# Copyright tridge@samba.org 2003
+# released under the GNU GPL
+
+use strict;
+
+use Getopt::Long;
+use File::Basename;
+
+my($opt_output);
+my($opt_help) = 0;
+
+
+#########################################
+# display help text
+sub ShowHelp()
+{
+ print "
+ perl IDL table generator
+ Copyright (C) tridge\@samba.org
+
+ Usage: tables.pl [options] <idlfile>
+
+ Options:
+ --output OUTNAME put output in OUTNAME.*
+ \n";
+ exit(0);
+}
+
+# main program
+GetOptions (
+ 'help|h|?' => \$opt_help,
+ 'output=s' => \$opt_output,
+ );
+
+if ($opt_help) {
+ ShowHelp();
+ exit(0);
+}
+
+
+###################################
+# extract table entries from 1 file
+sub process_file($)
+{
+ my $filename = shift;
+ open(FILE, $filename) || die "unable to open $filename\n";
+
+ print TABLEH "#include \"$filename\"\n";
+
+ while (my $line = <FILE>) {
+ if ($line =~ /extern const struct dcerpc_interface_table (\w+);/) {
+ print TABLEC "\t&$1,\n";
+ }
+ }
+
+ close(FILE);
+}
+
+
+open(TABLEH, ">$opt_output.h") || die "failed to open $opt_output.h\n";
+open(TABLEC, ">$opt_output.c") || die "failed to open $opt_output.c\n";
+
+#include "includes.h"
+
+#define NDR_BASE_MARSHALL_SIZE 1024
+
+print TABLEC "
+#include \"includes.h\"
+
+/*
+ generated by pidl IDL table generator
+*/
+const struct dcerpc_interface_table *dcerpc_pipes[] = {
+";
+
+print TABLEH "
+/*
+ table headers generated by pidl IDL table generator
+*/
+
+extern const struct dcerpc_interface_table *dcerpc_pipes[];
+
+";
+
+foreach my $filename (@ARGV) {
+ process_file($filename);
+}
+
+
+print TABLEC "\tNULL\n};\n";
+
+close(TABLEH);
+close(TABLEC);
diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h
index 42238fd17b..8440e9c1a0 100644
--- a/source4/librpc/ndr/libndr.h
+++ b/source4/librpc/ndr/libndr.h
@@ -231,25 +231,8 @@ typedef void (*ndr_print_fn_t)(struct ndr_print *, const char *, void *);
typedef void (*ndr_print_function_t)(struct ndr_print *, const char *, int, void *);
typedef void (*ndr_print_union_fn_t)(struct ndr_print *, const char *, uint32, void *);
-/* now pull in the individual parsers */
#include "librpc/ndr/ndr_basic.h"
#include "librpc/ndr/ndr_sec.h"
-#include "librpc/gen_ndr/ndr_dcerpc.h"
-#include "librpc/gen_ndr/ndr_misc.h"
-#include "librpc/gen_ndr/ndr_echo.h"
-#include "librpc/gen_ndr/ndr_lsa.h"
-#include "librpc/gen_ndr/ndr_dfs.h"
-#include "librpc/gen_ndr/ndr_spoolss.h"
-#include "librpc/gen_ndr/ndr_samr.h"
-#include "librpc/gen_ndr/ndr_wkssvc.h"
-#include "librpc/gen_ndr/ndr_srvsvc.h"
-#include "librpc/gen_ndr/ndr_atsvc.h"
-#include "librpc/gen_ndr/ndr_eventlog.h"
-#include "librpc/gen_ndr/ndr_epmapper.h"
-#include "librpc/gen_ndr/ndr_winreg.h"
-#include "librpc/gen_ndr/ndr_mgmt.h"
-
-/* this can be used to loop over all pipes - please extend the table
- in librpc/ndr/ndr.c
-*/
-extern const struct dcerpc_interface_table *dcerpc_pipes[];
+
+/* now pull in the individual parsers */
+#include "librpc/gen_ndr/tables.h"
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index 9915ba4212..3f6d968cd2 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -32,26 +32,6 @@
#define NDR_BASE_MARSHALL_SIZE 1024
/*
- only include interfaces that contain callable dcerpc functions here
-*/
-const struct dcerpc_interface_table *dcerpc_pipes[] = {
- &dcerpc_table_samr,
- &dcerpc_table_lsarpc,
- &dcerpc_table_netdfs,
- &dcerpc_table_atsvc,
- &dcerpc_table_rpcecho,
- &dcerpc_table_epmapper,
- &dcerpc_table_eventlog,
- &dcerpc_table_spoolss,
- &dcerpc_table_srvsvc,
- &dcerpc_table_winreg,
- &dcerpc_table_wkssvc,
- &dcerpc_table_mgmt,
- NULL
-};
-
-
-/*
work out the number of bytes needed to align on a n byte boundary
*/
size_t ndr_align_size(uint32 offset, size_t n)
diff --git a/source4/script/build_idl.sh b/source4/script/build_idl.sh
index 9ad9391ee0..b31d26c23d 100755
--- a/source4/script/build_idl.sh
+++ b/source4/script/build_idl.sh
@@ -8,10 +8,14 @@ FULLBUILD=$1
( cd build/pidl && make ) || exit 1
PIDL="build/pidl/pidl.pl --output librpc/gen_ndr/ndr_ --parse --header --parser --client librpc/gen_rpc/rpc_"
+TABLES="build/pidl/tables.pl --output librpc/gen_ndr/tables"
if [ x$FULLBUILD = xFULL ]; then
echo Rebuilding all idl files in librpc/idl
$PIDL librpc/idl/*.idl || exit 1
+
+ echo Rebuilding IDL tables
+ $TABLES librpc/gen_ndr/ndr_*.h
exit 0
fi
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 9bc494df7f..0a15620174 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -165,6 +165,9 @@ static NTSTATUS torture_rpc_tcp(struct dcerpc_pipe **p,
/* always do NDR validation in smbtorture */
(*p)->flags |= DCERPC_DEBUG_VALIDATE_BOTH;
+#if 0
+ status = dcerpc_bind_auth_none(*p, pipe_uuid, pipe_version);
+#else
/* enable signing on tcp connections */
(*p)->flags |= DCERPC_SIGN;
@@ -177,6 +180,7 @@ static NTSTATUS torture_rpc_tcp(struct dcerpc_pipe **p,
dcerpc_pipe_close(*p);
return status;
}
+#endif
return status;
}