diff options
-rw-r--r-- | source4/librpc/config.mk | 64 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.c | 26 | ||||
-rw-r--r-- | source4/librpc/rpc/table.c | 28 | ||||
-rw-r--r-- | source4/librpc/tables.pl | 91 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl.pm | 2 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 35 |
6 files changed, 140 insertions, 106 deletions
diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index 421a5866d3..556ff2ca13 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -29,42 +29,46 @@ REQUIRED_SUBSYSTEMS = LIBCOMPRESSION include rpc/config.mk [SUBSYSTEM::NDR_AUDIOSRV] -INIT_FUNCTION = dcerpc_audiosrv_init OBJ_FILES = gen_ndr/ndr_audiosrv.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR +[SUBSYSTEM::NDR_DNSSERVER] +OBJ_FILES = gen_ndr/ndr_dnsserver.o +NOPROTO = YES +REQUIRED_SUBSYSTEMS = LIBNDR + +[SUBSYSTEM::NDR_WINSTATION] +OBJ_FILES = gen_ndr/ndr_winstation.o +NOPROTO = YES +REQUIRED_SUBSYSTEMS = LIBNDR + [SUBSYSTEM::NDR_DCERPC] OBJ_FILES = gen_ndr/ndr_dcerpc.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_ECHO] -INIT_FUNCTION = dcerpc_echo_init OBJ_FILES = gen_ndr/ndr_echo.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_IRPC] -INIT_FUNCTION = dcerpc_irpc_init OBJ_FILES = gen_ndr/ndr_irpc.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_EXCHANGE] -INIT_FUNCTION = dcerpc_exchange_init OBJ_FILES = gen_ndr/ndr_exchange.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_DSBACKUP] -INIT_FUNCTION = dcerpc_dsbackup_init OBJ_FILES = gen_ndr/ndr_dsbackup.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_EFS] -INIT_FUNCTION = dcerpc_efs_init OBJ_FILES = gen_ndr/ndr_efs.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR @@ -75,25 +79,21 @@ NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_ROT] -INIT_FUNCTION = dcerpc_rot_init OBJ_FILES = gen_ndr/ndr_rot.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_LSA] -INIT_FUNCTION = dcerpc_lsa_init OBJ_FILES = gen_ndr/ndr_lsa.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_DFS] -INIT_FUNCTION = dcerpc_dfs_init OBJ_FILES = gen_ndr/ndr_dfs.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_DRSUAPI] -INIT_FUNCTION = dcerpc_drsuapi_init OBJ_FILES = gen_ndr/ndr_drsuapi.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR NDR_DRSUAPI_PRINT NDR_COMPRESSION @@ -102,31 +102,26 @@ REQUIRED_SUBSYSTEMS = LIBNDR NDR_DRSUAPI_PRINT NDR_COMPRESSION OBJ_FILES = ndr/ndr_drsuapi.o [SUBSYSTEM::NDR_DRSBLOBS] -INIT_FUNCTION = dcerpc_drsblobs_init OBJ_FILES = gen_ndr/ndr_drsblobs.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_POLICYAGENT] -INIT_FUNCTION = dcerpc_policyagent_init OBJ_FILES = gen_ndr/ndr_policyagent.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_UNIXINFO] -INIT_FUNCTION = dcerpc_unixinfo_init OBJ_FILES = gen_ndr/ndr_unixinfo.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_SAMR] -INIT_FUNCTION = dcerpc_samr_init OBJ_FILES = gen_ndr/ndr_samr.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_SPOOLSS] -INIT_FUNCTION = dcerpc_spoolss_init OBJ_FILES = gen_ndr/ndr_spoolss.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR NDR_SPOOLSS_BUF @@ -135,91 +130,76 @@ REQUIRED_SUBSYSTEMS = LIBNDR NDR_SPOOLSS_BUF OBJ_FILES = ndr/ndr_spoolss_buf.o [SUBSYSTEM::NDR_WKSSVC] -INIT_FUNCTION = dcerpc_wkssvc_init OBJ_FILES = gen_ndr/ndr_wkssvc.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_SRVSVC] -INIT_FUNCTION = dcerpc_srvsvc_init OBJ_FILES = gen_ndr/ndr_srvsvc.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR NDR_SVCCTL [SUBSYSTEM::NDR_SVCCTL] -INIT_FUNCTION = dcerpc_svcctl_init OBJ_FILES = gen_ndr/ndr_svcctl.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_ATSVC] -INIT_FUNCTION = dcerpc_atsvc_init OBJ_FILES = gen_ndr/ndr_atsvc.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_EVENTLOG] -INIT_FUNCTION = dcerpc_eventlog_init OBJ_FILES = gen_ndr/ndr_eventlog.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_EPMAPPER] -INIT_FUNCTION = dcerpc_epmapper_init OBJ_FILES = gen_ndr/ndr_epmapper.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_DBGIDL] -INIT_FUNCTION = dcerpc_dbgidl_init OBJ_FILES = gen_ndr/ndr_dbgidl.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_DSSETUP] -INIT_FUNCTION = dcerpc_dssetup_init OBJ_FILES = gen_ndr/ndr_dssetup.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_MSGSVC] -INIT_FUNCTION = dcerpc_msgsvc_init OBJ_FILES = gen_ndr/ndr_msgsvc.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_WINS] -INIT_FUNCTION = dcerpc_wins_init OBJ_FILES = gen_ndr/ndr_wins.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_WINREG] -INIT_FUNCTION = dcerpc_winreg_init OBJ_FILES = gen_ndr/ndr_winreg.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR NDR_INITSHUTDOWN [SUBSYSTEM::NDR_INITSHUTDOWN] -INIT_FUNCTION = dcerpc_initshutdown_init OBJ_FILES = gen_ndr/ndr_initshutdown.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_MGMT] -INIT_FUNCTION = dcerpc_mgmt_init OBJ_FILES = gen_ndr/ndr_mgmt.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_PROTECTED_STORAGE] -INIT_FUNCTION = dcerpc_protected_storage_init OBJ_FILES = gen_ndr/ndr_protected_storage.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_DCOM] -INIT_FUNCTION = dcerpc_dcom_init OBJ_FILES = gen_ndr/ndr_dcom.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR NDR_ORPC @@ -233,61 +213,51 @@ NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR NDR_ORPC_MANUAL [SUBSYSTEM::NDR_OXIDRESOLVER] -INIT_FUNCTION = dcerpc_oxidresolver_init OBJ_FILES = gen_ndr/ndr_oxidresolver.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR NDR_ORPC [SUBSYSTEM::NDR_REMACT] -INIT_FUNCTION = dcerpc_remact_init OBJ_FILES = gen_ndr/ndr_remact.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR NDR_ORPC [SUBSYSTEM::NDR_WZCSVC] -INIT_FUNCTION = dcerpc_wzcsvc_init OBJ_FILES = gen_ndr/ndr_wzcsvc.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_BROWSER] -INIT_FUNCTION = dcerpc_browser_init OBJ_FILES = gen_ndr/ndr_browser.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_W32TIME] -INIT_FUNCTION = dcerpc_w32time_init OBJ_FILES = gen_ndr/ndr_w32time.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_SCERPC] -INIT_FUNCTION = dcerpc_scerpc_init OBJ_FILES = gen_ndr/ndr_scerpc.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_NTSVCS] -INIT_FUNCTION = dcerpc_ntsvcs_init OBJ_FILES = gen_ndr/ndr_ntsvcs.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_NETLOGON] -INIT_FUNCTION = dcerpc_netlogon_init OBJ_FILES = gen_ndr/ndr_netlogon.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR NDR_SAMR [SUBSYSTEM::NDR_TRKWKS] -INIT_FUNCTION = dcerpc_trkwks_init OBJ_FILES = gen_ndr/ndr_trkwks.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_KEYSVC] -INIT_FUNCTION = dcerpc_keysvc_init OBJ_FILES = gen_ndr/ndr_keysvc.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR @@ -320,10 +290,18 @@ OBJ_FILES = gen_ndr/ndr_winsrepl.o NOPROTO = YES REQUIRED_SUBSYSTEMS = LIBNDR NDR_NBT +librpc/gen_ndr/tables.c: librpc/gen_ndr/ndr_*.h + @$(PERL) librpc/tables.pl --output=librpc/gen_ndr/tables.c \ + librpc/gen_ndr/ndr_*.h + +[SUBSYSTEM::NDR_IFACE_TABLE] +NOPROTO = YES +OBJ_FILES = gen_ndr/tables.o [SUBSYSTEM::NDR_ALL] -OBJ_FILES = rpc/table.o -REQUIRED_SUBSYSTEMS = NDR_AUDIOSRV NDR_ECHO NDR_DCERPC NDR_EXCHANGE \ +INIT_FUNCTION = dcerpc_table_init +OBJ_FILES = rpc/table.o +REQUIRED_SUBSYSTEMS = NDR_IFACE_TABLE NDR_AUDIOSRV NDR_ECHO NDR_DCERPC NDR_EXCHANGE \ NDR_DSBACKUP NDR_EFS NDR_MISC NDR_LSA NDR_DFS NDR_DRSUAPI \ NDR_POLICYAGENT NDR_UNIXINFO NDR_SAMR NDR_SPOOLSS NDR_WKSSVC NDR_SRVSVC NDR_ATSVC \ NDR_EVENTLOG NDR_EPMAPPER NDR_DBGIDL NDR_DSSETUP NDR_MSGSVC NDR_WINS \ @@ -331,7 +309,7 @@ REQUIRED_SUBSYSTEMS = NDR_AUDIOSRV NDR_ECHO NDR_DCERPC NDR_EXCHANGE \ NDR_REMACT NDR_WZCSVC NDR_BROWSER NDR_W32TIME NDR_SCERPC NDR_NTSVCS \ NDR_NETLOGON NDR_TRKWKS NDR_KEYSVC NDR_KRB5PAC NDR_XATTR NDR_SCHANNEL \ NDR_ROT NDR_DRSBLOBS NDR_SVCCTL NDR_NBT NDR_WINSREPL LIB_SECURITY_NDR \ - NDR_INITSHUTDOWN + NDR_INITSHUTDOWN NDR_DNSSERVER NDR_WINSTATION NDR_IRPC NDR_DCOM [SUBSYSTEM::RPC_NDR_ROT] OBJ_FILES = gen_ndr/ndr_rot_c.o diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index e9c479a9cd..37f7d82ef5 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -32,32 +32,6 @@ static void dcerpc_ship_next_request(struct dcerpc_connection *c); -struct dcerpc_interface_list *dcerpc_pipes = NULL; - -/* - register a dcerpc client interface -*/ -NTSTATUS librpc_register_interface(const struct dcerpc_interface_table *interface) -{ - struct dcerpc_interface_list *l; - - for (l = dcerpc_pipes; l; l = l->next) { - if (GUID_equal(&interface->uuid, &l->table->uuid)) { - DEBUG(0, ("Attempt to register interface %s which has the " - "same UUID as already registered interface %s\n", - interface->name, l->table->name)); - return NT_STATUS_OBJECT_NAME_COLLISION; - } - } - - l = talloc(talloc_autofree_context(), struct dcerpc_interface_list); - l->table = interface; - - DLIST_ADD(dcerpc_pipes, l); - - return NT_STATUS_OK; -} - /* destroy a dcerpc connection */ static int dcerpc_connection_destructor(void *ptr) { diff --git a/source4/librpc/rpc/table.c b/source4/librpc/rpc/table.c index 5450edb003..9b5cf8ff80 100644 --- a/source4/librpc/rpc/table.c +++ b/source4/librpc/rpc/table.c @@ -22,6 +22,33 @@ */ #include "includes.h" +#include "dlinklist.h" + +struct dcerpc_interface_list *dcerpc_pipes = NULL; + +/* + register a dcerpc client interface +*/ +NTSTATUS librpc_register_interface(const struct dcerpc_interface_table *interface) +{ + struct dcerpc_interface_list *l; + + for (l = dcerpc_pipes; l; l = l->next) { + if (GUID_equal(&interface->uuid, &l->table->uuid)) { + DEBUG(0, ("Attempt to register interface %s which has the " + "same UUID as already registered interface %s\n", + interface->name, l->table->name)); + return NT_STATUS_OBJECT_NAME_COLLISION; + } + } + + l = talloc(talloc_autofree_context(), struct dcerpc_interface_list); + l->table = interface; + + DLIST_ADD(dcerpc_pipes, l); + + return NT_STATUS_OK; +} /* find the pipe name for a local IDL interface @@ -82,7 +109,6 @@ const struct dcerpc_interface_table *idl_iface_by_uuid(const struct GUID *uuid) return NULL; } -extern struct dcerpc_interface_list *dcerpc_pipes; /* return the list of registered dcerpc_pipes */ diff --git a/source4/librpc/tables.pl b/source4/librpc/tables.pl new file mode 100644 index 0000000000..5757dc000a --- /dev/null +++ b/source4/librpc/tables.pl @@ -0,0 +1,91 @@ +#!/usr/bin/perl -w + +################################################### +# package to produce a table of all idl parsers +# Copyright tridge@samba.org 2003 +# Copyright jelmer@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 DCE/RPC interface 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); +} + +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 dcerpc_interface_table (\w+);/) { + $found = 1; + $init_fns.="\tlibrpc_register_interface(&$1);\n"; + } + } + + if ($found) { + print TABLEC "#include \"$filename\"\n"; + } + + close(FILE); +} + +print "Creating $opt_output\n"; +open(TABLEC, ">$opt_output") || die "failed to open $opt_output\n"; + +print TABLEC <<EOF; + +/* Automatically generated by tables.pl. DO NOT EDIT */ + +#include "includes.h" +EOF + +process_file($_) foreach (@ARGV); + +print TABLEC <<EOF; + +NTSTATUS dcerpc_table_init(void) +{ +$init_fns + + return NT_STATUS_OK; +} +EOF + +close(TABLEC); diff --git a/source4/pidl/lib/Parse/Pidl.pm b/source4/pidl/lib/Parse/Pidl.pm index 465f3409ad..c60fc59aba 100644 --- a/source4/pidl/lib/Parse/Pidl.pm +++ b/source4/pidl/lib/Parse/Pidl.pm @@ -11,6 +11,6 @@ use strict; use vars qw ( $VERSION ); -$VERSION = '0.01'; +$VERSION = '0.02'; 1; diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index f294fa1b9b..5d01531eb7 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -2225,11 +2225,6 @@ sub FunctionTable($) pidl "};"; pidl ""; - pidl "static NTSTATUS dcerpc_ndr_$interface->{NAME}_init(void)"; - pidl "{"; - pidl "\treturn librpc_register_interface(&dcerpc_table_$interface->{NAME});"; - pidl "}"; - pidl ""; } ##################################################################### @@ -2336,34 +2331,6 @@ sub ParseInterface($$) FunctionTable($interface); } -sub RegistrationFunction($$) -{ - my ($idl,$basename) = @_; - - my $body = ""; - - foreach my $interface (@{$idl}) { - next if $interface->{TYPE} ne "INTERFACE"; - next if ($#{$interface->{FUNCTIONS}}+1 == 0); - next unless defined ($interface->{PROPERTIES}->{uuid}); - - $body .= "\tstatus = dcerpc_ndr_$interface->{NAME}_init();\n"; - $body .= "\tif (NT_STATUS_IS_ERR(status)) {\n"; - $body .= "\t\treturn status;\n"; - $body .= "\t}\n"; - $body .= "\n"; - } - - return unless $body; - - pidl "NTSTATUS dcerpc_$basename\_init(void)"; - pidl "{"; - pidl "\tNTSTATUS status = NT_STATUS_OK;"; - pidl "$body\treturn status;"; - pidl "}"; - pidl ""; -} - ##################################################################### # parse a parsed IDL structure back into an IDL file sub Parse($$) @@ -2390,8 +2357,6 @@ sub Parse($$) ($_->{TYPE} eq "INTERFACE") && ParseInterface($_, \%needed); } - RegistrationFunction($ndr, $basename); - return ($res_hdr, $res); } |