From be33f4c611d37ebba59ff618033dc73601339ad1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 23 Dec 2007 23:54:30 -0600 Subject: r26576: Allow the static module loading code to be used for the Python modules. Simplify the way module initialization functions are handled. (This used to be commit ba8be2dfc0de4434c798663336b81f7f95cde520) --- source4/auth/auth.c | 2 +- source4/auth/config.mk | 2 +- source4/auth/credentials/config.mk | 2 +- source4/auth/gensec/gensec.c | 2 +- source4/build/smb_build/dot.pl | 8 ++++--- source4/build/smb_build/header.pm | 14 ++++++----- source4/build/smb_build/input.pm | 19 ++++++++------- source4/lib/events/events.c | 2 +- source4/lib/ldb/common/ldb_modules.c | 2 +- source4/lib/ldb/python.mk | 2 +- source4/lib/registry/config.mk | 2 +- source4/ntptr/ntptr_base.c | 2 +- source4/ntvfs/ntvfs_base.c | 2 +- source4/ntvfs/sysdep/sys_notify.c | 2 +- source4/param/param.i | 2 +- source4/param/param_wrap.c | 2 +- source4/param/share.c | 2 +- source4/rpc_server/service_rpc.c | 2 +- source4/scripting/ejs/smbcalls.c | 2 +- source4/scripting/python/config.m4 | 9 ++++--- source4/scripting/python/config.mk | 7 ++++-- source4/scripting/python/modules.c | 45 +++++++++++++++++++++++++++++++++++ source4/scripting/python/smbpython.c | 6 ++++- source4/scripting/python/uuidmodule.c | 4 ++-- source4/selftest/env/Samba4.pm | 1 + source4/smbd/process_model.c | 2 +- source4/smbd/server.c | 2 +- source4/torture/torture.c | 2 +- 28 files changed, 107 insertions(+), 44 deletions(-) create mode 100644 source4/scripting/python/modules.c diff --git a/source4/auth/auth.c b/source4/auth/auth.c index 918890b3f6..4bfc92e8f9 100644 --- a/source4/auth/auth.c +++ b/source4/auth/auth.c @@ -516,7 +516,7 @@ NTSTATUS auth_init(void) { static bool initialized = false; - init_module_fn static_init[] = STATIC_auth_MODULES; + init_module_fn static_init[] = { STATIC_auth_MODULES, NULL }; if (initialized) return NT_STATUS_OK; initialized = true; diff --git a/source4/auth/config.mk b/source4/auth/config.mk index 3514059cf0..4d111107a9 100644 --- a/source4/auth/config.mk +++ b/source4/auth/config.mk @@ -92,6 +92,6 @@ PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL ####################### [PYTHON::swig_auth] -PUBLIC_DEPENDENCIES = auth_system_session LIBPYTHON +PUBLIC_DEPENDENCIES = auth_system_session PRIVATE_DEPENDENCIES = SAMDB SWIG_FILE = auth.i diff --git a/source4/auth/credentials/config.mk b/source4/auth/credentials/config.mk index 4c8308d01f..8d33bdbd55 100644 --- a/source4/auth/credentials/config.mk +++ b/source4/auth/credentials/config.mk @@ -14,5 +14,5 @@ PRIVATE_DEPENDENCIES = \ SECRETS [PYTHON::swig_credentials] -PUBLIC_DEPENDENCIES = CREDENTIALS LIBPYTHON +PUBLIC_DEPENDENCIES = CREDENTIALS SWIG_FILE = credentials.i diff --git a/source4/auth/gensec/gensec.c b/source4/auth/gensec/gensec.c index f055b1a995..6f7ff91db6 100644 --- a/source4/auth/gensec/gensec.c +++ b/source4/auth/gensec/gensec.c @@ -1268,7 +1268,7 @@ NTSTATUS gensec_init(struct loadparm_context *lp_ctx) { static bool initialized = false; - init_module_fn static_init[] = STATIC_gensec_MODULES; + init_module_fn static_init[] = { STATIC_gensec_MODULES, NULL }; init_module_fn *shared_init; if (initialized) return NT_STATUS_OK; diff --git a/source4/build/smb_build/dot.pl b/source4/build/smb_build/dot.pl index c8203d4cdd..82f89c081a 100755 --- a/source4/build/smb_build/dot.pl +++ b/source4/build/smb_build/dot.pl @@ -25,9 +25,11 @@ sub generate($$$) foreach my $part (values %{$depend}) { next if (defined($only) and not contains($only,$part->{NAME})); - foreach my $elem (@{$part->{PUBLIC_DEPENDENCIES}}, - @{$part->{PRIVATE_DEPENDENCIES}}) { - $res .= "\t\"$part->{NAME}\" -> \"$elem\";\n"; + foreach my $elem (@{$part->{PUBLIC_DEPENDENCIES}}) { + $res .= "\t\"$part->{NAME}\" -> \"$elem\"; /* public */\n"; + } + foreach my $elem (@{$part->{PRIVATE_DEPENDENCIES}}) { + $res .= "\t\"$part->{NAME}\" -> \"$elem\"; /* private */\n"; } } diff --git a/source4/build/smb_build/header.pm b/source4/build/smb_build/header.pm index 34e81a3a24..b0dced4897 100644 --- a/source4/build/smb_build/header.pm +++ b/source4/build/smb_build/header.pm @@ -39,16 +39,18 @@ sub _prepare_build_h($) $name =~ s/-/_/g; $DEFINE->{COMMENT} = "$key->{TYPE} $key->{NAME} INIT"; $DEFINE->{KEY} = "STATIC_$name\_MODULES"; - $DEFINE->{VAL} = "{ \\\n"; + $DEFINE->{VAL} = "\\\n"; foreach (@{$key->{INIT_FUNCTIONS}}) { $DEFINE->{VAL} .= "\t$_, \\\n"; - my $fn = $key->{INIT_FUNCTION_TYPE}; - unless(defined($fn)) { $fn = "NTSTATUS (*) (void)"; } - $fn =~ s/\(\*\)/$_/; - $output .= "$fn;\n"; + unless (/{/) { + my $fn = $key->{INIT_FUNCTION_TYPE}; + unless(defined($fn)) { $fn = "NTSTATUS (*) (void)"; } + $fn =~ s/\(\*\)/$_/; + $output .= "$fn;\n"; + } } - $DEFINE->{VAL} .= "\tNULL \\\n }"; + $DEFINE->{VAL} =~ s/, \\\n$//g; # Remove the last comma push(@defines,$DEFINE); } diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm index 431fd3cb83..ae37a7602b 100644 --- a/source4/build/smb_build/input.pm +++ b/source4/build/smb_build/input.pm @@ -108,7 +108,7 @@ sub check_module($$$) my $sane_subsystem = lc($mod->{SUBSYSTEM}); $sane_subsystem =~ s/^lib//; $mod->{INSTALLDIR} = "MODULESDIR/$sane_subsystem"; - push (@{$mod->{PRIVATE_DEPENDENCIES}}, $mod->{SUBSYSTEM}); + push (@{$mod->{PUBLIC_DEPENDENCIES}}, $mod->{SUBSYSTEM}); } if (grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}})) { push (@{$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS}}, $mod->{INIT_FUNCTION}) if defined($mod->{INIT_FUNCTION}); @@ -147,14 +147,14 @@ sub check_library($$$) add_libreplace($lib); } -sub check_python($$) +sub check_python($$$) { - my ($INPUT, $python) = @_; + my ($INPUT, $python, $default_ot) = @_; return if ($INPUT->{LIBPYTHON}{ENABLE} ne "YES"); $python->{INSTALLDIR} = "PYTHONDIR"; - push (@{$python->{PUBLIC_DEPENDENCIES}}, "LIBPYTHON"); + unless (defined($python->{CFLAGS})) { $python->{CFLAGS} = []; } if (defined($python->{SWIG_FILE})) { my $dirname = dirname($python->{SWIG_FILE}); my $basename = basename($python->{SWIG_FILE}, ".i"); @@ -165,18 +165,20 @@ sub check_python($$) $python->{OBJ_FILES} = ["$dirname$basename\_wrap.o"]; $python->{LIBRARY_REALNAME} = "_$basename.\$(SHLIBEXT)"; $python->{PYTHON_FILES} = ["$dirname$basename.py"]; - unless (defined($python->{CFLAGS})) { $python->{CFLAGS} = []; } push (@{$python->{CFLAGS}}, $config::config{CFLAG_NO_UNUSED_MACROS}); push (@{$python->{CFLAGS}}, $config::config{CFLAG_NO_CAST_QUAL}); + $python->{INIT_FUNCTION} = "{ (char *)\"_$basename\", init_$basename }"; } else { my $basename = $python->{NAME}; $basename =~ s/^python_//g; $python->{LIBRARY_REALNAME} = "$basename.\$(SHLIBEXT)"; + $python->{INIT_FUNCTION} = "{ (char *)\"$basename\", init$basename }"; } + push (@{$python->{CFLAGS}}, @{$INPUT->{EXT_LIB_PYTHON}->{CFLAGS}}); $python->{SUBSYSTEM} = "LIBPYTHON"; - check_module($INPUT, $python, ["SHARED_LIBRARY"]); + check_module($INPUT, $python, $default_ot); } sub check_binary($$) @@ -204,7 +206,8 @@ sub import_integrated($$) push (@{$lib->{FULL_OBJ_LIST}}, "\$($mod->{TYPE}_$mod->{NAME}_FULL_OBJ_LIST)"); push (@{$lib->{LINK_FLAGS}}, "\$($mod->{TYPE}_$mod->{NAME}_LINK_FLAGS)"); - push (@{$lib->{PRIVATE_DEPENDENCIES}}, @{$mod->{PUBLIC_DEPENDENCIES}}) if defined($mod->{PUBLIC_DEPENDENCIES}); + push (@{$lib->{CFLAGS}}, @{$mod->{CFLAGS}}) if defined($mod->{CFLAGS}); + push (@{$lib->{PUBLIC_DEPENDENCIES}}, @{$mod->{PUBLIC_DEPENDENCIES}}) if defined($mod->{PUBLIC_DEPENDENCIES}); push (@{$lib->{PRIVATE_DEPENDENCIES}}, @{$mod->{PRIVATE_DEPENDENCIES}}) if defined($mod->{PRIVATE_DEPENDENCIES}); $mod->{ENABLE} = "NO"; @@ -288,7 +291,7 @@ sub check($$$$$) } elsif ($part->{TYPE} eq "BINARY") { check_binary($INPUT, $part); } elsif ($part->{TYPE} eq "PYTHON") { - check_python($INPUT, $part); + check_python($INPUT, $part, $module_ot); } elsif ($part->{TYPE} eq "EXT_LIB") { } else { die("Unknown type $part->{TYPE}"); diff --git a/source4/lib/events/events.c b/source4/lib/events/events.c index fd736e46d8..db7c3a5066 100644 --- a/source4/lib/events/events.c +++ b/source4/lib/events/events.c @@ -102,7 +102,7 @@ void event_set_default_backend(const char *backend) static void event_backend_init(void) { #if _SAMBA_BUILD_ - init_module_fn static_init[] = STATIC_LIBEVENTS_MODULES; + init_module_fn static_init[] = { STATIC_LIBEVENTS_MODULES, NULL }; init_module_fn *shared_init; if (event_backends) return; shared_init = load_samba_modules(NULL, global_loadparm, "events"); diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 72ed969298..f30206dc5b 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -168,7 +168,7 @@ static const struct ldb_module_ops *ldb_find_module_ops(const char *name) int ldb_global_init(void) { - int (*static_init_fns[])(void) = STATIC_LIBLDB_MODULES; + int (*static_init_fns[])(void) = { STATIC_LIBLDB_MODULES, NULL }; static int initialized = 0; int ret = 0, i; diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk index 12badf04f6..f81c2e3e16 100644 --- a/source4/lib/ldb/python.mk +++ b/source4/lib/ldb/python.mk @@ -1,7 +1,7 @@ ####################### # Start LIBRARY swig_ldb [PYTHON::swig_ldb] -PUBLIC_DEPENDENCIES = LIBLDB LIBPYTHON +PUBLIC_DEPENDENCIES = LIBLDB SWIG_FILE = ldb.i # End LIBRARY swig_ldb ####################### diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index b289ff9afd..f1f50479cb 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -102,6 +102,6 @@ OBJ_FILES = \ tests/registry.o [PYTHON::swig_registry] -PUBLIC_DEPENDENCIES = registry LIBPYTHON +PUBLIC_DEPENDENCIES = registry SWIG_FILE = registry.i diff --git a/source4/ntptr/ntptr_base.c b/source4/ntptr/ntptr_base.c index e184afcfd5..275f204524 100644 --- a/source4/ntptr/ntptr_base.c +++ b/source4/ntptr/ntptr_base.c @@ -71,7 +71,7 @@ NTSTATUS ntptr_register(const void *_ops) NTSTATUS ntptr_init(struct loadparm_context *lp_ctx) { - init_module_fn static_init[] = STATIC_ntptr_MODULES; + init_module_fn static_init[] = { STATIC_ntptr_MODULES, NULL }; init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "ntptr"); run_init_functions(static_init); diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c index 28f43eabe8..d4ae6c8b4f 100644 --- a/source4/ntvfs/ntvfs_base.c +++ b/source4/ntvfs/ntvfs_base.c @@ -202,7 +202,7 @@ NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, e NTSTATUS ntvfs_init(struct loadparm_context *lp_ctx) { static bool initialized = false; - init_module_fn static_init[] = STATIC_ntvfs_MODULES; + init_module_fn static_init[] = { STATIC_ntvfs_MODULES, NULL }; init_module_fn *shared_init; if (initialized) return NT_STATUS_OK; diff --git a/source4/ntvfs/sysdep/sys_notify.c b/source4/ntvfs/sysdep/sys_notify.c index 1664461d33..a6d0a698bc 100644 --- a/source4/ntvfs/sysdep/sys_notify.c +++ b/source4/ntvfs/sysdep/sys_notify.c @@ -125,7 +125,7 @@ _PUBLIC_ NTSTATUS sys_notify_init(void) { static bool initialized = false; - init_module_fn static_init[] = STATIC_sys_notify_MODULES; + init_module_fn static_init[] = { STATIC_sys_notify_MODULES, NULL }; init_module_fn *shared_init; if (initialized) return NT_STATUS_OK; diff --git a/source4/param/param.i b/source4/param/param.i index 55c7b3fe0c..11cda9910a 100644 --- a/source4/param/param.i +++ b/source4/param/param.i @@ -186,7 +186,7 @@ typedef struct param_context { struct param_opt *opt = param_get_add($self, parameter, section_name); talloc_free(opt->value); - opt->value = talloc_strdup(opt, PyObject_Str(ob)); + opt->value = talloc_strdup(opt, PyString_AsString(PyObject_Str(ob))); return 0; } diff --git a/source4/param/param_wrap.c b/source4/param/param_wrap.c index d594955f38..49c986aeb7 100644 --- a/source4/param/param_wrap.c +++ b/source4/param/param_wrap.c @@ -2747,7 +2747,7 @@ SWIGINTERN int param_set(param *self,char const *parameter,PyObject *ob,char con struct param_opt *opt = param_get_add(self, parameter, section_name); talloc_free(opt->value); - opt->value = talloc_strdup(opt, PyObject_Str(ob)); + opt->value = talloc_strdup(opt, PyString_AsString(PyObject_Str(ob))); return 0; } diff --git a/source4/param/share.c b/source4/param/share.c index 2ada9999ea..edbb68b5f0 100644 --- a/source4/param/share.c +++ b/source4/param/share.c @@ -146,7 +146,7 @@ NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name */ NTSTATUS share_init(void) { - init_module_fn static_init[] = STATIC_share_MODULES; + init_module_fn static_init[] = { STATIC_share_MODULES, NULL }; run_init_functions(static_init); diff --git a/source4/rpc_server/service_rpc.c b/source4/rpc_server/service_rpc.c index 33a86851a8..0483736912 100644 --- a/source4/rpc_server/service_rpc.c +++ b/source4/rpc_server/service_rpc.c @@ -467,7 +467,7 @@ static NTSTATUS dcesrv_init(struct event_context *event_context, NTSTATUS server_service_rpc_init(void) { - init_module_fn static_init[] = STATIC_dcerpc_server_MODULES; + init_module_fn static_init[] = { STATIC_dcerpc_server_MODULES, NULL }; init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "dcerpc_server"); run_init_functions(static_init); diff --git a/source4/scripting/ejs/smbcalls.c b/source4/scripting/ejs/smbcalls.c index 8a3ce245d2..da13f1f6ef 100644 --- a/source4/scripting/ejs/smbcalls.c +++ b/source4/scripting/ejs/smbcalls.c @@ -173,7 +173,7 @@ _PUBLIC_ void ejs_exception(const char *reason) */ void smb_setup_ejs_functions(void (*exception_handler)(const char *)) { - init_module_fn static_init[] = STATIC_smbcalls_MODULES; + init_module_fn static_init[] = { STATIC_smbcalls_MODULES, NULL }; init_module_fn *shared_init; ejs_exception_handler = exception_handler; diff --git a/source4/scripting/python/config.m4 b/source4/scripting/python/config.m4 index 49ad7273a4..b6ca7966df 100644 --- a/source4/scripting/python/config.m4 +++ b/source4/scripting/python/config.m4 @@ -24,7 +24,7 @@ fi PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags` PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags` -SMB_EXT_LIB(LIBPYTHON, [$PYTHON_LDFLAGS], [$PYTHON_CFLAGS]) +SMB_EXT_LIB(EXT_LIB_PYTHON, [$PYTHON_LDFLAGS], [$PYTHON_CFLAGS]) AC_MSG_CHECKING(working python module support) if test x$working_python = xyes @@ -40,10 +40,12 @@ then ],[ Py_InitModule(NULL, NULL); ],[ - SMB_ENABLE(LIBPYTHON,YES) + SMB_ENABLE(EXT_LIB_PYTHON,YES) SMB_ENABLE(smbpython,YES) + SMB_ENABLE(LIBPYTHON,YES) AC_MSG_RESULT([yes]) ],[ + SMB_ENABLE(EXT_LIB_PYTHON,NO) SMB_ENABLE(LIBPYTHON,NO) SMB_ENABLE(smbpython,NO) AC_MSG_RESULT([no]) @@ -52,7 +54,8 @@ then LIBS="$ac_save_LIBS" CFLAGS="$ac_save_CFLAGS" else - SMB_ENABLE(LIBPYTHON,NO) + SMB_ENABLE(EXT_LIB_PYTHON,NO) + SMB_ENABLE(LIBPYTHONyy,NO) SMB_ENABLE(smbpython,NO) AC_MSG_RESULT([no]) fi diff --git a/source4/scripting/python/config.mk b/source4/scripting/python/config.mk index ac923cb8d1..601e432906 100644 --- a/source4/scripting/python/config.mk +++ b/source4/scripting/python/config.mk @@ -1,7 +1,10 @@ [BINARY::smbpython] PRIVATE_DEPENDENCIES = LIBPYTHON -OBJ_FILES = \ - smbpython.o +OBJ_FILES = smbpython.o + +[SUBSYSTEM::LIBPYTHON] +PUBLIC_DEPENDENCIES = EXT_LIB_PYTHON +OBJ_FILES = modules.o [PYTHON::python_uuid] PRIVATE_DEPENDENCIES = LIBNDR diff --git a/source4/scripting/python/modules.c b/source4/scripting/python/modules.c new file mode 100644 index 0000000000..6a766f3412 --- /dev/null +++ b/source4/scripting/python/modules.c @@ -0,0 +1,45 @@ +/* + Unix SMB/CIFS implementation. + Samba utility functions + Copyright (C) Jelmer Vernooij 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" +#include +#include "build.h" + +extern void init_ldb(void); +extern void init_security(void); +extern void init_registry(void); +extern void init_param(void); +extern void init_misc(void); +extern void init_ldb(void); +extern void init_auth(void); +extern void init_credentials(void); +extern void init_tdb(void); +extern void init_dcerpc(void); +extern void init_events(void); +extern void inituuid(void); + +static struct _inittab py_modules[] = { STATIC_LIBPYTHON_MODULES }; + +void py_load_samba_modules(void) +{ + int i; + for (i = 0; i < ARRAY_SIZE(py_modules); i++) { + PyImport_ExtendInittab(&py_modules[i]); + } +} diff --git a/source4/scripting/python/smbpython.c b/source4/scripting/python/smbpython.c index 43785765c1..19c458e7ac 100644 --- a/source4/scripting/python/smbpython.c +++ b/source4/scripting/python/smbpython.c @@ -20,6 +20,10 @@ #include "includes.h" #include -int main(int argc, char **argv) { +void py_load_samba_modules(void); + +int main(int argc, char **argv) +{ + py_load_samba_modules(); return Py_Main(argc,argv); } diff --git a/source4/scripting/python/uuidmodule.c b/source4/scripting/python/uuidmodule.c index 9ae432dfa5..02c929d4a5 100644 --- a/source4/scripting/python/uuidmodule.c +++ b/source4/scripting/python/uuidmodule.c @@ -26,7 +26,7 @@ static PyObject *uuid_random(PyObject *self, PyObject *args) struct GUID guid; char *str; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, (char *)"")) return NULL; guid = GUID_random(); @@ -51,7 +51,7 @@ PyDoc_STRVAR(param_doc, "UUID helper routines"); PyMODINIT_FUNC inituuid(void) { - PyObject *mod = Py_InitModule3("uuid", methods, param_doc); + PyObject *mod = Py_InitModule3((char *)"uuid", methods, param_doc); if (mod == NULL) return; } diff --git a/source4/selftest/env/Samba4.pm b/source4/selftest/env/Samba4.pm index 4f8b96d332..ae7302fc4a 100644 --- a/source4/selftest/env/Samba4.pm +++ b/source4/selftest/env/Samba4.pm @@ -640,6 +640,7 @@ nogroup:x:65534:nobody push (@provision_options, "NSS_WRAPPER_PASSWD=\"$nsswrap_passwd\""); push (@provision_options, "NSS_WRAPPER_GROUP=\"$nsswrap_group\""); if (defined($ENV{PROVISION_PYTHON})) { + push (@provision_options, "$self->{bindir}/smbpython"); push (@provision_options, "$self->{setupdir}/provision.py"); } else { push (@provision_options, "$self->{bindir}/smbscript"); diff --git a/source4/smbd/process_model.c b/source4/smbd/process_model.c index e240ae2c60..dc3ede613c 100644 --- a/source4/smbd/process_model.c +++ b/source4/smbd/process_model.c @@ -82,7 +82,7 @@ _PUBLIC_ NTSTATUS register_process_model(const void *_ops) NTSTATUS process_model_init(struct loadparm_context *lp_ctx) { - init_module_fn static_init[] = STATIC_process_model_MODULES; + init_module_fn static_init[] = { STATIC_process_model_MODULES, NULL }; init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "process_model"); run_init_functions(static_init); diff --git a/source4/smbd/server.c b/source4/smbd/server.c index 3f1d3c35d8..78892b6760 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -187,7 +187,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ bool opt_interactive = false; int opt; poptContext pc; - init_module_fn static_init[] = STATIC_service_MODULES; + init_module_fn static_init[] = { STATIC_service_MODULES, NULL }; init_module_fn *shared_init; struct event_context *event_ctx; NTSTATUS status; diff --git a/source4/torture/torture.c b/source4/torture/torture.c index f0538c0362..6bce38363e 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -64,7 +64,7 @@ struct torture_context *torture_context_init(TALLOC_CTX *mem_ctx, int torture_init(void) { - init_module_fn static_init[] = STATIC_torture_MODULES; + init_module_fn static_init[] = { STATIC_torture_MODULES, NULL }; init_module_fn *shared_init = load_samba_modules(NULL, cmdline_lp_ctx, "torture"); run_init_functions(static_init); -- cgit