From 09c44f6cae89621871d2e5475b0c0f99c25804b4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 26 Dec 2005 21:58:31 +0000 Subject: r12500: Use init functions explicitly in a few more places. 'gensec' and 'librpc' are the only two subsystems left to convert. (This used to be commit f6bbc72996aeee8607fc583140fd60be0e06e969) --- source4/build/smb_build/TODO | 3 +- source4/gtk/tools/gregedit.c | 1 + source4/lib/registry/config.mk | 1 - source4/lib/registry/tools/regdiff.c | 2 ++ source4/lib/registry/tools/regpatch.c | 2 ++ source4/lib/registry/tools/regshell.c | 2 ++ source4/lib/registry/tools/regtree.c | 2 ++ source4/libcli/auth/config.mk | 2 +- source4/librpc/config.mk | 53 ++++++++++++++++++++++++----------- source4/ntptr/config.mk | 1 - source4/ntvfs/config.mk | 1 - source4/scripting/ejs/smbcalls.c | 12 ++++++++ source4/smbd/process_model.mk | 1 - source4/smbd/server.c | 11 ++++++++ source4/torture/local/registry.c | 2 ++ 15 files changed, 73 insertions(+), 23 deletions(-) diff --git a/source4/build/smb_build/TODO b/source4/build/smb_build/TODO index 674f094c02..fb58d6b29f 100644 --- a/source4/build/smb_build/TODO +++ b/source4/build/smb_build/TODO @@ -5,7 +5,8 @@ ldb.h belong in $INCLUDEDIR - add register function to smbtorture - init functions per shared library / binary - - rpc_ndr + - gensec + - rpc/ndr ?? - list not automatically generated - utility function for 'init mutex' - install shared modules diff --git a/source4/gtk/tools/gregedit.c b/source4/gtk/tools/gregedit.c index 94cfb4123e..cb0d927439 100644 --- a/source4/gtk/tools/gregedit.c +++ b/source4/gtk/tools/gregedit.c @@ -967,6 +967,7 @@ int main(int argc, char *argv[]) int ret; gregedit_init_subsystems; + registry_init(); lp_load(); load_interfaces(); setup_logging(argv[0], DEBUG_STDERR); diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index f3e7abec3a..9d949a5c1d 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -81,7 +81,6 @@ REQUIRED_SUBSYSTEMS = \ [LIBRARY::REGISTRY] MAJOR_VERSION = 0 MINOR_VERSION = 0 -INIT_FUNCTION = registry_init DESCRIPTION = Windows-style registry library RELEASE_VERSION = 1 OBJ_FILES = \ diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c index 7c6a5d75ae..3720298df8 100644 --- a/source4/lib/registry/tools/regdiff.c +++ b/source4/lib/registry/tools/regdiff.c @@ -48,6 +48,8 @@ int main(int argc, char **argv) regdiff_init_subsystems; + registry_init(); + pc = poptGetContext(argv[0], argc, (const char **) argv, long_options,0); while((opt = poptGetNextOpt(pc)) != -1) { diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c index 8f86d8a8f0..2cc1507b3e 100644 --- a/source4/lib/registry/tools/regpatch.c +++ b/source4/lib/registry/tools/regpatch.c @@ -46,6 +46,8 @@ int main(int argc, char **argv) regpatch_init_subsystems; + registry_init(); + pc = poptGetContext(argv[0], argc, (const char **) argv, long_options,0); while((opt = poptGetNextOpt(pc)) != -1) { diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index ef5c598989..52bda8aa42 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -419,6 +419,8 @@ static char **reg_completion(const char *text, int start, int end) regshell_init_subsystems; + registry_init(); + pc = poptGetContext(argv[0], argc, (const char **) argv, long_options,0); while((opt = poptGetNextOpt(pc)) != -1) { diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index 8856c4d61c..01e4f92f4a 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -101,6 +101,8 @@ int main(int argc, char **argv) regtree_init_subsystems; + registry_init(); + pc = poptGetContext(argv[0], argc, (const char **) argv, long_options,0); while((opt = poptGetNextOpt(pc)) != -1) { diff --git a/source4/libcli/auth/config.mk b/source4/libcli/auth/config.mk index 51d16d8231..75b4180976 100644 --- a/source4/libcli/auth/config.mk +++ b/source4/libcli/auth/config.mk @@ -5,6 +5,6 @@ OBJ_FILES = credentials.o \ session.o \ smbencrypt.o REQUIRED_SUBSYSTEMS = \ - AUTH SCHANNELDB GENSEC + AUTH SCHANNELDB # End SUBSYSTEM LIBCLI_AUTH ################################# diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index a6082716b2..1e6fcbce4a 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -546,99 +546,118 @@ REQUIRED_SUBSYSTEMS = LIBNDR RPC_RAW LIBSMB NDR_MISC NDR_DCERPC NDR_SCHANNEL NDR # End SUBSYSTEM LIBRPC ################################################ -[SUBSYSTEM::RPC_EJS_ECHO] +[MODULE::RPC_EJS_ECHO] INIT_FUNCTION = ejs_init_rpcecho OBJ_FILES = gen_ndr/ndr_echo_ejs.o +SUBSYSTEM = SMBCALLS REQUIRED_SUBSYSTEMS = LIBRPC NDR_ECHO NOPROTO = YES -[SUBSYSTEM::RPC_EJS_MISC] +[MODULE::RPC_EJS_MISC] INIT_FUNCTION = ejs_init_misc OBJ_FILES = gen_ndr/ndr_misc_ejs.o +SUBSYSTEM = SMBCALLS REQUIRED_SUBSYSTEMS = LIBRPC NDR_MISC NOPROTO = YES -[SUBSYSTEM::RPC_EJS_SAMR] +[MODULE::RPC_EJS_SAMR] INIT_FUNCTION = ejs_init_samr OBJ_FILES = gen_ndr/ndr_samr_ejs.o +SUBSYSTEM = SMBCALLS REQUIRED_SUBSYSTEMS = LIBRPC NDR_SAMR NOPROTO = YES -[SUBSYSTEM::RPC_EJS_SECURITY] +[MODULE::RPC_EJS_SECURITY] INIT_FUNCTION = ejs_init_security OBJ_FILES = gen_ndr/ndr_security_ejs.o +SUBSYSTEM = SMBCALLS REQUIRED_SUBSYSTEMS = LIBRPC LIB_SECURITY_NDR NOPROTO = YES -[SUBSYSTEM::RPC_EJS_LSA] +[MODULE::RPC_EJS_LSA] INIT_FUNCTION = ejs_init_lsarpc OBJ_FILES = gen_ndr/ndr_lsa_ejs.o +SUBSYSTEM = SMBCALLS REQUIRED_SUBSYSTEMS = LIBRPC NDR_LSA NOPROTO = YES -[SUBSYSTEM::RPC_EJS_DFS] -INIT_FUNCTION = ejs_init_dfs +[MODULE::RPC_EJS_DFS] +INIT_FUNCTION = ejs_init_netdfs OBJ_FILES = gen_ndr/ndr_dfs_ejs.o +SUBSYSTEM = SMBCALLS REQUIRED_SUBSYSTEMS = LIBRPC NDR_DFS NOPROTO = YES -[SUBSYSTEM::RPC_EJS_DRSUAPI] +[MODULE::RPC_EJS_DRSUAPI] INIT_FUNCTION = ejs_init_drsuapi OBJ_FILES = gen_ndr/ndr_drsuapi_ejs.o +SUBSYSTEM = SMBCALLS +ENABLE = NO REQUIRED_SUBSYSTEMS = LIBRPC NDR_DRSUAPI NOPROTO = YES -[SUBSYSTEM::RPC_EJS_SPOOLSS] +[MODULE::RPC_EJS_SPOOLSS] INIT_FUNCTION = ejs_init_spoolss OBJ_FILES = gen_ndr/ndr_spoolss_ejs.o +SUBSYSTEM = SMBCALLS +ENABLE = NO REQUIRED_SUBSYSTEMS = LIBRPC NDR_SPOOLSS NOPROTO = YES -[SUBSYSTEM::RPC_EJS_WKSSVC] +[MODULE::RPC_EJS_WKSSVC] INIT_FUNCTION = ejs_init_wkssvc OBJ_FILES = gen_ndr/ndr_wkssvc_ejs.o +SUBSYSTEM = SMBCALLS REQUIRED_SUBSYSTEMS = LIBRPC NDR_WKSSVC NOPROTO = YES -[SUBSYSTEM::RPC_EJS_SRVSVC] +[MODULE::RPC_EJS_SRVSVC] INIT_FUNCTION = ejs_init_srvsvc OBJ_FILES = gen_ndr/ndr_srvsvc_ejs.o +SUBSYSTEM = SMBCALLS REQUIRED_SUBSYSTEMS = LIBRPC NDR_SRVSVC NOPROTO = YES -[SUBSYSTEM::RPC_EJS_EVENTLOG] +[MODULE::RPC_EJS_EVENTLOG] INIT_FUNCTION = ejs_init_eventlog OBJ_FILES = gen_ndr/ndr_eventlog_ejs.o +SUBSYSTEM = SMBCALLS REQUIRED_SUBSYSTEMS = LIBRPC NDR_EVENTLOG NOPROTO = YES -[SUBSYSTEM::RPC_EJS_WINREG] +[MODULE::RPC_EJS_WINREG] INIT_FUNCTION = ejs_init_winreg OBJ_FILES = gen_ndr/ndr_winreg_ejs.o +SUBSYSTEM = SMBCALLS REQUIRED_SUBSYSTEMS = LIBRPC NDR_WINREG NOPROTO = YES -[SUBSYSTEM::RPC_EJS_INITSHUTDOWN] +[MODULE::RPC_EJS_INITSHUTDOWN] INIT_FUNCTION = ejs_init_initshutdown OBJ_FILES = gen_ndr/ndr_initshutdown_ejs.o +SUBSYSTEM = SMBCALLS REQUIRED_SUBSYSTEMS = LIBRPC NDR_INITSHUTDOWN NOPROTO = YES -[SUBSYSTEM::RPC_EJS_NETLOGON] +[MODULE::RPC_EJS_NETLOGON] INIT_FUNCTION = ejs_init_netlogon OBJ_FILES = gen_ndr/ndr_netlogon_ejs.o +SUBSYSTEM = SMBCALLS +ENABLE = NO REQUIRED_SUBSYSTEMS = LIBRPC NDR_NETLOGON NOPROTO = YES -[SUBSYSTEM::RPC_EJS_SVCCTL] +[MODULE::RPC_EJS_SVCCTL] INIT_FUNCTION = ejs_init_svcctl OBJ_FILES = gen_ndr/ndr_svcctl_ejs.o +SUBSYSTEM = SMBCALLS REQUIRED_SUBSYSTEMS = LIBRPC NDR_SVCCTL NOPROTO = YES -[SUBSYSTEM::RPC_EJS_IRPC] +[MODULE::RPC_EJS_IRPC] INIT_FUNCTION = ejs_init_irpc OBJ_FILES = gen_ndr/ndr_irpc_ejs.o +SUBSYSTEM = SMBCALLS REQUIRED_SUBSYSTEMS = LIBRPC NDR_IRPC NOPROTO = YES diff --git a/source4/ntptr/config.mk b/source4/ntptr/config.mk index dace20704a..14124e12fe 100644 --- a/source4/ntptr/config.mk +++ b/source4/ntptr/config.mk @@ -15,7 +15,6 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start SUBSYSTEM NTPTR [SUBSYSTEM::NTPTR] -INIT_FUNCTION = ntptr_init OBJ_FILES = \ ntptr_base.o \ ntptr_interface.o diff --git a/source4/ntvfs/config.mk b/source4/ntvfs/config.mk index 1c37a608bf..bc39d82156 100644 --- a/source4/ntvfs/config.mk +++ b/source4/ntvfs/config.mk @@ -76,7 +76,6 @@ OBJ_FILES = \ PUBLIC_HEADERS = ntvfs.h MAJOR_VERSION = 0 MINOR_VERSION = 0 -INIT_FUNCTION = ntvfs_init DESCRIPTION = Virtual File System with NTFS semantics RELEASE_VERSION = 1 OBJ_FILES = \ diff --git a/source4/scripting/ejs/smbcalls.c b/source4/scripting/ejs/smbcalls.c index 3e5035b272..ee999402a5 100644 --- a/source4/scripting/ejs/smbcalls.c +++ b/source4/scripting/ejs/smbcalls.c @@ -24,6 +24,7 @@ #include "includes.h" #include "lib/appweb/ejs/ejs.h" #include "scripting/ejs/smbcalls.h" +#include "smb_build.h" /* return the type of a variable @@ -116,6 +117,9 @@ static int ejs_libinclude(int eid, int argc, char **argv) */ void smb_setup_ejs_functions(void) { + init_module_fn static_init[] = STATIC_SMBCALLS_MODULES; + init_module_fn *shared_init; + smb_setup_ejs_config(); smb_setup_ejs_ldb(); smb_setup_ejs_nbt(); @@ -131,8 +135,16 @@ void smb_setup_ejs_functions(void) smb_setup_ejs_samba3(); smb_setup_ejs_param(); smb_setup_ejs_datablob(); + ejsnet_setup(); + shared_init = load_samba_modules(NULL, "ejs"); + + run_init_functions(static_init); + run_init_functions(shared_init); + + talloc_free(shared_init); + ejsDefineCFunction(-1, "typeof", ejs_typeof, NULL, MPR_VAR_SCRIPT_HANDLE); ejsDefineStringCFunction(-1, "libinclude", ejs_libinclude, NULL, MPR_VAR_SCRIPT_HANDLE); } diff --git a/source4/smbd/process_model.mk b/source4/smbd/process_model.mk index 7028845475..b8f960215a 100644 --- a/source4/smbd/process_model.mk +++ b/source4/smbd/process_model.mk @@ -34,7 +34,6 @@ REQUIRED_SUBSYSTEMS = EXT_LIB_PTHREAD ################################################ # Start SUBSYSTEM PROCESS_MODEL [SUBSYSTEM::PROCESS_MODEL] -INIT_FUNCTION = process_model_init OBJ_FILES = \ process_model.o # diff --git a/source4/smbd/server.c b/source4/smbd/server.c index 52221b096b..9fa7cad0c7 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -217,6 +217,17 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ smbd_init_subsystems; + registry_init(); /* FIXME: maybe run this in the initialization function + of the winreg RPC server instead? */ + + ntptr_init(); /* FIXME: maybe run this in the initialization function + of the spoolss RPC server instead? */ + + ntvfs_init(); /* FIXME: maybe run this in the initialization functions + of the SMB[,2] server instead? */ + + process_model_init(); + shared_init = load_samba_modules(NULL, "service"); run_init_functions(static_init); diff --git a/source4/torture/local/registry.c b/source4/torture/local/registry.c index e2990bcc2e..5e7f2b0f5f 100644 --- a/source4/torture/local/registry.c +++ b/source4/torture/local/registry.c @@ -85,6 +85,8 @@ BOOL torture_registry(void) BOOL ret = True; TALLOC_CTX *mem_ctx = talloc_init("torture_registry"); + registry_init(); + ret &= test_hive(mem_ctx, "nt4", "TEST.DAT"); ret &= test_hive(mem_ctx, "ldb", "test.ldb"); ret &= test_hive(mem_ctx, "gconf", "."); -- cgit