mirror of
https://github.com/samba-team/samba.git
synced 2025-12-03 04:23:50 +03:00
r26576: Allow the static module loading code to be used for the Python modules.
Simplify the way module initialization functions are handled.
This commit is contained in:
committed by
Stefan Metzmacher
parent
03270c5ffd
commit
ba8be2dfc0
@@ -516,7 +516,7 @@ NTSTATUS auth_init(void)
|
|||||||
{
|
{
|
||||||
static bool initialized = false;
|
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;
|
if (initialized) return NT_STATUS_OK;
|
||||||
initialized = true;
|
initialized = true;
|
||||||
|
|||||||
@@ -92,6 +92,6 @@ PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL
|
|||||||
#######################
|
#######################
|
||||||
|
|
||||||
[PYTHON::swig_auth]
|
[PYTHON::swig_auth]
|
||||||
PUBLIC_DEPENDENCIES = auth_system_session LIBPYTHON
|
PUBLIC_DEPENDENCIES = auth_system_session
|
||||||
PRIVATE_DEPENDENCIES = SAMDB
|
PRIVATE_DEPENDENCIES = SAMDB
|
||||||
SWIG_FILE = auth.i
|
SWIG_FILE = auth.i
|
||||||
|
|||||||
@@ -14,5 +14,5 @@ PRIVATE_DEPENDENCIES = \
|
|||||||
SECRETS
|
SECRETS
|
||||||
|
|
||||||
[PYTHON::swig_credentials]
|
[PYTHON::swig_credentials]
|
||||||
PUBLIC_DEPENDENCIES = CREDENTIALS LIBPYTHON
|
PUBLIC_DEPENDENCIES = CREDENTIALS
|
||||||
SWIG_FILE = credentials.i
|
SWIG_FILE = credentials.i
|
||||||
|
|||||||
@@ -1268,7 +1268,7 @@ NTSTATUS gensec_init(struct loadparm_context *lp_ctx)
|
|||||||
{
|
{
|
||||||
static bool initialized = false;
|
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;
|
init_module_fn *shared_init;
|
||||||
|
|
||||||
if (initialized) return NT_STATUS_OK;
|
if (initialized) return NT_STATUS_OK;
|
||||||
|
|||||||
@@ -25,9 +25,11 @@ sub generate($$$)
|
|||||||
|
|
||||||
foreach my $part (values %{$depend}) {
|
foreach my $part (values %{$depend}) {
|
||||||
next if (defined($only) and not contains($only,$part->{NAME}));
|
next if (defined($only) and not contains($only,$part->{NAME}));
|
||||||
foreach my $elem (@{$part->{PUBLIC_DEPENDENCIES}},
|
foreach my $elem (@{$part->{PUBLIC_DEPENDENCIES}}) {
|
||||||
@{$part->{PRIVATE_DEPENDENCIES}}) {
|
$res .= "\t\"$part->{NAME}\" -> \"$elem\"; /* public */\n";
|
||||||
$res .= "\t\"$part->{NAME}\" -> \"$elem\";\n";
|
}
|
||||||
|
foreach my $elem (@{$part->{PRIVATE_DEPENDENCIES}}) {
|
||||||
|
$res .= "\t\"$part->{NAME}\" -> \"$elem\"; /* private */\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,16 +39,18 @@ sub _prepare_build_h($)
|
|||||||
$name =~ s/-/_/g;
|
$name =~ s/-/_/g;
|
||||||
$DEFINE->{COMMENT} = "$key->{TYPE} $key->{NAME} INIT";
|
$DEFINE->{COMMENT} = "$key->{TYPE} $key->{NAME} INIT";
|
||||||
$DEFINE->{KEY} = "STATIC_$name\_MODULES";
|
$DEFINE->{KEY} = "STATIC_$name\_MODULES";
|
||||||
$DEFINE->{VAL} = "{ \\\n";
|
$DEFINE->{VAL} = "\\\n";
|
||||||
foreach (@{$key->{INIT_FUNCTIONS}}) {
|
foreach (@{$key->{INIT_FUNCTIONS}}) {
|
||||||
$DEFINE->{VAL} .= "\t$_, \\\n";
|
$DEFINE->{VAL} .= "\t$_, \\\n";
|
||||||
my $fn = $key->{INIT_FUNCTION_TYPE};
|
unless (/{/) {
|
||||||
unless(defined($fn)) { $fn = "NTSTATUS (*) (void)"; }
|
my $fn = $key->{INIT_FUNCTION_TYPE};
|
||||||
$fn =~ s/\(\*\)/$_/;
|
unless(defined($fn)) { $fn = "NTSTATUS (*) (void)"; }
|
||||||
$output .= "$fn;\n";
|
$fn =~ s/\(\*\)/$_/;
|
||||||
|
$output .= "$fn;\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$DEFINE->{VAL} .= "\tNULL \\\n }";
|
$DEFINE->{VAL} =~ s/, \\\n$//g; # Remove the last comma
|
||||||
|
|
||||||
push(@defines,$DEFINE);
|
push(@defines,$DEFINE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ sub check_module($$$)
|
|||||||
my $sane_subsystem = lc($mod->{SUBSYSTEM});
|
my $sane_subsystem = lc($mod->{SUBSYSTEM});
|
||||||
$sane_subsystem =~ s/^lib//;
|
$sane_subsystem =~ s/^lib//;
|
||||||
$mod->{INSTALLDIR} = "MODULESDIR/$sane_subsystem";
|
$mod->{INSTALLDIR} = "MODULESDIR/$sane_subsystem";
|
||||||
push (@{$mod->{PRIVATE_DEPENDENCIES}}, $mod->{SUBSYSTEM});
|
push (@{$mod->{PUBLIC_DEPENDENCIES}}, $mod->{SUBSYSTEM});
|
||||||
}
|
}
|
||||||
if (grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}})) {
|
if (grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}})) {
|
||||||
push (@{$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS}}, $mod->{INIT_FUNCTION}) if defined($mod->{INIT_FUNCTION});
|
push (@{$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS}}, $mod->{INIT_FUNCTION}) if defined($mod->{INIT_FUNCTION});
|
||||||
@@ -147,14 +147,14 @@ sub check_library($$$)
|
|||||||
add_libreplace($lib);
|
add_libreplace($lib);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_python($$)
|
sub check_python($$$)
|
||||||
{
|
{
|
||||||
my ($INPUT, $python) = @_;
|
my ($INPUT, $python, $default_ot) = @_;
|
||||||
|
|
||||||
return if ($INPUT->{LIBPYTHON}{ENABLE} ne "YES");
|
return if ($INPUT->{LIBPYTHON}{ENABLE} ne "YES");
|
||||||
|
|
||||||
$python->{INSTALLDIR} = "PYTHONDIR";
|
$python->{INSTALLDIR} = "PYTHONDIR";
|
||||||
push (@{$python->{PUBLIC_DEPENDENCIES}}, "LIBPYTHON");
|
unless (defined($python->{CFLAGS})) { $python->{CFLAGS} = []; }
|
||||||
if (defined($python->{SWIG_FILE})) {
|
if (defined($python->{SWIG_FILE})) {
|
||||||
my $dirname = dirname($python->{SWIG_FILE});
|
my $dirname = dirname($python->{SWIG_FILE});
|
||||||
my $basename = basename($python->{SWIG_FILE}, ".i");
|
my $basename = basename($python->{SWIG_FILE}, ".i");
|
||||||
@@ -165,18 +165,20 @@ sub check_python($$)
|
|||||||
$python->{OBJ_FILES} = ["$dirname$basename\_wrap.o"];
|
$python->{OBJ_FILES} = ["$dirname$basename\_wrap.o"];
|
||||||
$python->{LIBRARY_REALNAME} = "_$basename.\$(SHLIBEXT)";
|
$python->{LIBRARY_REALNAME} = "_$basename.\$(SHLIBEXT)";
|
||||||
$python->{PYTHON_FILES} = ["$dirname$basename.py"];
|
$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_UNUSED_MACROS});
|
||||||
push (@{$python->{CFLAGS}}, $config::config{CFLAG_NO_CAST_QUAL});
|
push (@{$python->{CFLAGS}}, $config::config{CFLAG_NO_CAST_QUAL});
|
||||||
|
$python->{INIT_FUNCTION} = "{ (char *)\"_$basename\", init_$basename }";
|
||||||
} else {
|
} else {
|
||||||
my $basename = $python->{NAME};
|
my $basename = $python->{NAME};
|
||||||
$basename =~ s/^python_//g;
|
$basename =~ s/^python_//g;
|
||||||
$python->{LIBRARY_REALNAME} = "$basename.\$(SHLIBEXT)";
|
$python->{LIBRARY_REALNAME} = "$basename.\$(SHLIBEXT)";
|
||||||
|
$python->{INIT_FUNCTION} = "{ (char *)\"$basename\", init$basename }";
|
||||||
}
|
}
|
||||||
|
push (@{$python->{CFLAGS}}, @{$INPUT->{EXT_LIB_PYTHON}->{CFLAGS}});
|
||||||
|
|
||||||
$python->{SUBSYSTEM} = "LIBPYTHON";
|
$python->{SUBSYSTEM} = "LIBPYTHON";
|
||||||
|
|
||||||
check_module($INPUT, $python, ["SHARED_LIBRARY"]);
|
check_module($INPUT, $python, $default_ot);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_binary($$)
|
sub check_binary($$)
|
||||||
@@ -204,7 +206,8 @@ sub import_integrated($$)
|
|||||||
|
|
||||||
push (@{$lib->{FULL_OBJ_LIST}}, "\$($mod->{TYPE}_$mod->{NAME}_FULL_OBJ_LIST)");
|
push (@{$lib->{FULL_OBJ_LIST}}, "\$($mod->{TYPE}_$mod->{NAME}_FULL_OBJ_LIST)");
|
||||||
push (@{$lib->{LINK_FLAGS}}, "\$($mod->{TYPE}_$mod->{NAME}_LINK_FLAGS)");
|
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});
|
push (@{$lib->{PRIVATE_DEPENDENCIES}}, @{$mod->{PRIVATE_DEPENDENCIES}}) if defined($mod->{PRIVATE_DEPENDENCIES});
|
||||||
|
|
||||||
$mod->{ENABLE} = "NO";
|
$mod->{ENABLE} = "NO";
|
||||||
@@ -288,7 +291,7 @@ sub check($$$$$)
|
|||||||
} elsif ($part->{TYPE} eq "BINARY") {
|
} elsif ($part->{TYPE} eq "BINARY") {
|
||||||
check_binary($INPUT, $part);
|
check_binary($INPUT, $part);
|
||||||
} elsif ($part->{TYPE} eq "PYTHON") {
|
} elsif ($part->{TYPE} eq "PYTHON") {
|
||||||
check_python($INPUT, $part);
|
check_python($INPUT, $part, $module_ot);
|
||||||
} elsif ($part->{TYPE} eq "EXT_LIB") {
|
} elsif ($part->{TYPE} eq "EXT_LIB") {
|
||||||
} else {
|
} else {
|
||||||
die("Unknown type $part->{TYPE}");
|
die("Unknown type $part->{TYPE}");
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ void event_set_default_backend(const char *backend)
|
|||||||
static void event_backend_init(void)
|
static void event_backend_init(void)
|
||||||
{
|
{
|
||||||
#if _SAMBA_BUILD_
|
#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;
|
init_module_fn *shared_init;
|
||||||
if (event_backends) return;
|
if (event_backends) return;
|
||||||
shared_init = load_samba_modules(NULL, global_loadparm, "events");
|
shared_init = load_samba_modules(NULL, global_loadparm, "events");
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ static const struct ldb_module_ops *ldb_find_module_ops(const char *name)
|
|||||||
|
|
||||||
int ldb_global_init(void)
|
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;
|
static int initialized = 0;
|
||||||
int ret = 0, i;
|
int ret = 0, i;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#######################
|
#######################
|
||||||
# Start LIBRARY swig_ldb
|
# Start LIBRARY swig_ldb
|
||||||
[PYTHON::swig_ldb]
|
[PYTHON::swig_ldb]
|
||||||
PUBLIC_DEPENDENCIES = LIBLDB LIBPYTHON
|
PUBLIC_DEPENDENCIES = LIBLDB
|
||||||
SWIG_FILE = ldb.i
|
SWIG_FILE = ldb.i
|
||||||
# End LIBRARY swig_ldb
|
# End LIBRARY swig_ldb
|
||||||
#######################
|
#######################
|
||||||
|
|||||||
@@ -102,6 +102,6 @@ OBJ_FILES = \
|
|||||||
tests/registry.o
|
tests/registry.o
|
||||||
|
|
||||||
[PYTHON::swig_registry]
|
[PYTHON::swig_registry]
|
||||||
PUBLIC_DEPENDENCIES = registry LIBPYTHON
|
PUBLIC_DEPENDENCIES = registry
|
||||||
SWIG_FILE = registry.i
|
SWIG_FILE = registry.i
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ NTSTATUS ntptr_register(const void *_ops)
|
|||||||
|
|
||||||
NTSTATUS ntptr_init(struct loadparm_context *lp_ctx)
|
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");
|
init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "ntptr");
|
||||||
|
|
||||||
run_init_functions(static_init);
|
run_init_functions(static_init);
|
||||||
|
|||||||
@@ -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)
|
NTSTATUS ntvfs_init(struct loadparm_context *lp_ctx)
|
||||||
{
|
{
|
||||||
static bool initialized = false;
|
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;
|
init_module_fn *shared_init;
|
||||||
|
|
||||||
if (initialized) return NT_STATUS_OK;
|
if (initialized) return NT_STATUS_OK;
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ _PUBLIC_ NTSTATUS sys_notify_init(void)
|
|||||||
{
|
{
|
||||||
static bool initialized = false;
|
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;
|
init_module_fn *shared_init;
|
||||||
|
|
||||||
if (initialized) return NT_STATUS_OK;
|
if (initialized) return NT_STATUS_OK;
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ typedef struct param_context {
|
|||||||
struct param_opt *opt = param_get_add($self, parameter, section_name);
|
struct param_opt *opt = param_get_add($self, parameter, section_name);
|
||||||
|
|
||||||
talloc_free(opt->value);
|
talloc_free(opt->value);
|
||||||
opt->value = talloc_strdup(opt, PyObject_Str(ob));
|
opt->value = talloc_strdup(opt, PyString_AsString(PyObject_Str(ob)));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
struct param_opt *opt = param_get_add(self, parameter, section_name);
|
||||||
|
|
||||||
talloc_free(opt->value);
|
talloc_free(opt->value);
|
||||||
opt->value = talloc_strdup(opt, PyObject_Str(ob));
|
opt->value = talloc_strdup(opt, PyString_AsString(PyObject_Str(ob)));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name
|
|||||||
*/
|
*/
|
||||||
NTSTATUS share_init(void)
|
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);
|
run_init_functions(static_init);
|
||||||
|
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ static NTSTATUS dcesrv_init(struct event_context *event_context,
|
|||||||
|
|
||||||
NTSTATUS server_service_rpc_init(void)
|
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");
|
init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "dcerpc_server");
|
||||||
|
|
||||||
run_init_functions(static_init);
|
run_init_functions(static_init);
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ _PUBLIC_ void ejs_exception(const char *reason)
|
|||||||
*/
|
*/
|
||||||
void smb_setup_ejs_functions(void (*exception_handler)(const char *))
|
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;
|
init_module_fn *shared_init;
|
||||||
|
|
||||||
ejs_exception_handler = exception_handler;
|
ejs_exception_handler = exception_handler;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ fi
|
|||||||
PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
|
PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
|
||||||
PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags`
|
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)
|
AC_MSG_CHECKING(working python module support)
|
||||||
if test x$working_python = xyes
|
if test x$working_python = xyes
|
||||||
@@ -40,10 +40,12 @@ then
|
|||||||
],[
|
],[
|
||||||
Py_InitModule(NULL, NULL);
|
Py_InitModule(NULL, NULL);
|
||||||
],[
|
],[
|
||||||
SMB_ENABLE(LIBPYTHON,YES)
|
SMB_ENABLE(EXT_LIB_PYTHON,YES)
|
||||||
SMB_ENABLE(smbpython,YES)
|
SMB_ENABLE(smbpython,YES)
|
||||||
|
SMB_ENABLE(LIBPYTHON,YES)
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
],[
|
],[
|
||||||
|
SMB_ENABLE(EXT_LIB_PYTHON,NO)
|
||||||
SMB_ENABLE(LIBPYTHON,NO)
|
SMB_ENABLE(LIBPYTHON,NO)
|
||||||
SMB_ENABLE(smbpython,NO)
|
SMB_ENABLE(smbpython,NO)
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
@@ -52,7 +54,8 @@ then
|
|||||||
LIBS="$ac_save_LIBS"
|
LIBS="$ac_save_LIBS"
|
||||||
CFLAGS="$ac_save_CFLAGS"
|
CFLAGS="$ac_save_CFLAGS"
|
||||||
else
|
else
|
||||||
SMB_ENABLE(LIBPYTHON,NO)
|
SMB_ENABLE(EXT_LIB_PYTHON,NO)
|
||||||
|
SMB_ENABLE(LIBPYTHONyy,NO)
|
||||||
SMB_ENABLE(smbpython,NO)
|
SMB_ENABLE(smbpython,NO)
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
[BINARY::smbpython]
|
[BINARY::smbpython]
|
||||||
PRIVATE_DEPENDENCIES = LIBPYTHON
|
PRIVATE_DEPENDENCIES = LIBPYTHON
|
||||||
OBJ_FILES = \
|
OBJ_FILES = smbpython.o
|
||||||
smbpython.o
|
|
||||||
|
[SUBSYSTEM::LIBPYTHON]
|
||||||
|
PUBLIC_DEPENDENCIES = EXT_LIB_PYTHON
|
||||||
|
OBJ_FILES = modules.o
|
||||||
|
|
||||||
[PYTHON::python_uuid]
|
[PYTHON::python_uuid]
|
||||||
PRIVATE_DEPENDENCIES = LIBNDR
|
PRIVATE_DEPENDENCIES = LIBNDR
|
||||||
|
|||||||
45
source/scripting/python/modules.c
Normal file
45
source/scripting/python/modules.c
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
Unix SMB/CIFS implementation.
|
||||||
|
Samba utility functions
|
||||||
|
Copyright (C) Jelmer Vernooij <jelmer@samba.org> 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "includes.h"
|
||||||
|
#include <Python.h>
|
||||||
|
#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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,10 @@
|
|||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
|
|
||||||
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);
|
return Py_Main(argc,argv);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ static PyObject *uuid_random(PyObject *self, PyObject *args)
|
|||||||
struct GUID guid;
|
struct GUID guid;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, ""))
|
if (!PyArg_ParseTuple(args, (char *)""))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
guid = GUID_random();
|
guid = GUID_random();
|
||||||
@@ -51,7 +51,7 @@ PyDoc_STRVAR(param_doc, "UUID helper routines");
|
|||||||
|
|
||||||
PyMODINIT_FUNC inituuid(void)
|
PyMODINIT_FUNC inituuid(void)
|
||||||
{
|
{
|
||||||
PyObject *mod = Py_InitModule3("uuid", methods, param_doc);
|
PyObject *mod = Py_InitModule3((char *)"uuid", methods, param_doc);
|
||||||
if (mod == NULL)
|
if (mod == NULL)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
1
source/selftest/env/Samba4.pm
vendored
1
source/selftest/env/Samba4.pm
vendored
@@ -640,6 +640,7 @@ nogroup:x:65534:nobody
|
|||||||
push (@provision_options, "NSS_WRAPPER_PASSWD=\"$nsswrap_passwd\"");
|
push (@provision_options, "NSS_WRAPPER_PASSWD=\"$nsswrap_passwd\"");
|
||||||
push (@provision_options, "NSS_WRAPPER_GROUP=\"$nsswrap_group\"");
|
push (@provision_options, "NSS_WRAPPER_GROUP=\"$nsswrap_group\"");
|
||||||
if (defined($ENV{PROVISION_PYTHON})) {
|
if (defined($ENV{PROVISION_PYTHON})) {
|
||||||
|
push (@provision_options, "$self->{bindir}/smbpython");
|
||||||
push (@provision_options, "$self->{setupdir}/provision.py");
|
push (@provision_options, "$self->{setupdir}/provision.py");
|
||||||
} else {
|
} else {
|
||||||
push (@provision_options, "$self->{bindir}/smbscript");
|
push (@provision_options, "$self->{bindir}/smbscript");
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ _PUBLIC_ NTSTATUS register_process_model(const void *_ops)
|
|||||||
|
|
||||||
NTSTATUS process_model_init(struct loadparm_context *lp_ctx)
|
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");
|
init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "process_model");
|
||||||
|
|
||||||
run_init_functions(static_init);
|
run_init_functions(static_init);
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[
|
|||||||
bool opt_interactive = false;
|
bool opt_interactive = false;
|
||||||
int opt;
|
int opt;
|
||||||
poptContext pc;
|
poptContext pc;
|
||||||
init_module_fn static_init[] = STATIC_service_MODULES;
|
init_module_fn static_init[] = { STATIC_service_MODULES, NULL };
|
||||||
init_module_fn *shared_init;
|
init_module_fn *shared_init;
|
||||||
struct event_context *event_ctx;
|
struct event_context *event_ctx;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ struct torture_context *torture_context_init(TALLOC_CTX *mem_ctx,
|
|||||||
|
|
||||||
int torture_init(void)
|
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");
|
init_module_fn *shared_init = load_samba_modules(NULL, cmdline_lp_ctx, "torture");
|
||||||
|
|
||||||
run_init_functions(static_init);
|
run_init_functions(static_init);
|
||||||
|
|||||||
Reference in New Issue
Block a user