1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

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 7a8244761b)
This commit is contained in:
Jelmer Vernooij 2004-11-06 23:23:15 +00:00 committed by Gerald (Jerry) Carter
parent b012ab557b
commit 71db46ea66
49 changed files with 186 additions and 154 deletions

View File

@ -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)

View File

@ -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 = \

View File

@ -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}) {

View File

@ -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;

View File

@ -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;

View File

@ -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]\";

View File

@ -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);

View File

@ -3022,6 +3022,7 @@ static void remember_query_host(const char *arg,
POPT_TABLEEND
};
smbclient_init_subsystems;
#ifdef KANJI
pstrcpy(term_code, KANJI);

View File

@ -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);

View File

@ -816,6 +816,8 @@ static GtkWidget* create_savefilewin (void)
POPT_TABLEEND
};
gregedit_init_subsystems;
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();

View File

@ -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();

View File

@ -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);

View File

@ -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]);
}

View File

@ -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

View File

@ -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) {

View File

@ -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 = \

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -273,8 +273,3 @@ const struct socket_ops *socket_unixdom_ops(void)
{
return &unixdom_ops;
}
NTSTATUS socket_unixdom_init(void)
{
return NT_STATUS_OK;
}

View File

@ -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;
}

View File

@ -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 \

View File

@ -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 = \

View File

@ -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)
{

View File

@ -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 = \

View File

@ -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;
}

View File

@ -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 = \

View File

@ -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

View File

@ -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 = \

View File

@ -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 = {

View File

@ -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;

View File

@ -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 = \

View File

@ -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;
}

View File

@ -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
################################################
################################################

View File

@ -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;
}
/****************************************************************************

View File

@ -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;
}

View File

@ -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)) {

View File

@ -459,6 +459,8 @@ static void usage(void)
int opt;
int seed, server, i;
locktest_init_subsystems;
setlinebuf(stdout);
setup_logging("locktest", DEBUG_STDOUT);

View File

@ -277,6 +277,8 @@ static void usage(void)
char *p;
int seed;
masktest_init_subsystems;
setlinebuf(stdout);
setup_logging("masktest", DEBUG_STDOUT);

View File

@ -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

View File

@ -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 */

View File

@ -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);

View File

@ -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);
}

View File

@ -861,6 +861,8 @@ enum {
POPT_TABLEEND
};
ntlm_auth_init_subsystems;
/* Samba client initialisation */
setup_logging("ntlm_auth", DEBUG_STDERR);

View File

@ -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");

View File

@ -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");