diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2004-11-06 23:23:15 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:36 -0500 |
commit | 71db46ea665606384f2be1be708c74c97c9adfb2 (patch) | |
tree | 24c84e12f4fc925f3ec1e69348493d7222df1e44 | |
parent | b012ab557b8f8a2f58dfbbe8b7818f3e6d8cf38f (diff) | |
download | samba-71db46ea665606384f2be1be708c74c97c9adfb2.tar.gz samba-71db46ea665606384f2be1be708c74c97c9adfb2.tar.bz2 samba-71db46ea665606384f2be1be708c74c97c9adfb2.zip |
r3586: Fix some of the issues with the module init functions.
Both subsystems and modules can now have init functions, which can be
specified in .mk files (INIT_FUNCTION = ...)
The build system will define :
- SUBSYSTEM_init_static_modules that calls the init functions of all statically compiled modules. Failing to load will generate an error which is not fatal
- BINARY_init_subsystems that calls the init functions (if defined) for the subsystems the binary depends on
This removes the hack with the "static bool Initialised = " and the
"lazy_init" functions
(This used to be commit 7a8244761bfdfdfb48f8264d76951ebdfbf7bd8a)
49 files changed, 186 insertions, 154 deletions
diff --git a/source4/auth/auth.c b/source4/auth/auth.c index ae8b29e87d..58075b4c75 100644 --- a/source4/auth/auth.c +++ b/source4/auth/auth.c @@ -480,28 +480,19 @@ const struct auth_critical_sizes *auth_interface_version(void) /* initialise the AUTH subsystem */ -BOOL auth_init(void) +NTSTATUS auth_init(void) { NTSTATUS status; - /* ugly cludge, to go away */ - static BOOL initialised; - - if (initialised) { - return True; - } - status = register_subsystem("auth", auth_register); if (!NT_STATUS_IS_OK(status)) { - return False; + return status; } - /* FIXME: Perhaps panic if a basic backend, such as SAM, fails to initialise? */ - static_init_auth; - - initialised = True; + auth_init_static_modules; + DEBUG(3,("AUTH subsystem version %d initialised\n", AUTH_INTERFACE_VERSION)); - return True; + return status; } NTSTATUS server_service_auth_init(void) diff --git a/source4/auth/config.mk b/source4/auth/config.mk index 9272dda193..46808cba72 100644 --- a/source4/auth/config.mk +++ b/source4/auth/config.mk @@ -3,6 +3,7 @@ ####################### # Start MODULE auth_sam [MODULE::auth_sam] +INIT_FUNCTION = auth_sam_init INIT_OBJ_FILES = \ auth/auth_sam.o REQUIRED_SUBSYSTEMS = \ @@ -13,6 +14,7 @@ REQUIRED_SUBSYSTEMS = \ ####################### # Start MODULE auth_builtin [MODULE::auth_builtin] +INIT_FUNCTION = auth_builtin_init INIT_OBJ_FILES = \ auth/auth_builtin.o # End MODULE auth_builtin @@ -21,6 +23,7 @@ INIT_OBJ_FILES = \ ####################### # Start MODULE auth_winbind [MODULE::auth_winbind] +INIT_FUNCTION = auth_winbind_init INIT_OBJ_FILES = \ auth/auth_winbind.o REQUIRED_SUBSYSTEMS = \ @@ -31,6 +34,7 @@ REQUIRED_SUBSYSTEMS = \ ####################### # Start SUBSYSTEM AUTH [SUBSYSTEM::AUTH] +INIT_FUNCTION = auth_init INIT_OBJ_FILES = \ auth/auth.o ADD_OBJ_FILES = \ diff --git a/source4/build/pidl/header.pm b/source4/build/pidl/header.pm index 3f652bd4a1..d1eb1d1630 100644 --- a/source4/build/pidl/header.pm +++ b/source4/build/pidl/header.pm @@ -349,7 +349,7 @@ sub HeaderInterface($) $res .= "#define DCERPC_$name\_HELPSTRING $interface->{PROPERTIES}->{helpstring}\n"; $res .= "\nextern const struct dcerpc_interface_table dcerpc_table_$interface->{NAME};\n"; - $res .= "NTSTATUS dcerpc_$interface->{NAME}_init(void);\n\n"; + $res .= "NTSTATUS dcerpc_server_$interface->{NAME}_init(void);\n\n"; } foreach my $d (@{$data}) { diff --git a/source4/build/pidl/server.pm b/source4/build/pidl/server.pm index 2c590ea642..01c5adacb4 100644 --- a/source4/build/pidl/server.pm +++ b/source4/build/pidl/server.pm @@ -175,7 +175,7 @@ static BOOL $name\__op_interface_by_name(struct dcesrv_interface *iface, const c return False; } -NTSTATUS dcerpc_$name\_init(void) +NTSTATUS dcerpc_server_$name\_init(void) { NTSTATUS ret; struct dcesrv_endpoint_server ep_server; diff --git a/source4/build/smb_build/depend.pl b/source4/build/smb_build/depend.pl index a5a95eb547..a45fb725e1 100644 --- a/source4/build/smb_build/depend.pl +++ b/source4/build/smb_build/depend.pl @@ -147,6 +147,7 @@ sub _do_depend_subsystems($) foreach my $key (sort keys %{$CTX->{INPUT}{SUBSYSTEMS}}) { my $name = $CTX->{INPUT}{SUBSYSTEMS}{$key}{NAME}; my @STATIC_MODULES_LIST = (); + my @INIT_FUNCTIONS = (); # # skip when the subsystem was disabled @@ -159,28 +160,19 @@ sub _do_depend_subsystems($) # create the subsystems used OBJ_LIST # my @OBJ_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{INIT_OBJ_FILES}}) { - push(@OBJ_LIST,$elem); - } - foreach my $elem (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{ADD_OBJ_FILES}}) { - push(@OBJ_LIST,$elem); - } + push (@OBJ_LIST, @{$CTX->{INPUT}{SUBSYSTEMS}{$key}{INIT_OBJ_FILES}}); + push (@OBJ_LIST, @{$CTX->{INPUT}{SUBSYSTEMS}{$key}{ADD_OBJ_FILES}}); # # create the subsystems used SUBSYSTEMS_LIST # my @SUBSYSTEMS_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{REQUIRED_SUBSYSTEMS}}) { - push(@SUBSYSTEMS_LIST,$elem); - } - + push (@SUBSYSTEMS_LIST, (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{REQUIRED_SUBSYSTEMS}})); # # create the subsystems used LIBRARIES_LIST # my @LIBRARIES_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{REQUIRED_LIBRARIES}}) { - push(@LIBRARIES_LIST,$elem); - } + push (@LIBRARIES_LIST, @{$CTX->{INPUT}{SUBSYSTEMS}{$key}{REQUIRED_LIBRARIES}}); # # now collect the info from the subsystems static modules @@ -204,35 +196,29 @@ sub _do_depend_subsystems($) # add it to the STATIC_MODULES_LIST # push(@STATIC_MODULES_LIST,$subkey); + push (@INIT_FUNCTIONS, $CTX->{INPUT}{MODULES}{$subkey}{INIT_FUNCTION}) if $CTX->{INPUT}{MODULES}{$subkey}{INIT_FUNCTION} ne ""; # # add OBJS of static modules to the subsystems used OBJ_LIST # - foreach my $elem (@{$CTX->{INPUT}{MODULES}{$subkey}{INIT_OBJ_FILES}}) { - push(@OBJ_LIST,$elem); - } - foreach my $elem (@{$CTX->{INPUT}{MODULES}{$subkey}{ADD_OBJ_FILES}}) { - push(@OBJ_LIST,$elem); - } + push (@OBJ_LIST, (@{$CTX->{INPUT}{MODULES}{$subkey}{INIT_OBJ_FILES}})); + push (@OBJ_LIST, (@{$CTX->{INPUT}{MODULES}{$subkey}{ADD_OBJ_FILES}})); # # add SUBSYSTEMS of static modules to the subsystems used SUBSYSTEMS_LIST # - foreach my $elem (@{$CTX->{INPUT}{MODULES}{$subkey}{REQUIRED_SUBSYSTEMS}}) { - push(@SUBSYSTEMS_LIST,$elem); - } + push (@SUBSYSTEMS_LIST, (@{$CTX->{INPUT}{MODULES}{$subkey}{REQUIRED_SUBSYSTEMS}})); # # add LIBRARIES of static modules to the subsystems used LIBRARIES_LIST # - foreach my $elem (@{$CTX->{INPUT}{MODULES}{$subkey}{REQUIRED_LIBRARIES}}) { - push(@LIBRARIES_LIST,$elem); - } + push (@LIBRARIES_LIST, (@{$CTX->{INPUT}{MODULES}{$subkey}{REQUIRED_LIBRARIES}})); } # # set the lists # + @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{INIT_FUNCTIONS}} = @INIT_FUNCTIONS; @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{OBJ_LIST}} = @OBJ_LIST; @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{STATIC_MODULES_LIST}} = @STATIC_MODULES_LIST; @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{SUBSYSTEMS_LIST}} = @SUBSYSTEMS_LIST; @@ -303,9 +289,7 @@ sub _do_depend_shared_modules($) # create the shared modules used SUBSYSTEMS_LIST # my @SUBSYSTEMS_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{MODULES}{$key}{REQUIRED_SUBSYSTEMS}}) { - push(@SUBSYSTEMS_LIST,$elem); - } + push (@SUBSYSTEMS_LIST, (@{$CTX->{INPUT}{MODULES}{$key}{REQUIRED_SUBSYSTEMS}})); # # now try to resolve the dependencies for the shared module @@ -316,9 +300,7 @@ sub _do_depend_shared_modules($) # create the shared modules used LIBRARIES_LIST # my @LIBRARIES_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{MODULES}{$key}{REQUIRED_LIBRARIES}}) { - push(@LIBRARIES_LIST,$elem); - } + push (@LIBRARIES_LIST, @{$CTX->{INPUT}{MODULES}{$key}{REQUIRED_LIBRARIES}}); # # add the LIBARARIES of each subsysetm in the @SUBSYSTEMS_LIST @@ -361,9 +343,7 @@ sub _do_depend_libraries($) # create the libraries used SUBSYSTEMS_LIST # my @SUBSYSTEMS_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{LIBRARIES}{$key}{REQUIRED_SUBSYSTEMS}}) { - push(@SUBSYSTEMS_LIST,$elem); - } + push (@SUBSYSTEMS_LIST, @{$CTX->{INPUT}{LIBRARIES}{$key}{REQUIRED_SUBSYSTEMS}}); # # now try to resolve the dependencies for the library @@ -374,9 +354,7 @@ sub _do_depend_libraries($) # create the libraries used LIBRARIES_LIST # my @LIBRARIES_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{LIBRARIES}{$key}{REQUIRED_LIBRARIES}}) { - push(@LIBRARIES_LIST,$elem); - } + push (@LIBRARIES_LIST, @{$CTX->{INPUT}{LIBRARIES}{$key}{REQUIRED_LIBRARIES}}); # # add the LIBARARIES of each subsysetm in the @SUBSYSTEMS_LIST @@ -419,22 +397,26 @@ sub _do_depend_binaries($) # create the binaries used SUBSYSTEMS_LIST # my @SUBSYSTEMS_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{BINARIES}{$key}{REQUIRED_SUBSYSTEMS}}) { - push(@SUBSYSTEMS_LIST,$elem); - } + push (@SUBSYSTEMS_LIST, @{$CTX->{INPUT}{BINARIES}{$key}{REQUIRED_SUBSYSTEMS}}); # # now try to resolve the dependencies for the binary # @SUBSYSTEMS_LIST = _do_calc_subsystem_list($CTX, \@SUBSYSTEMS_LIST); + my @INIT_FUNCTIONS = (); + + foreach my $subkey (@SUBSYSTEMS_LIST) + { + push (@INIT_FUNCTIONS, $CTX->{INPUT}{SUBSYSTEMS}{$subkey}{INIT_FUNCTION}) if $CTX->{INPUT}{SUBSYSTEMS}{$subkey}{INIT_FUNCTION} ne ""; + + } + # # create the binaries used LIBRARIES_LIST # my @LIBRARIES_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{BINARIES}{$key}{REQUIRED_LIBRARIES}}) { - push(@LIBRARIES_LIST,$elem); - } + push (@LIBRARIES_LIST, @{$CTX->{INPUT}{BINARIES}{$key}{REQUIRED_LIBRARIES}}); # # add the LIBARARIES of each subsysetm in the @SUBSYSTEMS_LIST @@ -446,6 +428,7 @@ sub _do_depend_binaries($) # @{$CTX->{DEPEND}{BINARIES}{$key}{SUBSYSTEMS_LIST}} = @SUBSYSTEMS_LIST; @{$CTX->{DEPEND}{BINARIES}{$key}{LIBRARIES_LIST}} = @LIBRARIES_LIST; + @{$CTX->{DEPEND}{BINARIES}{$key}{INIT_FUNCTIONS}} = @INIT_FUNCTIONS; } return; diff --git a/source4/build/smb_build/public.m4 b/source4/build/smb_build/public.m4 index 479ca9685d..74e54b0a0e 100644 --- a/source4/build/smb_build/public.m4 +++ b/source4/build/smb_build/public.m4 @@ -217,6 +217,7 @@ SMB_INFO_MODULES="$SMB_INFO_MODULES @{\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{ADD_OBJ_FILES}} = str2array(\"$5\"); @{\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{REQUIRED_LIBRARIES}} = str2array(\"$6\"); @{\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{REQUIRED_SUBSYSTEMS}} = str2array(\"$7\"); +\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{INIT_FUNCTION} = \"\"; # \$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{CHOSEN_BUILD} = \"$[SMB_MODULE_][$1]\"; # End MODULE $1 @@ -255,6 +256,7 @@ SMB_INFO_MODULES="$SMB_INFO_MODULES @{\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{ADD_OBJ_FILES}} = module_get_array(\"$4\", \"$1\", \"ADD_OBJ_FILES\"); @{\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{REQUIRED_LIBRARIES}} = module_get_array(\"$4\", \"$1\", \"REQUIRED_LIBRARIES\"); @{\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{REQUIRED_SUBSYSTEMS}} = module_get_array(\"$4\", \"$1\", \"REQUIRED_SUBSYSTEMS\"); +\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{INIT_FUNCTION} = module_get_var(\"$4\", \"$1\", \"INIT_FUNCTION\"); # \$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{CHOSEN_BUILD} = \"$[SMB_MODULE_][$1]\"; # End MODULE $1 @@ -303,6 +305,7 @@ SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS \$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{NAME} = \"$1\"; @{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{INIT_OBJ_FILES}} = str2array(\"$2\"); @{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{ADD_OBJ_FILES}} = str2array(\"$3\"); +\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{INIT_FUNCTION} = \"\"; @{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{REQUIRED_LIBRARIES}} = str2array(\"$4\"); @{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{REQUIRED_SUBSYSTEMS}} = str2array(\"$5\"); # @@ -336,6 +339,7 @@ SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS @{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{ADD_OBJ_FILES}} = subsystem_get_array(\"$2\", \"$1\", \"ADD_OBJ_FILES\"); @{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{REQUIRED_LIBRARIES}} = subsystem_get_array(\"$2\", \"$1\", \"REQUIRED_LIBRARIES\"); @{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{REQUIRED_SUBSYSTEMS}} = subsystem_get_array(\"$2\", \"$1\", \"REQUIRED_SUBSYSTEMS\"); +\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{INIT_FUNCTION} = subsystem_get_var(\"$2\", \"$1\", \"INIT_FUNCTION\"); # \$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{ENABLE} = \"$[SMB_SUBSYSTEM_ENABLE_][$1]\"; \$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{NOPROTO} = \"$[SMB_SUBSYSTEM_NOPROTO_][$1]\"; diff --git a/source4/build/smb_build/smb_build_h.pl b/source4/build/smb_build/smb_build_h.pl index 59e96574bd..cd6cb29525 100644 --- a/source4/build/smb_build/smb_build_h.pl +++ b/source4/build/smb_build/smb_build_h.pl @@ -36,15 +36,40 @@ sub _prepare_smb_build_h($) # Static modules # $DEFINE->{COMMENT} = "SUBSYSTEM $NAME INIT"; - $DEFINE->{KEY} = "static_init_$name"; + $DEFINE->{KEY} = $name . "_init_static_modules"; $DEFINE->{VAL} = "do { \\\n"; - foreach my $subkey (@{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{STATIC_MODULES_LIST}}) { - $DEFINE->{VAL} .= "\t\t$subkey\_init(); \\\n"; + foreach my $subkey (@{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{INIT_FUNCTIONS}}) { + $DEFINE->{VAL} .= "\t\textern NTSTATUS $subkey(void); \\\n"; + } + + foreach my $subkey (@{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{INIT_FUNCTIONS}}) { + $DEFINE->{VAL} .= "\t\t$subkey(); \\\n"; } $DEFINE->{VAL} .= "\t} while(0)"; push(@{$CTX->{OUTPUT}{SMB_BUILD_H}},$DEFINE); + } + # + # loop over all binaries + # + foreach my $key (sort keys %{$CTX->{DEPEND}{BINARIES}}) { + my $NAME = $CTX->{INPUT}{BINARIES}{$key}{NAME}; + my $DEFINE = (); + my $name = lc($NAME); + + # + # Static modules + # + $DEFINE->{COMMENT} = "BINARY $NAME INIT"; + $DEFINE->{KEY} = $name . "_init_subsystems"; + $DEFINE->{VAL} = "do { \\\n"; + foreach my $subkey (@{$CTX->{DEPEND}{BINARIES}{$key}{INIT_FUNCTIONS}}) { + $DEFINE->{VAL} .= "\t\tif (NT_STATUS_IS_ERR($subkey())) exit(1); \\\n"; + } + $DEFINE->{VAL} .= "\t} while(0)"; + + push(@{$CTX->{OUTPUT}{SMB_BUILD_H}},$DEFINE); } # @@ -54,10 +79,13 @@ sub _prepare_smb_build_h($) next if ($CTX->{INPUT}{MODULES}{$key}{BUILD} ne "SHARED"); my $name = $CTX->{INPUT}{MODULES}{$key}{NAME}; + my $func = $CTX->{INPUT}{MODULES}{$key}{INIT_FUNCTION}; + next if $func eq ""; + my $DEFINE = (); $DEFINE->{COMMENT} = "$name is built shared"; - $DEFINE->{KEY} = "$name\_init"; + $DEFINE->{KEY} = $func; $DEFINE->{VAL} = "init_module"; push(@{$CTX->{OUTPUT}{SMB_BUILD_H}},$DEFINE); diff --git a/source4/client/client.c b/source4/client/client.c index 82377e82a9..9c797e863c 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -3022,6 +3022,7 @@ static void remember_query_host(const char *arg, POPT_TABLEEND }; + smbclient_init_subsystems; #ifdef KANJI pstrcpy(term_code, KANJI); diff --git a/source4/gtk/tools/gepdump.c b/source4/gtk/tools/gepdump.c index 6e5a9757d4..07eea756c1 100644 --- a/source4/gtk/tools/gepdump.c +++ b/source4/gtk/tools/gepdump.c @@ -422,6 +422,7 @@ static GtkWidget* create_mainwindow (void) int main(int argc, char **argv) { gtk_init(&argc, &argv); + gepdump_init_subsystems; lp_load(dyn_CONFIGFILE,True,False,False); load_interfaces(); setup_logging("gepdump", True); diff --git a/source4/gtk/tools/gregedit.c b/source4/gtk/tools/gregedit.c index f5c2fd5957..31df3086f2 100644 --- a/source4/gtk/tools/gregedit.c +++ b/source4/gtk/tools/gregedit.c @@ -816,6 +816,8 @@ static GtkWidget* create_savefilewin (void) POPT_TABLEEND }; + gregedit_init_subsystems; + lp_load(dyn_CONFIGFILE,True,False,False); load_interfaces(); diff --git a/source4/gtk/tools/gwcrontab.c b/source4/gtk/tools/gwcrontab.c index b1176a3fa8..dcedba2e88 100644 --- a/source4/gtk/tools/gwcrontab.c +++ b/source4/gtk/tools/gwcrontab.c @@ -492,6 +492,7 @@ static GtkWidget*create_new_job_dialog (void) int main(int argc, char **argv) { + gwcrontab_init_subsystems; lp_load(dyn_CONFIGFILE,True,False,False); load_interfaces(); diff --git a/source4/gtk/tools/gwsam.c b/source4/gtk/tools/gwsam.c index 18fd578f64..9dc7ebea73 100644 --- a/source4/gtk/tools/gwsam.c +++ b/source4/gtk/tools/gwsam.c @@ -412,6 +412,7 @@ create_mainwindow (void) int main(int argc, char **argv) { + gwsam_init_subsystems; lp_load(dyn_CONFIGFILE,True,False,False); load_interfaces(); setup_logging("gwsam", True); diff --git a/source4/lib/iconv.c b/source4/lib/iconv.c index a08e0ee69a..085ec0ec2f 100644 --- a/source4/lib/iconv.c +++ b/source4/lib/iconv.c @@ -100,7 +100,9 @@ static void lazy_initialize_iconv(void) if (!initialized) { initialized = True; register_subsystem("charset", charset_register_backend); - + + charset_init_static_modules; + for(i = 0; builtin_functions[i].name; i++) register_backend("charset", &builtin_functions[i]); } diff --git a/source4/lib/ldb/config.m4 b/source4/lib/ldb/config.m4 index c48e9e161b..a4e7a0dba9 100644 --- a/source4/lib/ldb/config.m4 +++ b/source4/lib/ldb/config.m4 @@ -2,12 +2,12 @@ if test x"$with_ldap_support" = x"yes"; then SMB_MODULE_DEFAULT(libldb_ldap,STATIC) fi +SMB_SUBSYSTEM_MK(LIBLDB,lib/ldb/config.mk) + SMB_MODULE_MK(libldb_ldap,LIBLDB,NOT,lib/ldb/config.mk) SMB_MODULE_MK(libldb_tdb,LIBLDB,STATIC,lib/ldb/config.mk) -SMB_SUBSYSTEM_MK(LIBLDB,lib/ldb/config.mk) - if test x"$experimental" = x"yes"; then SMB_LIBRARY_ENABLE(libldb,YES) fi diff --git a/source4/lib/registry/common/reg_interface.c b/source4/lib/registry/common/reg_interface.c index b2d659258d..0399fc26aa 100644 --- a/source4/lib/registry/common/reg_interface.c +++ b/source4/lib/registry/common/reg_interface.c @@ -59,24 +59,19 @@ NTSTATUS registry_register(const void *_function) return NT_STATUS_OK; } -static BOOL registry_init(void) +NTSTATUS registry_init(void) { - static BOOL initialised; NTSTATUS status; - if(initialised) { - return True; - } - status = register_subsystem("registry", registry_register); if (NT_STATUS_IS_ERR(status)) { DEBUG(0, ("Error registering registry subsystem: %s\n", nt_errstr(status))); - return False; + return status; } - initialised = True; - static_init_registry; - return True; + registry_init_static_modules; + + return NT_STATUS_OK; } /* Find a backend in the list of available backends */ @@ -84,8 +79,6 @@ static struct reg_init_function_entry *reg_find_backend_entry(const char *name) { struct reg_init_function_entry *entry; - if(registry_init() == False) return NULL; - entry = backends; while(entry) { diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index 659e705d5d..dacd6d5295 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -3,6 +3,7 @@ ################################################ # Start MODULE registry_nt4 [MODULE::registry_nt4] +INIT_FUNCTION = registry_nt4_init INIT_OBJ_FILES = \ lib/registry/reg_backend_nt4/reg_backend_nt4.o # End MODULE registry_nt4 @@ -11,6 +12,7 @@ INIT_OBJ_FILES = \ ################################################ # Start MODULE registry_w95 [MODULE::registry_w95] +INIT_FUNCTION = registry_w95_init INIT_OBJ_FILES = \ lib/registry/reg_backend_w95/reg_backend_w95.o # End MODULE registry_w95 @@ -19,6 +21,7 @@ INIT_OBJ_FILES = \ ################################################ # Start MODULE registry_dir [MODULE::registry_dir] +INIT_FUNCTION = registry_dir_init INIT_OBJ_FILES = \ lib/registry/reg_backend_dir/reg_backend_dir.o # End MODULE registry_dir @@ -27,6 +30,7 @@ INIT_OBJ_FILES = \ ################################################ # Start MODULE registry_rpc [MODULE::registry_rpc] +INIT_FUNCTION = registry_rpc_init INIT_OBJ_FILES = \ lib/registry/reg_backend_rpc/reg_backend_rpc.o REQUIRED_SUBSYSTEMS = \ @@ -37,6 +41,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE registry_gconf [MODULE::registry_gconf] +INIT_FUNCTION = registry_gconf_init INIT_OBJ_FILES = \ lib/registry/reg_backend_gconf/reg_backend_gconf.o REQUIRED_LIBRARIES = \ @@ -47,6 +52,7 @@ REQUIRED_LIBRARIES = \ ################################################ # Start MODULE registry_ldb [MODULE::registry_ldb] +INIT_FUNCTION = registry_ldb_init INIT_OBJ_FILES = \ lib/registry/reg_backend_ldb/reg_backend_ldb.o REQUIRED_SUBSYSTEMS = \ @@ -57,6 +63,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start SUBSYSTEM REGISTRY [SUBSYSTEM::REGISTRY] +INIT_FUNCTION = registry_init INIT_OBJ_FILES = \ lib/registry/common/reg_interface.o ADD_OBJ_FILES = \ diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c index 80f4a5c49f..55c8f1e72f 100644 --- a/source4/lib/registry/tools/regdiff.c +++ b/source4/lib/registry/tools/regdiff.c @@ -131,6 +131,7 @@ static void writediff(struct registry_key *oldkey, struct registry_key *newkey, POPT_TABLEEND }; + regdiff_init_subsystems; if (!lp_load(dyn_CONFIGFILE,True,False,False)) { fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE); diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c index d70d7b8457..a8b2f83ee1 100644 --- a/source4/lib/registry/tools/regpatch.c +++ b/source4/lib/registry/tools/regpatch.c @@ -771,6 +771,7 @@ static int nt_apply_reg_command_file(struct registry_context *r, const char *cmd POPT_TABLEEND }; + regpatch_init_subsystems; if (!lp_load(dyn_CONFIGFILE,True,False,False)) { fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE); diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index d705a0b802..8d044f6fa2 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -356,6 +356,7 @@ static char **reg_completion(const char *text, int start, int end) POPT_TABLEEND }; + regshell_init_subsystems; if (!lp_load(dyn_CONFIGFILE,True,False,False)) { fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE); diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index a8225c026d..ced7a00f94 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -88,6 +88,7 @@ static void print_tree(int l, struct registry_key *p, int fullpath, int novals) POPT_TABLEEND }; + regtree_init_subsystems; if (!lp_load(dyn_CONFIGFILE,True,False,False)) { fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE); diff --git a/source4/lib/socket/socket_ipv4.c b/source4/lib/socket/socket_ipv4.c index eebbd61219..88570512a4 100644 --- a/source4/lib/socket/socket_ipv4.c +++ b/source4/lib/socket/socket_ipv4.c @@ -336,8 +336,3 @@ const struct socket_ops *socket_ipv4_ops(void) { return &ipv4_tcp_ops; } - -NTSTATUS socket_ipv4_init(void) -{ - return NT_STATUS_OK; -} diff --git a/source4/lib/socket/socket_ipv6.c b/source4/lib/socket/socket_ipv6.c index c8683446ec..1685f17572 100644 --- a/source4/lib/socket/socket_ipv6.c +++ b/source4/lib/socket/socket_ipv6.c @@ -354,8 +354,3 @@ const struct socket_ops *socket_ipv6_ops(void) { return &ipv6_tcp_ops; } - -NTSTATUS socket_ipv6_init(void) -{ - return NT_STATUS_OK; -} diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c index 0ba4797219..e35453e6e0 100644 --- a/source4/lib/socket/socket_unix.c +++ b/source4/lib/socket/socket_unix.c @@ -273,8 +273,3 @@ const struct socket_ops *socket_unixdom_ops(void) { return &unixdom_ops; } - -NTSTATUS socket_unixdom_init(void) -{ - return NT_STATUS_OK; -} diff --git a/source4/libcli/auth/gensec.c b/source4/libcli/auth/gensec.c index aab1928687..6bc33ab66d 100644 --- a/source4/libcli/auth/gensec.c +++ b/source4/libcli/auth/gensec.c @@ -120,11 +120,6 @@ const char **gensec_security_oids(TALLOC_CTX *mem_ctx, const char *skip) */ static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx, struct gensec_security **gensec_security) { - /* awaiting a correct fix from metze */ - if (!gensec_init()) { - return NT_STATUS_INTERNAL_ERROR; - } - (*gensec_security) = talloc_p(mem_ctx, struct gensec_security); if (!(*gensec_security)) { return NT_STATUS_NO_MEMORY; @@ -806,25 +801,17 @@ const struct gensec_critical_sizes *gensec_interface_version(void) /* initialise the GENSEC subsystem */ -BOOL gensec_init(void) +NTSTATUS gensec_init(void) { - static BOOL initialised; - NTSTATUS status; - - /* this is *completely* the wrong way to do this */ - if (initialised) { - return True; - } - - status = register_subsystem("gensec", gensec_register); + NTSTATUS status = register_subsystem("gensec", gensec_register); if (!NT_STATUS_IS_OK(status)) { - return False; + return status; } - static_init_gensec; + gensec_init_static_modules; + gensec_dcerpc_schannel_init(); - initialised = True; DEBUG(3,("GENSEC subsystem version %d initialised\n", GENSEC_INTERFACE_VERSION)); - return True; + return NT_STATUS_OK; } diff --git a/source4/libcli/auth/gensec.mk b/source4/libcli/auth/gensec.mk index bab79ea2fd..1372a91ea2 100644 --- a/source4/libcli/auth/gensec.mk +++ b/source4/libcli/auth/gensec.mk @@ -1,6 +1,7 @@ ################################# # Start SUBSYSTEM GENSEC [SUBSYSTEM::GENSEC] +INIT_FUNCTION = gensec_init INIT_OBJ_FILES = libcli/auth/gensec.o REQUIRED_SUBSYSTEMS = \ SCHANNELDB @@ -10,6 +11,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE gensec_krb5 [MODULE::gensec_krb5] +INIT_FUNCTION = gensec_krb5_init INIT_OBJ_FILES = libcli/auth/gensec_krb5.o ADD_OBJ_FILES = \ libcli/auth/clikrb5.o \ @@ -24,6 +26,7 @@ REQUIRED_LIBRARIES = KRB5 ################################################ # Start MODULE gensec_spnego [MODULE::gensec_spnego] +INIT_FUNCTION = gensec_spnego_init INIT_OBJ_FILES = libcli/auth/spnego.o ADD_OBJ_FILES = \ libcli/auth/spnego_parse.o @@ -34,6 +37,7 @@ REQUIRED_SUBSYSTEMS = GENSEC ################################################ # Start MODULE gensec_ntlmssp [MODULE::gensec_ntlmssp] +INIT_FUNCTION = gensec_ntlmssp_init INIT_OBJ_FILES = libcli/auth/gensec_ntlmssp.o ADD_OBJ_FILES = \ libcli/auth/ntlmssp.o \ diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index a359f13f54..09e2a278c4 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -30,6 +30,7 @@ ADD_OBJ_FILES = \ ################################################ # Start SUBSYSTEM LIBNDR_GEN [SUBSYSTEM::LIBNDR_GEN] +INIT_FUNCTION = librpc_init INIT_OBJ_FILES = \ librpc/gen_ndr/tables.o ADD_OBJ_FILES = \ diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index 3c05c303af..27292bc8c3 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -24,6 +24,12 @@ #include "dlinklist.h" #include "librpc/gen_ndr/ndr_epmapper.h" +NTSTATUS librpc_init(void) +{ + /* FIXME: Register module registration function here */ + return NT_STATUS_OK; +} + /* initialise a dcerpc pipe. */ struct dcerpc_pipe *dcerpc_pipe_init(void) { diff --git a/source4/ntvfs/config.mk b/source4/ntvfs/config.mk index e2320e0684..c15470076f 100644 --- a/source4/ntvfs/config.mk +++ b/source4/ntvfs/config.mk @@ -3,6 +3,7 @@ ################################################ # Start MODULE ntvfs_cifs [MODULE::ntvfs_cifs] +INIT_FUNCTION = ntvfs_cifs_init INIT_OBJ_FILES = \ ntvfs/cifs/vfs_cifs.o REQUIRED_SUBSYSTEMS = \ @@ -13,6 +14,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE ntvfs_simple [MODULE::ntvfs_simple] +INIT_FUNCTION = ntvfs_simple_init INIT_OBJ_FILES = \ ntvfs/simple/vfs_simple.o ADD_OBJ_FILES = \ @@ -23,6 +25,7 @@ ADD_OBJ_FILES = \ ################################################ # Start MODULE ntvfs_print [MODULE::ntvfs_print] +INIT_FUNCTION = ntvfs_print_init INIT_OBJ_FILES = \ ntvfs/print/vfs_print.o # End MODULE ntvfs_print @@ -31,6 +34,7 @@ INIT_OBJ_FILES = \ ################################################ # Start MODULE ntvfs_ipc [MODULE::ntvfs_ipc] +INIT_FUNCTION = ntvfs_ipc_init INIT_OBJ_FILES = \ ntvfs/ipc/vfs_ipc.o \ ntvfs/ipc/ipc_rap.o \ @@ -43,6 +47,7 @@ INIT_OBJ_FILES = \ ################################################ # Start MODULE ntvfs_nbench [MODULE::ntvfs_nbench] +INIT_FUNCTION = ntvfs_nbench_init INIT_OBJ_FILES = \ ntvfs/nbench/vfs_nbench.o # End MODULE ntvfs_nbench @@ -51,6 +56,7 @@ INIT_OBJ_FILES = \ ################################################ # Start SUBSYSTEM NTVFS [SUBSYSTEM::NTVFS] +INIT_FUNCTION = ntvfs_init INIT_OBJ_FILES = \ ntvfs/ntvfs_base.o ADD_OBJ_FILES = \ diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c index cc83b53473..c168467eae 100644 --- a/source4/ntvfs/ntvfs_base.c +++ b/source4/ntvfs/ntvfs_base.c @@ -119,20 +119,19 @@ const struct ntvfs_critical_sizes *ntvfs_interface_version(void) /* initialise the NTVFS subsystem */ -BOOL ntvfs_init(void) +NTSTATUS ntvfs_init(void) { NTSTATUS status; status = register_subsystem("ntvfs", ntvfs_register); if (!NT_STATUS_IS_OK(status)) { - return False; + return status; } - /* FIXME: Perhaps panic if a basic backend, such as IPC, fails to initialise? */ - static_init_ntvfs; + ntvfs_init_static_modules; DEBUG(3,("NTVFS subsystem version %d initialised\n", NTVFS_INTERFACE_VERSION)); - return True; + return status; } diff --git a/source4/ntvfs/posix/config.mk b/source4/ntvfs/posix/config.mk index dd72468216..f54d2e24fb 100644 --- a/source4/ntvfs/posix/config.mk +++ b/source4/ntvfs/posix/config.mk @@ -1,6 +1,7 @@ ################################################ # Start MODULE ntvfs_posix [MODULE::ntvfs_posix] +INIT_FUNCTION = ntvfs_posix_init INIT_OBJ_FILES = \ ntvfs/posix/vfs_posix.o ADD_OBJ_FILES = \ diff --git a/source4/ntvfs/unixuid/config.mk b/source4/ntvfs/unixuid/config.mk index 76e7aebc76..611be650d1 100644 --- a/source4/ntvfs/unixuid/config.mk +++ b/source4/ntvfs/unixuid/config.mk @@ -1,6 +1,7 @@ ################################################ # Start MODULE ntvfs_unixuid [MODULE::ntvfs_unixuid] +INIT_FUNCTION = ntvfs_unixuid_init INIT_OBJ_FILES = \ ntvfs/unixuid/vfs_unixuid.o # End MODULE ntvfs_unixuid diff --git a/source4/rpc_server/config.mk b/source4/rpc_server/config.mk index 784665c80b..a513377077 100644 --- a/source4/rpc_server/config.mk +++ b/source4/rpc_server/config.mk @@ -14,6 +14,7 @@ ADD_OBJ_FILES = \ ################################################ # Start MODULE dcerpc_IOXIDResolver [MODULE::dcerpc_IOXIDResolver] +INIT_FUNCTION = dcerpc_server_IOXIDResolver_init INIT_OBJ_FILES = \ rpc_server/dcom/oxidresolver.o REQUIRED_SUBSYSTEMS = \ @@ -24,6 +25,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE dcerpc_IRemoteActivation [MODULE::dcerpc_IRemoteActivation] +INIT_FUNCTION = dcerpc_server_IRemoteActivation_init INIT_OBJ_FILES = \ rpc_server/dcom/remact.o REQUIRED_SUBSYSTEMS = \ @@ -59,6 +61,7 @@ INIT_OBJ_FILES = \ ################################################ # Start MODULE dcerpc_rpcecho [MODULE::dcerpc_rpcecho] +INIT_FUNCTION = dcerpc_server_rpcecho_init INIT_OBJ_FILES = \ rpc_server/echo/rpc_echo.o # End MODULE dcerpc_rpcecho @@ -67,6 +70,7 @@ INIT_OBJ_FILES = \ ################################################ # Start MODULE dcerpc_epmapper [MODULE::dcerpc_epmapper] +INIT_FUNCTION = dcerpc_server_epmapper_init INIT_OBJ_FILES = \ rpc_server/epmapper/rpc_epmapper.o # End MODULE dcerpc_epmapper @@ -75,6 +79,7 @@ INIT_OBJ_FILES = \ ################################################ # Start MODULE dcerpc_remote [MODULE::dcerpc_remote] +INIT_FUNCTION = dcerpc_server_remote_init INIT_OBJ_FILES = \ rpc_server/remote/dcesrv_remote.o REQUIRED_SUBSYSTEMS = \ @@ -85,6 +90,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE dcerpc_srvsvc [MODULE::dcerpc_srvsvc] +INIT_FUNCTION = dcerpc_server_srvsvc_init INIT_OBJ_FILES = \ rpc_server/srvsvc/dcesrv_srvsvc.o REQUIRED_SUBSYSTEMS = \ @@ -95,6 +101,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE dcerpc_wkssvc [MODULE::dcerpc_wkssvc] +INIT_FUNCTION = dcerpc_server_wkssvc_init INIT_OBJ_FILES = \ rpc_server/wkssvc/dcesrv_wkssvc.o REQUIRED_SUBSYSTEMS = \ @@ -105,6 +112,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE dcerpc_samr [MODULE::dcerpc_samr] +INIT_FUNCTION = dcerpc_server_samr_init INIT_OBJ_FILES = \ rpc_server/samr/dcesrv_samr.o ADD_OBJ_FILES = \ @@ -118,6 +126,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE dcerpc_winreg [MODULE::dcerpc_winreg] +INIT_FUNCTION = dcerpc_server_winreg_init INIT_OBJ_FILES = \ rpc_server/winreg/rpc_winreg.o REQUIRED_SUBSYSTEMS = \ @@ -128,6 +137,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE dcerpc_netlogon [MODULE::dcerpc_netlogon] +INIT_FUNCTION = dcerpc_server_netlogon_init INIT_OBJ_FILES = \ rpc_server/netlogon/dcerpc_netlogon.o REQUIRED_SUBSYSTEMS = \ @@ -139,6 +149,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE dcerpc_lsa [MODULE::dcerpc_lsarpc] +INIT_FUNCTION = dcerpc_server_lsarpc_init INIT_OBJ_FILES = \ rpc_server/lsa/dcesrv_lsa.o REQUIRED_SUBSYSTEMS = \ @@ -150,6 +161,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE dcerpc_spoolss [MODULE::dcerpc_spoolss] +INIT_FUNCTION = dcerpc_server_spoolss_init INIT_OBJ_FILES = \ rpc_server/spoolss/dcesrv_spoolss.o \ rpc_server/spoolss/spoolssdb.o @@ -161,6 +173,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE dcerpc_drsuapi [MODULE::dcerpc_drsuapi] +INIT_FUNCTION = dcerpc_server_drsuapi_init INIT_OBJ_FILES = \ rpc_server/drsuapi/dcesrv_drsuapi.o ADD_OBJ_FILES = \ @@ -174,6 +187,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start SUBSYSTEM DCERPC [SUBSYSTEM::DCERPC] +INIT_FUNCTION = dcerpc_server_init INIT_OBJ_FILES = \ rpc_server/dcerpc_server.o ADD_OBJ_FILES = \ diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index 3aeb7033d1..70b7d18f39 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -1165,20 +1165,19 @@ const struct dcesrv_critical_sizes *dcerpc_module_version(void) /* initialise the DCERPC subsystem */ -BOOL subsystem_dcerpc_init(void) +NTSTATUS dcerpc_server_init(void) { NTSTATUS status; status = register_subsystem("dcerpc", dcerpc_register_ep_server); if (!NT_STATUS_IS_OK(status)) { - return False; + return status; } - /* FIXME: Perhaps panic if a basic endpoint server, such as EPMAPPER, fails to initialise? */ - static_init_dcerpc; + dcerpc_init_static_modules; DEBUG(3,("DCERPC subsystem version %d initialised\n", DCERPC_MODULE_VERSION)); - return True; + return NT_STATUS_OK; } static const struct server_service_ops dcesrv_ops = { diff --git a/source4/rpc_server/remote/dcesrv_remote.c b/source4/rpc_server/remote/dcesrv_remote.c index 7bb461bd6f..fbd6f65a1a 100644 --- a/source4/rpc_server/remote/dcesrv_remote.c +++ b/source4/rpc_server/remote/dcesrv_remote.c @@ -183,7 +183,7 @@ static BOOL remote_op_interface_by_name(struct dcesrv_interface *iface, const ch return False; } -NTSTATUS dcerpc_remote_init(void) +NTSTATUS dcerpc_server_remote_init(void) { NTSTATUS ret; struct dcesrv_endpoint_server ep_server; diff --git a/source4/smbd/config.mk b/source4/smbd/config.mk index 55f040f805..7c5fe74da9 100644 --- a/source4/smbd/config.mk +++ b/source4/smbd/config.mk @@ -3,6 +3,7 @@ ################################################ # Start MODULE server_service_auth [MODULE::server_service_auth] +INIT_FUNCTION = server_service_auth_init REQUIRED_SUBSYSTEMS = \ AUTH # End MODULE server_auth @@ -11,6 +12,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE server_service_smb [MODULE::server_service_smb] +INIT_FUNCTION = server_service_smb_init REQUIRED_SUBSYSTEMS = \ SMB # End MODULE server_smb @@ -19,6 +21,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE server_service_rpc [MODULE::server_service_rpc] +INIT_FUNCTION = server_service_rpc_init REQUIRED_SUBSYSTEMS = \ DCERPC # End MODULE server_rpc @@ -27,6 +30,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start MODULE server_service_ldap [MODULE::server_service_ldap] +INIT_FUNCTION = server_service_ldap_init REQUIRED_SUBSYSTEMS = \ LDAP # End MODULE server_ldap @@ -35,6 +39,7 @@ REQUIRED_SUBSYSTEMS = \ ####################### # Start SUBSYSTEM SERVICE [SUBSYSTEM::SERVER_SERVICE] +INIT_FUNCTION = server_service_init INIT_OBJ_FILES = \ smbd/service.o REQUIRED_SUBSYSTEMS = \ diff --git a/source4/smbd/process_model.c b/source4/smbd/process_model.c index 3493425774..69e321e0c2 100644 --- a/source4/smbd/process_model.c +++ b/source4/smbd/process_model.c @@ -118,18 +118,17 @@ const struct process_model_critical_sizes *process_model_version(void) /* initialise the PROCESS_MODEL subsystem */ -BOOL process_model_init(void) +NTSTATUS process_model_init(void) { NTSTATUS status; status = register_subsystem("process_model", register_process_model); if (!NT_STATUS_IS_OK(status)) { - return False; + return status; } - /* FIXME: Perhaps panic if a basic process model, such as simple, fails to initialise? */ - static_init_process_model; + process_model_init_static_modules; DEBUG(3,("PROCESS subsystem version %d initialised\n", PROCESS_MODEL_VERSION)); - return True; + return NT_STATUS_OK; } diff --git a/source4/smbd/process_model.mk b/source4/smbd/process_model.mk index 6a4048700f..d4329e2014 100644 --- a/source4/smbd/process_model.mk +++ b/source4/smbd/process_model.mk @@ -3,6 +3,7 @@ ################################################ # Start MODULE process_model_single [MODULE::process_model_single] +INIT_FUNCTION = process_model_single_init INIT_OBJ_FILES = \ smbd/process_single.o # End MODULE process_model_single @@ -11,6 +12,7 @@ INIT_OBJ_FILES = \ ################################################ # Start MODULE process_model_standard [MODULE::process_model_standard] +INIT_FUNCTION = process_model_standard_init INIT_OBJ_FILES = \ smbd/process_standard.o # End MODULE process_model_standard @@ -19,6 +21,7 @@ INIT_OBJ_FILES = \ ################################################ # Start MODULE process_model_thread [MODULE::process_model_thread] +INIT_FUNCTION = process_model_thread_init INIT_OBJ_FILES = \ smbd/process_thread.o REQUIRED_LIBRARIES = \ @@ -29,8 +32,9 @@ REQUIRED_LIBRARIES = \ ################################################ # Start SUBSYSTEM PROCESS_MODEL [SUBSYSTEM::PROCESS_MODEL] +INIT_FUNCTION = process_model_init INIT_OBJ_FILES = \ smbd/process_model.o # # End SUBSYSTEM PROCESS_MODEL -################################################
\ No newline at end of file +################################################ diff --git a/source4/smbd/rewrite.c b/source4/smbd/rewrite.c index 0e9260535c..d22e3c28c3 100644 --- a/source4/smbd/rewrite.c +++ b/source4/smbd/rewrite.c @@ -41,26 +41,7 @@ void init_subsystems(void) exit(1); } - /* Setup the PROCESS_MODEL subsystem */ - if (!process_model_init()) - exit(1); - - /* Setup the SERVER_SERVICE subsystem */ - if (!server_service_init()) - exit(1); - - /* Setup the AUTH subsystem */ - if (!auth_init()) - exit(1); - - /* Setup the NTVFS subsystem */ - if (!ntvfs_init()) - exit(1); - - /* Setup the DCERPC subsystem */ - if (!subsystem_dcerpc_init()) - exit(1); - + smbd_init_subsystems; } /**************************************************************************** diff --git a/source4/smbd/service.c b/source4/smbd/service.c index 767d310e2b..fdbd5d0c80 100644 --- a/source4/smbd/service.c +++ b/source4/smbd/service.c @@ -321,20 +321,19 @@ static NTSTATUS register_server_service_ops(const void *_ops) /* initialise the SERVER SERVICE subsystem */ -BOOL server_service_init(void) +NTSTATUS server_service_init(void) { NTSTATUS status; status = register_subsystem("service", register_server_service_ops); if (!NT_STATUS_IS_OK(status)) { - return False; + return status; } - /* FIXME: Perhaps panic if a basic endpoint server, such as EPMAPER, fails to initialise? */ - static_init_server_service; + server_service_init_static_modules; DEBUG(3,("SERVER SERVICE subsystem version %d initialised\n", SERVER_SERVICE_VERSION)); - return True; + return NT_STATUS_OK; } diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 310dec1bc7..563703bd2a 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -2107,6 +2107,8 @@ static void usage(void) setup_logging(argv[0], DEBUG_STDOUT); + gentest_init_subsystems; + for (i=0;i<NSERVERS;i++) { const char *share = argv[1+i]; if (!split_unc_name(share, &servers[i].server_name, &servers[i].share_name)) { diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 6c55190d6b..9725bc37ec 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -459,6 +459,8 @@ static void usage(void) int opt; int seed, server, i; + locktest_init_subsystems; + setlinebuf(stdout); setup_logging("locktest", DEBUG_STDOUT); diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index ad5f703008..bb0abf4b3e 100644 --- a/source4/torture/masktest.c +++ b/source4/torture/masktest.c @@ -277,6 +277,8 @@ static void usage(void) char *p; int seed; + masktest_init_subsystems; + setlinebuf(stdout); setup_logging("masktest", DEBUG_STDOUT); diff --git a/source4/torture/torture.c b/source4/torture/torture.c index e7472ffa46..883fe4b017 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -2632,6 +2632,8 @@ static BOOL is_binding_string(const char *binding_string) POPT_TABLEEND }; + smbtorture_init_subsystems; + setup_logging("smbtorture", DEBUG_STDOUT); #ifdef HAVE_SETBUFFER diff --git a/source4/utils/getntacl.c b/source4/utils/getntacl.c index 6045e72013..034224c66d 100644 --- a/source4/utils/getntacl.c +++ b/source4/utils/getntacl.c @@ -99,6 +99,8 @@ int main(int argc, char **argv) struct ndr_pull *ndr; NTSTATUS result; + static_init_getntacl; + mem_ctx = talloc_init("getntacl"); /* Fetch ACL data */ diff --git a/source4/utils/ndrdump.c b/source4/utils/ndrdump.c index 1edf8eda6c..826f0c6c6e 100644 --- a/source4/utils/ndrdump.c +++ b/source4/utils/ndrdump.c @@ -109,6 +109,8 @@ static void show_functions(const struct dcerpc_interface_table *p) POPT_TABLEEND }; + ndrdump_init_subsystems; + DEBUGLEVEL = 10; setup_logging("ndrdump", DEBUG_STDOUT); diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c index 380afd6120..dcd663d3fd 100644 --- a/source4/utils/net/net.c +++ b/source4/utils/net/net.c @@ -232,5 +232,6 @@ static int binary_net(int argc, const char **argv) int main(int argc, const char **argv) { + net_init_subsystems; return binary_net(argc, argv); } diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c index 8d7f750af6..5cc02ffbb2 100644 --- a/source4/utils/ntlm_auth.c +++ b/source4/utils/ntlm_auth.c @@ -861,6 +861,8 @@ enum { POPT_TABLEEND }; + ntlm_auth_init_subsystems; + /* Samba client initialisation */ setup_logging("ntlm_auth", DEBUG_STDERR); diff --git a/source4/utils/setntacl.c b/source4/utils/setntacl.c index 3565da2a79..cd9f262e12 100644 --- a/source4/utils/setntacl.c +++ b/source4/utils/setntacl.c @@ -61,6 +61,8 @@ static void setntacl(char *filename, struct security_descriptor *sd) TALLOC_CTX *mem_ctx; struct security_acl *acl; + static_init_ntacl; + setup_logging("setntacl", DEBUG_STDOUT); mem_ctx = talloc_init("setntacl"); diff --git a/source4/utils/setnttoken.c b/source4/utils/setnttoken.c index 06544d0bc7..ccdd7a5578 100644 --- a/source4/utils/setnttoken.c +++ b/source4/utils/setnttoken.c @@ -41,6 +41,8 @@ int main(int argc, char **argv) NTSTATUS status; TALLOC_CTX *mem_ctx; + static_init_setnttoken; + setup_logging("setnttoken", DEBUG_STDOUT); mem_ctx = talloc_init("setnttoken"); |