summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--source4/auth/config.mk6
-rw-r--r--source4/auth/credentials/config.mk6
-rw-r--r--source4/auth/credentials/credentials.py2
-rw-r--r--source4/auth/credentials/credentials_wrap.c65
-rw-r--r--source4/auth/credentials/tests/bindings.py2
-rw-r--r--source4/auth/tests/bindings.py2
-rw-r--r--source4/build/make/python.mk4
-rw-r--r--source4/build/smb_build/config_mk.pm2
-rw-r--r--source4/build/smb_build/input.pm20
-rw-r--r--source4/build/smb_build/main.pl1
-rw-r--r--source4/build/smb_build/makefile.pm9
-rw-r--r--source4/configure.ac2
-rw-r--r--source4/lib/events/config.mk6
-rw-r--r--source4/lib/events/events.py2
-rw-r--r--source4/lib/events/events_wrap.c65
-rw-r--r--source4/lib/events/tests.py2
-rw-r--r--source4/lib/ldb/python.mk6
-rwxr-xr-xsource4/lib/ldb/tests/python/ldap.py4
-rw-r--r--source4/lib/registry/config.mk6
-rw-r--r--source4/lib/registry/tests/bindings.py2
-rw-r--r--source4/lib/replace/libreplace_network.m429
-rw-r--r--source4/lib/socket/config.m416
-rw-r--r--source4/lib/tdb/python.mk7
-rw-r--r--source4/libcli/config.mk13
-rw-r--r--source4/libcli/security/config.mk6
-rw-r--r--source4/libcli/security/tests/bindings.py2
-rw-r--r--source4/libcli/swig/libcli_nbt.py2
-rw-r--r--source4/libcli/swig/libcli_nbt_wrap.c73
-rw-r--r--source4/libnet/config.mk1
-rw-r--r--source4/librpc/config.mk41
-rw-r--r--source4/librpc/rpc/dcerpc.py4
-rw-r--r--source4/librpc/rpc/dcerpc_wrap.c65
-rw-r--r--source4/param/config.mk6
-rw-r--r--source4/param/tests/bindings.py2
-rwxr-xr-xsource4/script/installheader.pl2
-rwxr-xr-xsource4/scripting/bin/subunitrun2
-rw-r--r--source4/scripting/python/config.mk13
-rw-r--r--source4/scripting/python/samba/__init__.py2
-rw-r--r--source4/scripting/python/samba/provision.py74
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/registry.py2
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/rpcecho.py2
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/sam.py2
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/unix.py2
-rw-r--r--source4/scripting/python/samba/tests/provision.py2
-rwxr-xr-xsource4/selftest/samba4_tests.sh2
-rwxr-xr-x[-rw-r--r--]source4/setup/enableaccount8
-rw-r--r--source4/setup/krb5.conf17
-rw-r--r--source4/setup/named.conf14
-rwxr-xr-xsource4/setup/newuser2
-rwxr-xr-xsource4/setup/provision4
-rw-r--r--source4/setup/provision_basedn_modify.ldif2
-rw-r--r--source4/setup/setpassword7
-rwxr-xr-xsource4/setup/tests/blackbox_newuser.sh21
-rwxr-xr-xsource4/setup/tests/blackbox_provision.sh19
-rwxr-xr-xsource4/setup/tests/blackbox_setpassword.sh22
-rwxr-xr-xsource4/setup/upgrade4
-rwxr-xr-xtestprogs/blackbox/subunit.sh4
-rwxr-xr-xtestprogs/blackbox/test_kinit.sh2
59 files changed, 486 insertions, 232 deletions
diff --git a/.gitignore b/.gitignore
index 5ed4eeda44..1e574f0059 100644
--- a/.gitignore
+++ b/.gitignore
@@ -194,3 +194,9 @@ source/apidocs
source/mkconfig.mk
source/data.mk
source/librpc/idl-deps
+source/libcli/netlogon_proto.h
+source/libcli/ndr_netlogon_proto.h
+source/foo.tdb
+source/gentest_seeds.dat
+source/templates.ldb
+source/torture.tdb
diff --git a/source4/auth/config.mk b/source4/auth/config.mk
index 7d31a6a0c0..f13c2e5758 100644
--- a/source4/auth/config.mk
+++ b/source4/auth/config.mk
@@ -37,8 +37,12 @@ auth_sam_reply_OBJ_FILES = $(addprefix $(authsrcdir)/, auth_sam_reply.o)
$(eval $(call proto_header_template,$(authsrcdir)/auth_sam_reply.h,$(auth_sam_reply_OBJ_FILES:.o=.c)))
[PYTHON::swig_auth]
+LIBRARY_REALNAME = samba/_auth.$(SHLIBEXT)
PUBLIC_DEPENDENCIES = auth_system_session
PRIVATE_DEPENDENCIES = SAMDB
-SWIG_FILE = auth.i
+
+$(eval $(call python_py_module_template,samba/auth.py,$(authsrcdir)/auth.py))
swig_auth_OBJ_FILES = $(authsrcdir)/auth_wrap.o
+
+$(swig_auth_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
diff --git a/source4/auth/credentials/config.mk b/source4/auth/credentials/config.mk
index d71a8238a5..2eeeec20ec 100644
--- a/source4/auth/credentials/config.mk
+++ b/source4/auth/credentials/config.mk
@@ -14,7 +14,11 @@ $(eval $(call proto_header_template,$(authsrcdir)/credentials/credentials_proto.
PUBLIC_HEADERS += $(authsrcdir)/credentials/credentials.h
[PYTHON::swig_credentials]
+LIBRARY_REALNAME = samba/_credentials.$(SHLIBEXT)
PUBLIC_DEPENDENCIES = CREDENTIALS LIBCMDLINE_CREDENTIALS
-SWIG_FILE = credentials.i
+
+$(eval $(call python_py_module_template,samba/credentials.py,$(authsrcdir)/credentials/credentials.py))
swig_credentials_OBJ_FILES = $(authsrcdir)/credentials/credentials_wrap.o
+
+$(swig_credentials_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
diff --git a/source4/auth/credentials/credentials.py b/source4/auth/credentials/credentials.py
index ba0000dcda..b2f2c4ecdd 100644
--- a/source4/auth/credentials/credentials.py
+++ b/source4/auth/credentials/credentials.py
@@ -1,5 +1,5 @@
# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
#
# Don't modify this file, modify the SWIG interface instead.
diff --git a/source4/auth/credentials/credentials_wrap.c b/source4/auth/credentials/credentials_wrap.c
index 6c99802b09..d460f31927 100644
--- a/source4/auth/credentials/credentials_wrap.c
+++ b/source4/auth/credentials/credentials_wrap.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -126,7 +126,7 @@
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
@@ -161,6 +161,7 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
+#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
extern "C" {
#endif
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
@@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}
/*
@@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg)
Py_DECREF(old_str);
Py_DECREF(value);
} else {
- PyErr_Format(PyExc_RuntimeError, mesg);
+ PyErr_SetString(PyExc_RuntimeError, mesg);
}
}
@@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v)
{
PySwigObject *sobj = (PySwigObject *) v;
PyObject *next = sobj->next;
- if (sobj->own) {
+ if (sobj->own == SWIG_POINTER_OWN) {
swig_type_info *ty = sobj->ty;
PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
PyObject *destroy = data ? data->destroy : 0;
@@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v)
res = ((*meth)(mself, v));
}
Py_XDECREF(res);
- } else {
- const char *name = SWIG_TypePrettyName(ty);
+ }
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
- printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
-#endif
+ else {
+ const char *name = SWIG_TypePrettyName(ty);
+ printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
}
+#endif
}
Py_XDECREF(next);
PyObject_DEL(v);
@@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
- if (own) {
+ if (own == SWIG_POINTER_OWN) {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
if (sobj) {
int oldown = sobj->own;
@@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
return SWIG_OK;
} else {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+ if (own)
+ *own = 0;
while (sobj) {
void *vptr = sobj->ptr;
if (ty) {
@@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
if (!tc) {
sobj = (PySwigObject *)sobj->next;
} else {
- if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
+ if (ptr) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+ if (newmemory == SWIG_CAST_NEW_MEMORY) {
+ assert(own);
+ if (own)
+ *own = *own | SWIG_CAST_NEW_MEMORY;
+ }
+ }
break;
}
}
@@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
}
}
if (sobj) {
- if (own) *own = sobj->own;
+ if (own)
+ *own = *own | sobj->own;
if (flags & SWIG_POINTER_DISOWN) {
sobj->own = 0;
}
@@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
}
if (ty) {
swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
- if (!tc) return SWIG_ERROR;
- *ptr = SWIG_TypeCast(tc,vptr);
+ if (tc) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ } else {
+ return SWIG_ERROR;
+ }
} else {
*ptr = vptr;
}
@@ -2506,7 +2524,7 @@ static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0};
#define SWIG_name "_credentials"
-#define SWIGVERSION 0x010333
+#define SWIGVERSION 0x010335
#define SWIG_VERSION SWIGVERSION
@@ -3845,7 +3863,7 @@ SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
swig_module_info *module_head, *iter;
- int found;
+ int found, init;
clientdata = clientdata;
@@ -3855,6 +3873,9 @@ SWIG_InitializeModule(void *clientdata) {
swig_module.type_initial = swig_type_initial;
swig_module.cast_initial = swig_cast_initial;
swig_module.next = &swig_module;
+ init = 1;
+ } else {
+ init = 0;
}
/* Try and load any already created modules */
@@ -3883,6 +3904,12 @@ SWIG_InitializeModule(void *clientdata) {
module_head->next = &swig_module;
}
+ /* When multiple interpeters are used, a module could have already been initialized in
+ a different interpreter, but not yet have a pointer in this interpreter.
+ In this case, we do not want to continue adding types... everything should be
+ set up already */
+ if (init == 0) return;
+
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
diff --git a/source4/auth/credentials/tests/bindings.py b/source4/auth/credentials/tests/bindings.py
index d0a99502c1..30120b3a60 100644
--- a/source4/auth/credentials/tests/bindings.py
+++ b/source4/auth/credentials/tests/bindings.py
@@ -24,7 +24,7 @@ the functionality, that's already done in other tests.
"""
import unittest
-import credentials
+from samba import credentials
class CredentialsTests(unittest.TestCase):
def setUp(self):
diff --git a/source4/auth/tests/bindings.py b/source4/auth/tests/bindings.py
index 4a4b12bf69..b7a5994675 100644
--- a/source4/auth/tests/bindings.py
+++ b/source4/auth/tests/bindings.py
@@ -24,7 +24,7 @@ the functionality, that's already done in other tests.
"""
import unittest
-import auth
+from samba import auth
class AuthTests(unittest.TestCase):
def test_system_session(self):
diff --git a/source4/build/make/python.mk b/source4/build/make/python.mk
index 7d957fb108..66e5def8f0 100644
--- a/source4/build/make/python.mk
+++ b/source4/build/make/python.mk
@@ -43,9 +43,9 @@ endef
# Swig extensions
swig:: pythonmods
-.SUFFIXES: _wrap.c .i
+.SUFFIXES: _wrap.c .i .py
-.i_wrap.c:
+%_wrap.c %.py: %.i
[ "$(SWIG)" == "no" ] || $(SWIG) -O -Wall -I$(srcdir)/scripting/swig -python -keyword $<
realdistclean::
diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm
index d28adb2e72..652a52fa60 100644
--- a/source4/build/smb_build/config_mk.pm
+++ b/source4/build/smb_build/config_mk.pm
@@ -20,7 +20,7 @@ my $section_types = {
"LDFLAGS" => "list",
},
"PYTHON" => {
- SWIG_FILE => "string",
+ "LIBRARY_REALNAME" => "string",
"PRIVATE_DEPENDENCIES" => "list",
"PUBLIC_DEPENDENCIES" => "list",
"ENABLE" => "bool",
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index 7028d2ab17..a76da496d9 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -138,24 +138,12 @@ sub check_python($$$)
$python->{INSTALLDIR} = "PYTHONDIR";
unless (defined($python->{CFLAGS})) { $python->{CFLAGS} = []; }
- if (defined($python->{SWIG_FILE})) {
- my $dirname = dirname($python->{SWIG_FILE});
- my $basename = basename($python->{SWIG_FILE}, ".i");
-
- $dirname .= "/" unless $dirname =~ /\/$/;
- $dirname = "" if $dirname eq "./";
-
- $python->{LIBRARY_REALNAME} = "_$basename.\$(SHLIBEXT)";
- $python->{PYTHON_FILES} = ["$dirname$basename.py"];
- push (@{$python->{CFLAGS}}, "\$(CFLAG_NO_UNUSED_MACROS)");
- push (@{$python->{CFLAGS}}, "\$(CFLAG_NO_CAST_QUAL)");
- $python->{INIT_FUNCTION} = "{ (char *)\"_$basename\", init_$basename }";
- } else {
- my $basename = $python->{NAME};
- $basename =~ s/^python_//g;
+ my $basename = $python->{NAME};
+ $basename =~ s/^python_//g;
+ unless (defined($python->{LIBRARY_REALNAME})) {
$python->{LIBRARY_REALNAME} = "$basename.\$(SHLIBEXT)";
- $python->{INIT_FUNCTION} = "{ (char *)\"$basename\", init$basename }";
}
+ $python->{INIT_FUNCTION} = "{ (char *)\"$basename\", init$basename }";
push (@{$python->{CFLAGS}}, "\$(EXT_LIB_PYTHON_CFLAGS)");
$python->{SUBSYSTEM} = "LIBPYTHON";
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl
index b31bfaa1f2..88289af26d 100644
--- a/source4/build/smb_build/main.pl
+++ b/source4/build/smb_build/main.pl
@@ -70,7 +70,6 @@ foreach my $key (values %$OUTPUT) {
${$key->{OUTPUT_TYPE}}[0] eq "SHARED_LIBRARY") {
$shared_libs_used = 1;
}
- $mkenv->PythonFiles($key) if defined($key->{PYTHON_FILES});
if ($key->{TYPE} eq "MODULE" and @{$key->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ" and defined($key->{INIT_FUNCTION})) {
$mkenv->output("$key->{SUBSYSTEM}_INIT_FUNCTIONS += $key->{INIT_FUNCTION},\n");
}
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index a0fee2736b..0269cfe8a3 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -214,15 +214,6 @@ $self->output("\$(call binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NA
}
}
-sub PythonFiles($$)
-{
- my ($self,$ctx) = @_;
-
- foreach (@{$ctx->{PYTHON_FILES}}) {
- $self->output("\$(eval \$(call python_py_module_template," . basename($_) . ",\$(addprefix $ctx->{BASEDIR}/, $_)))\n");
- }
-}
-
sub write($$)
{
my ($self, $file) = @_;
diff --git a/source4/configure.ac b/source4/configure.ac
index 34657cf6f9..73d3ffd4d9 100644
--- a/source4/configure.ac
+++ b/source4/configure.ac
@@ -162,7 +162,7 @@ CPPFLAGS="$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -I
SMB_WRITE_PERLVARS(build/smb_build/config.pm)
-../../source/echo "configure: creating config.mk"
+echo "configure: creating config.mk"
cat >config.mk<<CEOF
# config.mk - Autogenerated by configure, DO NOT EDIT!
$SMB_INFO_EXT_LIBS
diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk
index 3a20770427..9d579807c8 100644
--- a/source4/lib/events/config.mk
+++ b/source4/lib/events/config.mk
@@ -52,7 +52,11 @@ LIBEVENTS_OBJ_FILES = $(addprefix $(libeventssrcdir)/, events.o events_timed.o e
PUBLIC_HEADERS += $(addprefix $(libeventssrcdir)/, events.h events_internal.h)
[PYTHON::swig_events]
-SWIG_FILE = events.i
+LIBRARY_REALNAME = samba/_events.$(SHLIBEXT)
PRIVATE_DEPENDENCIES = LIBEVENTS LIBSAMBA-HOSTCONFIG
swig_events_OBJ_FILES = $(libeventssrcdir)/events_wrap.o
+
+$(eval $(call python_py_module_template,samba/events.py,$(libeventssrcdir)/events.py))
+
+$(swig_events_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
diff --git a/source4/lib/events/events.py b/source4/lib/events/events.py
index d8f70f6319..237726897d 100644
--- a/source4/lib/events/events.py
+++ b/source4/lib/events/events.py
@@ -1,5 +1,5 @@
# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
#
# Don't modify this file, modify the SWIG interface instead.
diff --git a/source4/lib/events/events_wrap.c b/source4/lib/events/events_wrap.c
index 9dbbb08734..727485dfdb 100644
--- a/source4/lib/events/events_wrap.c
+++ b/source4/lib/events/events_wrap.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -126,7 +126,7 @@
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
@@ -161,6 +161,7 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
+#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
extern "C" {
#endif
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
@@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}
/*
@@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg)
Py_DECREF(old_str);
Py_DECREF(value);
} else {
- PyErr_Format(PyExc_RuntimeError, mesg);
+ PyErr_SetString(PyExc_RuntimeError, mesg);
}
}
@@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v)
{
PySwigObject *sobj = (PySwigObject *) v;
PyObject *next = sobj->next;
- if (sobj->own) {
+ if (sobj->own == SWIG_POINTER_OWN) {
swig_type_info *ty = sobj->ty;
PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
PyObject *destroy = data ? data->destroy : 0;
@@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v)
res = ((*meth)(mself, v));
}
Py_XDECREF(res);
- } else {
- const char *name = SWIG_TypePrettyName(ty);
+ }
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
- printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
-#endif
+ else {
+ const char *name = SWIG_TypePrettyName(ty);
+ printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
}
+#endif
}
Py_XDECREF(next);
PyObject_DEL(v);
@@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
- if (own) {
+ if (own == SWIG_POINTER_OWN) {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
if (sobj) {
int oldown = sobj->own;
@@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
return SWIG_OK;
} else {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+ if (own)
+ *own = 0;
while (sobj) {
void *vptr = sobj->ptr;
if (ty) {
@@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
if (!tc) {
sobj = (PySwigObject *)sobj->next;
} else {
- if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
+ if (ptr) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+ if (newmemory == SWIG_CAST_NEW_MEMORY) {
+ assert(own);
+ if (own)
+ *own = *own | SWIG_CAST_NEW_MEMORY;
+ }
+ }
break;
}
}
@@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
}
}
if (sobj) {
- if (own) *own = sobj->own;
+ if (own)
+ *own = *own | sobj->own;
if (flags & SWIG_POINTER_DISOWN) {
sobj->own = 0;
}
@@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
}
if (ty) {
swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
- if (!tc) return SWIG_ERROR;
- *ptr = SWIG_TypeCast(tc,vptr);
+ if (tc) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ } else {
+ return SWIG_ERROR;
+ }
} else {
*ptr = vptr;
}
@@ -2493,7 +2511,7 @@ static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0};
#define SWIG_name "_events"
-#define SWIGVERSION 0x010333
+#define SWIGVERSION 0x010335
#define SWIG_VERSION SWIGVERSION
@@ -2860,7 +2878,7 @@ SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
swig_module_info *module_head, *iter;
- int found;
+ int found, init;
clientdata = clientdata;
@@ -2870,6 +2888,9 @@ SWIG_InitializeModule(void *clientdata) {
swig_module.type_initial = swig_type_initial;
swig_module.cast_initial = swig_cast_initial;
swig_module.next = &swig_module;
+ init = 1;
+ } else {
+ init = 0;
}
/* Try and load any already created modules */
@@ -2898,6 +2919,12 @@ SWIG_InitializeModule(void *clientdata) {
module_head->next = &swig_module;
}
+ /* When multiple interpeters are used, a module could have already been initialized in
+ a different interpreter, but not yet have a pointer in this interpreter.
+ In this case, we do not want to continue adding types... everything should be
+ set up already */
+ if (init == 0) return;
+
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
diff --git a/source4/lib/events/tests.py b/source4/lib/events/tests.py
index b14f7e6250..006426207e 100644
--- a/source4/lib/events/tests.py
+++ b/source4/lib/events/tests.py
@@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-import events
+from samba import events
import unittest
# Just test the bindings are there and that calling them doesn't crash
diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk
index 448cc3ed60..89aba8f276 100644
--- a/source4/lib/ldb/python.mk
+++ b/source4/lib/ldb/python.mk
@@ -1,6 +1,10 @@
[PYTHON::swig_ldb]
+LIBRARY_REALNAME = _ldb.$(SHLIBEXT)
PUBLIC_DEPENDENCIES = LIBLDB
CFLAGS = -Ilib/ldb/include
-SWIG_FILE = ldb.i
swig_ldb_OBJ_FILES = lib/ldb/ldb_wrap.o
+
+$(eval $(call python_py_module_template,ldb.py,lib/ldb/ldb.py))
+
+$(swig_ldb_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py
index 7cbe6e5e7d..c76222c207 100755
--- a/source4/lib/ldb/tests/python/ldap.py
+++ b/source4/lib/ldb/tests/python/ldap.py
@@ -10,14 +10,14 @@ sys.path.append("bin/python")
import samba.getopt as options
-from auth import system_session
+from samba.auth import system_session
from ldb import (SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError,
LDB_ERR_NO_SUCH_OBJECT, LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS,
LDB_ERR_ENTRY_ALREADY_EXISTS, LDB_ERR_UNWILLING_TO_PERFORM,
LDB_ERR_NOT_ALLOWED_ON_NON_LEAF, LDB_ERR_OTHER)
from samba import Ldb
from subunit import SubunitTestRunner
-import param
+from samba import param
import unittest
parser = optparse.OptionParser("ldap [options] <host>")
diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk
index c0ad613c52..44adc53524 100644
--- a/source4/lib/registry/config.mk
+++ b/source4/lib/registry/config.mk
@@ -105,7 +105,11 @@ torture_registry_OBJ_FILES = $(addprefix $(libregistrysrcdir)/tests/, generic.o
$(eval $(call proto_header_template,$(libregistrysrcdir)/tests/proto.h,$(torture_registry_OBJ_FILES:.o=.c)))
[PYTHON::swig_registry]
+LIBRARY_REALNAME = samba/_registry.$(SHLIBEXT)
PUBLIC_DEPENDENCIES = registry
-SWIG_FILE = registry.i
swig_registry_OBJ_FILES = $(libregistrysrcdir)/registry_wrap.o
+
+$(eval $(call python_py_module_template,samba/registry.py,lib/registry/registry.py))
+
+$(swig_registry_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
diff --git a/source4/lib/registry/tests/bindings.py b/source4/lib/registry/tests/bindings.py
index 314cf778a1..1fb5c70b70 100644
--- a/source4/lib/registry/tests/bindings.py
+++ b/source4/lib/registry/tests/bindings.py
@@ -19,7 +19,7 @@
import os
import unittest
-import registry
+from samba import registry
import samba.tests
class HelperTests(unittest.TestCase):
diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4
index f2d177b165..6cde6b9e0c 100644
--- a/source4/lib/replace/libreplace_network.m4
+++ b/source4/lib/replace/libreplace_network.m4
@@ -339,6 +339,35 @@ if test x"$libreplace_cv_HAVE_IFACE_IFREQ" = x"yes"; then
fi
fi
+dnl test for ipv6
+AC_CACHE_CHECK([for ipv6 support],libreplace_cv_HAVE_IPV6,[
+ AC_TRY_COMPILE([
+#include <stdlib.h> /* for NULL */
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netdb.h>
+ ],
+ [
+struct sockaddr_storage sa_store;
+struct addrinfo *ai = NULL;
+struct in6_addr in6addr;
+int idx = if_nametoindex("iface1");
+int s = socket(AF_INET6, SOCK_STREAM, 0);
+int ret = getaddrinfo(NULL, NULL, NULL, &ai);
+if (ret != 0) {
+ const char *es = gai_strerror(ret);
+}
+freeaddrinfo(ai);
+ ],[
+ libreplace_cv_HAVE_IPV6=yes
+ ],[
+ libreplace_cv_HAVE_IPV6=no
+ ])
+])
+if test x"$libreplace_cv_HAVE_IPV6" = x"yes"; then
+ AC_DEFINE(HAVE_IPV6,1,[Whether the system has IPv6 support])
+fi
+
LIBS=$old_LIBS
CPPFLAGS="$SAVE_CPPFLAGS"
diff --git a/source4/lib/socket/config.m4 b/source4/lib/socket/config.m4
index 871c57f97c..9c0072dd8b 100644
--- a/source4/lib/socket/config.m4
+++ b/source4/lib/socket/config.m4
@@ -1,5 +1,6 @@
AC_CHECK_FUNCS(writev)
AC_CHECK_FUNCS(readv)
+AC_CHECK_FUNCS(gethostbyname2)
############################################
# check for unix domain sockets
@@ -9,17 +10,10 @@ if test x"$libreplace_cv_HAVE_UNIXSOCKET" = x"yes"; then
SMB_ENABLE(socket_unix, YES)
fi
-dnl test for ipv6 using the gethostbyname2() function. That should be sufficient
-dnl for now
-AC_CHECK_FUNCS(gethostbyname2, have_ipv6=true, have_ipv6=false)
+############################################
+# check for ipv6
+# done by AC_LIBREPLACE_NETWORK_CHECKS
SMB_ENABLE(socket_ipv6, NO)
-if $have_ipv6 = true; then
+if test x"$libreplace_cv_HAVE_IPV6" = x"yes"; then
SMB_ENABLE(socket_ipv6, YES)
- AC_DEFINE(HAVE_IPV6,1,[Whether the system has ipv6 support])
fi
-dnl don't build ipv6 by default, unless the above test enables it, or
-dnl the configure uses --with-static-modules=socket_ipv6
-
-
-
-
diff --git a/source4/lib/tdb/python.mk b/source4/lib/tdb/python.mk
index 2d61545b7f..83336e7b41 100644
--- a/source4/lib/tdb/python.mk
+++ b/source4/lib/tdb/python.mk
@@ -1,5 +1,10 @@
[PYTHON::swig_tdb]
-SWIG_FILE = tdb.i
+LIBRARY_REALNAME = _tdb.$(SHLIBEXT)
PUBLIC_DEPENDENCIES = LIBTDB DYNCONFIG
swig_tdb_OBJ_FILES = lib/tdb/tdb_wrap.o
+
+$(eval $(call python_py_module_template,tdb.py,lib/tdb/tdb.py))
+
+$(swig_tdb_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
+
diff --git a/source4/libcli/config.mk b/source4/libcli/config.mk
index 16e23430d7..b24f3eb4af 100644
--- a/source4/libcli/config.mk
+++ b/source4/libcli/config.mk
@@ -75,17 +75,26 @@ LIBCLI_NETLOGON_OBJ_FILES = $(addprefix libcli/, \
$(eval $(call proto_header_template,$(libclisrcdir)/netlogon_proto.h,$(LIBCLI_NETLOGON_OBJ_FILES:.o=.c)))
[PYTHON::python_libcli_nbt]
-SWIG_FILE = swig/libcli_nbt.i
+LIBRARY_REALNAME = samba/_libcli_nbt.$(SHLIBEXT)
PUBLIC_DEPENDENCIES = LIBCLI_NBT DYNCONFIG LIBSAMBA-HOSTCONFIG
python_libcli_nbt_OBJ_FILES = $(libclisrcdir)/swig/libcli_nbt_wrap.o
+$(eval $(call python_py_module_template,samba/nbt.py,$(libclisrcdir)/swig/libcli_nbt.py))
+
+$(python_libcli_nbt_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
+
[PYTHON::python_libcli_smb]
-SWIG_FILE = swig/libcli_smb.i
+LIBRARY_REALNAME = samba/_libcli_smb.$(SHLIBEXT)
PUBLIC_DEPENDENCIES = LIBCLI_SMB DYNCONFIG LIBSAMBA-HOSTCONFIG
python_libcli_smb_OBJ_FILES = $(libclisrcdir)/swig/libcli_smb_wrap.o
+$(eval $(call python_py_module_template,samba/smb.py,$(libclisrcdir)/swig/libcli_smb.py))
+
+$(python_libcli_smb_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
+
+
[SUBSYSTEM::LIBCLI_DGRAM]
PUBLIC_DEPENDENCIES = LIBCLI_NBT LIBNDR LIBCLI_RESOLVE LIBCLI_NETLOGON
diff --git a/source4/libcli/security/config.mk b/source4/libcli/security/config.mk
index 63e54fac8a..f2883d1ede 100644
--- a/source4/libcli/security/config.mk
+++ b/source4/libcli/security/config.mk
@@ -8,7 +8,11 @@ LIBSECURITY_OBJ_FILES = $(addprefix $(libclisrcdir)/security/, \
$(eval $(call proto_header_template,$(libclisrcdir)/security/proto.h,$(LIBSECURITY_OBJ_FILES:.o=.c)))
[PYTHON::swig_security]
-SWIG_FILE = security.i
+LIBRARY_REALNAME = samba/_security.$(SHLIBEXT)
PRIVATE_DEPENDENCIES = LIBSECURITY
swig_security_OBJ_FILES = $(libclisrcdir)/security/security_wrap.o
+
+$(eval $(call python_py_module_template,samba/security.py,$(libclisrcdir)/security/security.py))
+
+$(swig_security_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
diff --git a/source4/libcli/security/tests/bindings.py b/source4/libcli/security/tests/bindings.py
index 59a5e69640..82ce7aeba8 100644
--- a/source4/libcli/security/tests/bindings.py
+++ b/source4/libcli/security/tests/bindings.py
@@ -18,7 +18,7 @@
#
import unittest
-import security
+from samba import security
class SecurityTokenTests(unittest.TestCase):
def setUp(self):
diff --git a/source4/libcli/swig/libcli_nbt.py b/source4/libcli/swig/libcli_nbt.py
index b49e240bc2..a26aa6092e 100644
--- a/source4/libcli/swig/libcli_nbt.py
+++ b/source4/libcli/swig/libcli_nbt.py
@@ -1,5 +1,5 @@
# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
#
# Don't modify this file, modify the SWIG interface instead.
diff --git a/source4/libcli/swig/libcli_nbt_wrap.c b/source4/libcli/swig/libcli_nbt_wrap.c
index e0bdb27cfc..2deec98cb5 100644
--- a/source4/libcli/swig/libcli_nbt_wrap.c
+++ b/source4/libcli/swig/libcli_nbt_wrap.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -126,7 +126,7 @@
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
@@ -161,6 +161,7 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
+#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
extern "C" {
#endif
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
@@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}
/*
@@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg)
Py_DECREF(old_str);
Py_DECREF(value);
} else {
- PyErr_Format(PyExc_RuntimeError, mesg);
+ PyErr_SetString(PyExc_RuntimeError, mesg);
}
}
@@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v)
{
PySwigObject *sobj = (PySwigObject *) v;
PyObject *next = sobj->next;
- if (sobj->own) {
+ if (sobj->own == SWIG_POINTER_OWN) {
swig_type_info *ty = sobj->ty;
PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
PyObject *destroy = data ? data->destroy : 0;
@@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v)
res = ((*meth)(mself, v));
}
Py_XDECREF(res);
- } else {
- const char *name = SWIG_TypePrettyName(ty);
+ }
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
- printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
-#endif
+ else {
+ const char *name = SWIG_TypePrettyName(ty);
+ printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
}
+#endif
}
Py_XDECREF(next);
PyObject_DEL(v);
@@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
- if (own) {
+ if (own == SWIG_POINTER_OWN) {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
if (sobj) {
int oldown = sobj->own;
@@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
return SWIG_OK;
} else {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+ if (own)
+ *own = 0;
while (sobj) {
void *vptr = sobj->ptr;
if (ty) {
@@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
if (!tc) {
sobj = (PySwigObject *)sobj->next;
} else {
- if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
+ if (ptr) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+ if (newmemory == SWIG_CAST_NEW_MEMORY) {
+ assert(own);
+ if (own)
+ *own = *own | SWIG_CAST_NEW_MEMORY;
+ }
+ }
break;
}
}
@@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
}
}
if (sobj) {
- if (own) *own = sobj->own;
+ if (own)
+ *own = *own | sobj->own;
if (flags & SWIG_POINTER_DISOWN) {
sobj->own = 0;
}
@@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
}
if (ty) {
swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
- if (!tc) return SWIG_ERROR;
- *ptr = SWIG_TypeCast(tc,vptr);
+ if (tc) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ } else {
+ return SWIG_ERROR;
+ }
} else {
*ptr = vptr;
}
@@ -2507,7 +2525,7 @@ static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0};
#define SWIG_name "_libcli_nbt"
-#define SWIGVERSION 0x010333
+#define SWIGVERSION 0x010335
#define SWIG_VERSION SWIGVERSION
@@ -3134,7 +3152,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name(PyObject *SWIGUNUSEDPARM(self), PyObject
struct nbt_name *result = 0 ;
if (!SWIG_Python_UnpackTuple(args,"new_nbt_name",0,0,0)) SWIG_fail;
- result = (struct nbt_name *)(struct nbt_name *) calloc(1, sizeof(struct nbt_name));
+ result = (struct nbt_name *)calloc(1, sizeof(struct nbt_name));
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name, SWIG_POINTER_NEW | 0 );
return resultobj;
fail:
@@ -3227,7 +3245,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name_query(PyObject *SWIGUNUSEDPARM(self), Py
struct nbt_name_query *result = 0 ;
if (!SWIG_Python_UnpackTuple(args,"new_nbt_name_query",0,0,0)) SWIG_fail;
- result = (struct nbt_name_query *)(struct nbt_name_query *) calloc(1, sizeof(struct nbt_name_query));
+ result = (struct nbt_name_query *)calloc(1, sizeof(struct nbt_name_query));
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_query, SWIG_POINTER_NEW | 0 );
return resultobj;
fail:
@@ -3493,7 +3511,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name_query_out(PyObject *SWIGUNUSEDPARM(self)
nbt_name_query_out *result = 0 ;
if (!SWIG_Python_UnpackTuple(args,"new_nbt_name_query_out",0,0,0)) SWIG_fail;
- result = (nbt_name_query_out *)(nbt_name_query_out *) calloc(1, sizeof(nbt_name_query_out));
+ result = (nbt_name_query_out *)calloc(1, sizeof(nbt_name_query_out));
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_query_out, SWIG_POINTER_NEW | 0 );
return resultobj;
fail:
@@ -3865,7 +3883,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name_query_in(PyObject *SWIGUNUSEDPARM(self),
nbt_name_query_in *result = 0 ;
if (!SWIG_Python_UnpackTuple(args,"new_nbt_name_query_in",0,0,0)) SWIG_fail;
- result = (nbt_name_query_in *)(nbt_name_query_in *) calloc(1, sizeof(nbt_name_query_in));
+ result = (nbt_name_query_in *)calloc(1, sizeof(nbt_name_query_in));
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_query_in, SWIG_POINTER_NEW | 0 );
return resultobj;
fail:
@@ -4280,7 +4298,7 @@ SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
swig_module_info *module_head, *iter;
- int found;
+ int found, init;
clientdata = clientdata;
@@ -4290,6 +4308,9 @@ SWIG_InitializeModule(void *clientdata) {
swig_module.type_initial = swig_type_initial;
swig_module.cast_initial = swig_cast_initial;
swig_module.next = &swig_module;
+ init = 1;
+ } else {
+ init = 0;
}
/* Try and load any already created modules */
@@ -4318,6 +4339,12 @@ SWIG_InitializeModule(void *clientdata) {
module_head->next = &swig_module;
}
+ /* When multiple interpeters are used, a module could have already been initialized in
+ a different interpreter, but not yet have a pointer in this interpreter.
+ In this case, we do not want to continue adding types... everything should be
+ set up already */
+ if (init == 0) return;
+
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
diff --git a/source4/libnet/config.mk b/source4/libnet/config.mk
index f60ca6d94d..fac8af18b7 100644
--- a/source4/libnet/config.mk
+++ b/source4/libnet/config.mk
@@ -12,6 +12,7 @@ LIBSAMBA-NET_OBJ_FILES = $(addprefix $(libnetsrcdir)/, \
$(eval $(call proto_header_template,$(libnetsrcdir)/libnet_proto.h,$(LIBSAMBA-NET_OBJ_FILES:.o=.c)))
[PYTHON::python_net]
+LIBRARY_REALNAME = samba/net.$(SHLIBEXT)
PRIVATE_DEPENDENCIES = LIBSAMBA-NET
python_net_OBJ_FILES = $(libnetsrcdir)/py_net.o
diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk
index 69dafb34c6..cbb0d19564 100644
--- a/source4/librpc/config.mk
+++ b/source4/librpc/config.mk
@@ -722,83 +722,102 @@ PRIVATE_DEPENDENCIES = dcerpc NDR_IRPC EJSRPC
RPC_EJS_IRPC_OBJ_FILES = $(gen_ndrsrcdir)/ndr_irpc_ejs.o
[PYTHON::swig_dcerpc]
-SWIG_FILE = rpc/dcerpc.i
+LIBRARY_REALNAME = samba/dcerpc/_dcerpc.$(SHLIBEXT)
PUBLIC_DEPENDENCIES = LIBCLI_SMB NDR_MISC LIBSAMBA-UTIL LIBSAMBA-HOSTCONFIG dcerpc_samr RPC_NDR_LSA DYNCONFIG
swig_dcerpc_OBJ_FILES = $(dcerpcsrcdir)/dcerpc_wrap.o
+$(eval $(call python_py_module_template,samba/dcerpc/__init__.py,$(dcerpcsrcdir)/dcerpc.py))
+
+$(swig_dcerpc_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
+
[PYTHON::python_echo]
+LIBRARY_REALNAME = samba/dcerpc/echo.$(SHLIBEXT)
PRIVATE_DEPENDENCIES = RPC_NDR_ECHO PYTALLOC param swig_credentials
python_echo_OBJ_FILES = $(gen_ndrsrcdir)/py_echo.o
[PYTHON::python_winreg]
-PRIVATE_DEPENDENCIES = RPC_NDR_WINREG python_misc PYTALLOC param swig_credentials
+LIBRARY_REALNAME = samba/dcerpc/winreg.$(SHLIBEXT)
+PRIVATE_DEPENDENCIES = RPC_NDR_WINREG python_misc PYTALLOC param swig_credentials python_dcerpc_misc python_lsa
python_winreg_OBJ_FILES = $(gen_ndrsrcdir)/py_winreg.o
[PYTHON::python_dcerpc_misc]
+LIBRARY_REALNAME = samba/dcerpc/misc.$(SHLIBEXT)
PRIVATE_DEPENDENCIES = PYTALLOC
python_dcerpc_misc_OBJ_FILES = $(gen_ndrsrcdir)/py_misc.o
[PYTHON::python_initshutdown]
-PRIVATE_DEPENDENCIES = RPC_NDR_INITSHUTDOWN PYTALLOC param swig_credentials
+LIBRARY_REALNAME = samba/dcerpc/initshutdown.$(SHLIBEXT)
+PRIVATE_DEPENDENCIES = RPC_NDR_INITSHUTDOWN PYTALLOC param swig_credentials python_lsa python_dcerpc_security
python_initshutdown_OBJ_FILES = $(gen_ndrsrcdir)/py_initshutdown.o
[PYTHON::python_epmapper]
-PRIVATE_DEPENDENCIES = PYTALLOC param swig_credentials
+LIBRARY_REALNAME = samba/dcerpc/epmapper.$(SHLIBEXT)
+PRIVATE_DEPENDENCIES = dcerpc PYTALLOC param swig_credentials python_dcerpc_misc
python_epmapper_OBJ_FILES = $(gen_ndrsrcdir)/py_epmapper.o
[PYTHON::python_mgmt]
-PRIVATE_DEPENDENCIES = dcerpc_mgmt PYTALLOC param swig_credentials
+LIBRARY_REALNAME = samba/dcerpc/mgmt.$(SHLIBEXT)
+PRIVATE_DEPENDENCIES = PYTALLOC param swig_credentials dcerpc python_dcerpc_misc
python_mgmt_OBJ_FILES = $(gen_ndrsrcdir)/py_mgmt.o
[PYTHON::python_atsvc]
+LIBRARY_REALNAME = samba/dcerpc/atsvc.$(SHLIBEXT)
PRIVATE_DEPENDENCIES = dcerpc_atsvc PYTALLOC param swig_credentials
python_atsvc_OBJ_FILES = $(gen_ndrsrcdir)/py_atsvc.o
[PYTHON::python_samr]
+LIBRARY_REALNAME = samba/dcerpc/samr.$(SHLIBEXT)
PRIVATE_DEPENDENCIES = dcerpc_samr PYTALLOC python_dcerpc_security python_lsa python_dcerpc_misc swig_credentials param
python_samr_OBJ_FILES = $(gen_ndrsrcdir)/py_samr.o
[PYTHON::python_svcctl]
-PRIVATE_DEPENDENCIES = RPC_NDR_SVCCTL PYTALLOC param swig_credentials
+LIBRARY_REALNAME = samba/dcerpc/svcctl.$(SHLIBEXT)
+PRIVATE_DEPENDENCIES = RPC_NDR_SVCCTL PYTALLOC param swig_credentials python_dcerpc_misc
python_svcctl_OBJ_FILES = $(gen_ndrsrcdir)/py_svcctl.o
[PYTHON::python_lsa]
-PRIVATE_DEPENDENCIES = RPC_NDR_LSA PYTALLOC param swig_credentials
+LIBRARY_REALNAME = samba/dcerpc/lsa.$(SHLIBEXT)
+PRIVATE_DEPENDENCIES = RPC_NDR_LSA PYTALLOC param swig_credentials python_dcerpc_security
python_lsa_OBJ_FILES = $(gen_ndrsrcdir)/py_lsa.o
[PYTHON::python_wkssvc]
-PRIVATE_DEPENDENCIES = RPC_NDR_WKSSVC PYTALLOC param swig_credentials
+LIBRARY_REALNAME = samba/dcerpc/wkssvc.$(SHLIBEXT)
+PRIVATE_DEPENDENCIES = RPC_NDR_WKSSVC PYTALLOC param swig_credentials python_lsa python_dcerpc_security
python_wkssvc_OBJ_FILES = $(gen_ndrsrcdir)/py_wkssvc.o
[PYTHON::python_dfs]
-PRIVATE_DEPENDENCIES = RPC_NDR_DFS PYTALLOC param swig_credentials
+LIBRARY_REALNAME = samba/dcerpc/dfs.$(SHLIBEXT)
+PRIVATE_DEPENDENCIES = RPC_NDR_DFS PYTALLOC param swig_credentials python_dcerpc_misc
python_dfs_OBJ_FILES = $(gen_ndrsrcdir)/py_dfs.o
[PYTHON::python_unixinfo]
+LIBRARY_REALNAME = samba/dcerpc/unixinfo.$(SHLIBEXT)
PRIVATE_DEPENDENCIES = RPC_NDR_UNIXINFO PYTALLOC param swig_credentials python_dcerpc_security python_dcerpc_misc
python_unixinfo_OBJ_FILES = $(gen_ndrsrcdir)/py_unixinfo.o
[PYTHON::python_drsuapi]
-PRIVATE_DEPENDENCIES = RPC_NDR_DRSUAPI PYTALLOC param swig_credentials
+LIBRARY_REALNAME = samba/dcerpc/drsuapi.$(SHLIBEXT)
+PRIVATE_DEPENDENCIES = RPC_NDR_DRSUAPI PYTALLOC param swig_credentials python_dcerpc_misc python_dcerpc_security
python_drsuapi_OBJ_FILES = $(gen_ndrsrcdir)/py_drsuapi.o
[PYTHON::python_dcerpc_security]
-PRIVATE_DEPENDENCIES = PYTALLOC
+LIBRARY_REALNAME = samba/dcerpc/security.$(SHLIBEXT)
+PRIVATE_DEPENDENCIES = PYTALLOC python_dcerpc_misc
python_dcerpc_security_OBJ_FILES = $(gen_ndrsrcdir)/py_security.o
diff --git a/source4/librpc/rpc/dcerpc.py b/source4/librpc/rpc/dcerpc.py
index 7e4d82d7c4..db5b95cee8 100644
--- a/source4/librpc/rpc/dcerpc.py
+++ b/source4/librpc/rpc/dcerpc.py
@@ -1,5 +1,5 @@
# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
#
# Don't modify this file, modify the SWIG interface instead.
@@ -57,8 +57,6 @@ def _swig_setattr_nondynamic_method(set):
return set_attr
-import credentials
-import param
pipe_connect = _dcerpc.pipe_connect
dcerpc_server_name = _dcerpc.dcerpc_server_name
diff --git a/source4/librpc/rpc/dcerpc_wrap.c b/source4/librpc/rpc/dcerpc_wrap.c
index bae41c2c22..ff5cdbd390 100644
--- a/source4/librpc/rpc/dcerpc_wrap.c
+++ b/source4/librpc/rpc/dcerpc_wrap.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -126,7 +126,7 @@
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
@@ -161,6 +161,7 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
+#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
extern "C" {
#endif
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
@@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}
/*
@@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg)
Py_DECREF(old_str);
Py_DECREF(value);
} else {
- PyErr_Format(PyExc_RuntimeError, mesg);
+ PyErr_SetString(PyExc_RuntimeError, mesg);
}
}
@@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v)
{
PySwigObject *sobj = (PySwigObject *) v;
PyObject *next = sobj->next;
- if (sobj->own) {
+ if (sobj->own == SWIG_POINTER_OWN) {
swig_type_info *ty = sobj->ty;
PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
PyObject *destroy = data ? data->destroy : 0;
@@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v)
res = ((*meth)(mself, v));
}
Py_XDECREF(res);
- } else {
- const char *name = SWIG_TypePrettyName(ty);
+ }
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
- printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
-#endif
+ else {
+ const char *name = SWIG_TypePrettyName(ty);
+ printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
}
+#endif
}
Py_XDECREF(next);
PyObject_DEL(v);
@@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
- if (own) {
+ if (own == SWIG_POINTER_OWN) {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
if (sobj) {
int oldown = sobj->own;
@@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
return SWIG_OK;
} else {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+ if (own)
+ *own = 0;
while (sobj) {
void *vptr = sobj->ptr;
if (ty) {
@@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
if (!tc) {
sobj = (PySwigObject *)sobj->next;
} else {
- if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
+ if (ptr) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+ if (newmemory == SWIG_CAST_NEW_MEMORY) {
+ assert(own);
+ if (own)
+ *own = *own | SWIG_CAST_NEW_MEMORY;
+ }
+ }
break;
}
}
@@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
}
}
if (sobj) {
- if (own) *own = sobj->own;
+ if (own)
+ *own = *own | sobj->own;
if (flags & SWIG_POINTER_DISOWN) {
sobj->own = 0;
}
@@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
}
if (ty) {
swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
- if (!tc) return SWIG_ERROR;
- *ptr = SWIG_TypeCast(tc,vptr);
+ if (tc) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ } else {
+ return SWIG_ERROR;
+ }
} else {
*ptr = vptr;
}
@@ -2510,7 +2528,7 @@ static swig_module_info swig_module = {swig_types, 21, 0, 0, 0, 0};
#define SWIG_name "_dcerpc"
-#define SWIGVERSION 0x010333
+#define SWIGVERSION 0x010335
#define SWIG_VERSION SWIGVERSION
@@ -2912,7 +2930,7 @@ SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
swig_module_info *module_head, *iter;
- int found;
+ int found, init;
clientdata = clientdata;
@@ -2922,6 +2940,9 @@ SWIG_InitializeModule(void *clientdata) {
swig_module.type_initial = swig_type_initial;
swig_module.cast_initial = swig_cast_initial;
swig_module.next = &swig_module;
+ init = 1;
+ } else {
+ init = 0;
}
/* Try and load any already created modules */
@@ -2950,6 +2971,12 @@ SWIG_InitializeModule(void *clientdata) {
module_head->next = &swig_module;
}
+ /* When multiple interpeters are used, a module could have already been initialized in
+ a different interpreter, but not yet have a pointer in this interpreter.
+ In this case, we do not want to continue adding types... everything should be
+ set up already */
+ if (init == 0) return;
+
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
diff --git a/source4/param/config.mk b/source4/param/config.mk
index a25dd32194..02474d50b9 100644
--- a/source4/param/config.mk
+++ b/source4/param/config.mk
@@ -58,7 +58,11 @@ PRIVATE_DEPENDENCIES = LIBLDB TDB_WRAP UTIL_TDB NDR_SECURITY
SECRETS_OBJ_FILES = $(paramsrcdir)/secrets.o
[PYTHON::param]
-SWIG_FILE = param.i
+LIBRARY_REALNAME = samba/_param.$(SHLIBEXT)
PRIVATE_DEPENDENCIES = LIBSAMBA-HOSTCONFIG
param_OBJ_FILES = $(paramsrcdir)/param_wrap.o
+
+$(eval $(call python_py_module_template,samba/param.py,$(paramsrcdir)/param.py))
+
+$(param_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
diff --git a/source4/param/tests/bindings.py b/source4/param/tests/bindings.py
index 0dd186b9df..d1d71e4485 100644
--- a/source4/param/tests/bindings.py
+++ b/source4/param/tests/bindings.py
@@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-import param
+from samba import param
import unittest
class LoadParmTestCase(unittest.TestCase):
diff --git a/source4/script/installheader.pl b/source4/script/installheader.pl
index d1f96b2592..6b10bde65f 100755
--- a/source4/script/installheader.pl
+++ b/source4/script/installheader.pl
@@ -60,6 +60,8 @@ sub install_header($$)
while (<IN>) {
$lineno++;
+ die("Will not install autogenerated header $src") if (/This file was automatically generated by mkproto.pl. DO NOT EDIT/);
+
if (/^#include \"(.*)\"/) {
print OUT "#include <" . rewrite_include("$src:$lineno", $1) . ">\n";
} else {
diff --git a/source4/scripting/bin/subunitrun b/source4/scripting/bin/subunitrun
index de11aba3cc..6f1086ad37 100755
--- a/source4/scripting/bin/subunitrun
+++ b/source4/scripting/bin/subunitrun
@@ -26,7 +26,7 @@ from subunit import SubunitTestRunner
from unittest import TestProgram
import optparse
import os
-import param
+from samba import param
import samba.getopt as options
import samba.tests
diff --git a/source4/scripting/python/config.mk b/source4/scripting/python/config.mk
index 1fa273e99d..73607eb76c 100644
--- a/source4/scripting/python/config.mk
+++ b/source4/scripting/python/config.mk
@@ -6,7 +6,7 @@ INIT_FUNCTION_SENTINEL = { NULL, NULL }
LIBPYTHON_OBJ_FILES = $(addprefix $(pyscriptsrcdir)/, modules.o)
[SUBSYSTEM::PYTALLOC]
-PUBLIC_DEPENDENCIES = EXT_LIB_PYTHON
+PUBLIC_DEPENDENCIES = EXT_LIB_PYTHON LIBTALLOC
PYTALLOC_OBJ_FILES = $(addprefix $(pyscriptsrcdir)/, pytalloc.o)
@@ -16,13 +16,20 @@ PRIVATE_DEPENDENCIES = LIBNDR
python_uuid_OBJ_FILES = $(pyscriptsrcdir)/uuidmodule.o
[PYTHON::python_misc]
+LIBRARY_REALNAME = samba/_misc.$(SHLIBEXT)
PRIVATE_DEPENDENCIES = LIBNDR LIBLDB SAMDB CREDENTIALS
-SWIG_FILE = misc.i
python_misc_OBJ_FILES = $(pyscriptsrcdir)/misc_wrap.o
-_PY_FILES = $(shell find $(pyscriptsrcdir) -name "*.py")
+$(python_misc_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
+
+_PY_FILES = $(shell find $(pyscriptsrcdir)/samba $(pyscriptsrcdir)/subunit -name "*.py")
$(foreach pyfile, $(_PY_FILES),$(eval $(call python_py_module_template,$(patsubst $(pyscriptsrcdir)/%,%,$(pyfile)),$(pyfile))))
+$(eval $(call python_py_module_template,samba/misc.py,$(pyscriptsrcdir)/misc.py))
+
+epydoc:: pythonmods
+ PYTHONPATH=$(pythonbuilddir) epydoc --no-private samba dcerpc tdb ldb subunit
+
install:: installpython
diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py
index b9d81c6c3c..29afdb931d 100644
--- a/source4/scripting/python/samba/__init__.py
+++ b/source4/scripting/python/samba/__init__.py
@@ -33,6 +33,8 @@ if _in_source_tree():
srcdir = "%s/../../.." % os.path.dirname(__file__)
sys.path.append("%s/bin/python" % srcdir)
default_ldb_modules_dir = "%s/bin/modules/ldb" % srcdir
+else:
+ default_ldb_modules_dir = None
import ldb
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index 4818a79f00..69c7e8846d 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -237,6 +237,7 @@ def provision_paths_from_lp(lp, dnsdomain):
paths.templates = os.path.join(paths.private_dir, "templates.ldb")
paths.dns = os.path.join(paths.private_dir, dnsdomain + ".zone")
paths.namedconf = os.path.join(paths.private_dir, "named.conf")
+ paths.krb5conf = os.path.join(paths.private_dir, "krb5.conf")
paths.winsdb = os.path.join(paths.private_dir, "wins.ldb")
paths.s4_ldapi_path = os.path.join(paths.private_dir, "ldapi")
paths.phpldapadminconfig = os.path.join(paths.private_dir,
@@ -1059,16 +1060,23 @@ def provision(setup_dir, message, session_info,
expression="(&(objectClass=computer)(cn=%s))" % names.hostname,
scope=SCOPE_SUBTREE)
assert isinstance(hostguid, str)
-
- create_zone_file(paths.dns, paths.namedconf, setup_path, samdb,
- hostname=names.hostname, hostip=hostip,
- hostip6=hostip6, dnsdomain=names.dnsdomain,
- domaindn=names.domaindn, dnspass=dnspass, realm=names.realm,
- domainguid=domainguid, hostguid=hostguid,
- private_dir=paths.private_dir, keytab_name=paths.dns_keytab)
+
+ create_zone_file(paths.dns, setup_path, dnsdomain=names.dnsdomain,
+ domaindn=names.domaindn, hostip=hostip,
+ hostip6=hostip6, hostname=names.hostname,
+ dnspass=dnspass, realm=names.realm,
+ domainguid=domainguid, hostguid=hostguid)
message("Please install the zone located in %s into your DNS server" % paths.dns)
- message("See %s if you want to use secure GSS-TSIG updates" % paths.namedconf)
-
+
+ create_named_conf(paths.namedconf, setup_path, realm=names.realm,
+ dnsdomain=names.dnsdomain, private_dir=paths.private_dir,
+ keytab_name=paths.dns_keytab)
+ message("See %s for example configuration statements for secure GSS-TSIG updates" % paths.namedconf)
+
+ create_krb5_conf(paths.krb5conf, setup_path, dnsdomain=names.dnsdomain,
+ hostname=names.hostname, realm=names.realm)
+ message("A Kerberos configuration suitable for Samba 4 has been generated at %s" % paths.krb5conf)
+
create_phpldapadmin_config(paths.phpldapadminconfig, setup_path,
ldapi_url)
@@ -1284,19 +1292,12 @@ def create_phpldapadmin_config(path, setup_path, ldapi_uri):
{"S4_LDAPI_URI": ldapi_uri})
-def create_zone_file(path_zone, path_conf, setup_path, samdb, dnsdomain, domaindn,
- hostip, hostip6, hostname, dnspass, realm, domainguid, hostguid,
- private_dir, keytab_name):
+def create_zone_file(path, setup_path, dnsdomain, domaindn,
+ hostip, hostip6, hostname, dnspass, realm, domainguid, hostguid):
"""Write out a DNS zone file, from the info in the current database.
- Also writes a file with stubs appropriate for a DNS configuration file
- (including GSS-TSIG configuration), and details as to some of the other
- configuration changes that may be necessary.
-
- :param path_zone: Path of the new zone file.
- :param path_conf: Path of the config stubs file.
+ :param path: Path of the new zone file.
:param setup_path: Setup path function.
- :param samdb: SamDB object
:param dnsdomain: DNS Domain name
:param domaindn: DN of the Domain
:param hostip: Local IPv4 IP
@@ -1316,7 +1317,7 @@ def create_zone_file(path_zone, path_conf, setup_path, samdb, dnsdomain, domaind
hostip6_base_line = " IN AAAA " + hostip6
hostip6_host_line = hostname + " IN AAAA " + hostip6
- setup_file(setup_path("provision.zone"), path_zone, {
+ setup_file(setup_path("provision.zone"), path, {
"DNSPASS_B64": b64encode(dnspass),
"HOSTNAME": hostname,
"DNSDOMAIN": dnsdomain,
@@ -1330,15 +1331,44 @@ def create_zone_file(path_zone, path_conf, setup_path, samdb, dnsdomain, domaind
"HOSTIP6_HOST_LINE": hostip6_host_line,
})
- setup_file(setup_path("named.conf"), path_conf, {
+def create_named_conf(path, setup_path, realm, dnsdomain,
+ private_dir, keytab_name):
+ """Write out a file containing zone statements suitable for inclusion in a
+ named.conf file (including GSS-TSIG configuration).
+
+ :param path: Path of the new named.conf file.
+ :param setup_path: Setup path function.
+ :param realm: Realm name
+ :param dnsdomain: DNS Domain name
+ :param private_dir: Path to private directory
+ :param keytab_name: File name of DNS keytab file
+ """
+
+ setup_file(setup_path("named.conf"), path, {
"DNSDOMAIN": dnsdomain,
"REALM": realm,
"REALM_WC": "*." + ".".join(realm.split(".")[1:]),
- "HOSTNAME": hostname,
"DNS_KEYTAB": keytab_name,
"DNS_KEYTAB_ABS": os.path.join(private_dir, keytab_name),
})
+def create_krb5_conf(path, setup_path, dnsdomain, hostname, realm):
+ """Write out a file containing zone statements suitable for inclusion in a
+ named.conf file (including GSS-TSIG configuration).
+
+ :param path: Path of the new named.conf file.
+ :param setup_path: Setup path function.
+ :param dnsdomain: DNS Domain name
+ :param hostname: Local hostname
+ :param realm: Realm name
+ """
+
+ setup_file(setup_path("krb5.conf"), path, {
+ "DNSDOMAIN": dnsdomain,
+ "HOSTNAME": hostname,
+ "REALM": realm,
+ })
+
def load_schema(setup_path, samdb, schemadn, netbiosname, configdn, sitename):
"""Load schema for the SamDB.
diff --git a/source4/scripting/python/samba/tests/dcerpc/registry.py b/source4/scripting/python/samba/tests/dcerpc/registry.py
index 1afdc582a7..81133ff641 100644
--- a/source4/scripting/python/samba/tests/dcerpc/registry.py
+++ b/source4/scripting/python/samba/tests/dcerpc/registry.py
@@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-import winreg
+from samba.dcerpc import winreg
import unittest
from samba.tests import RpcInterfaceTestCase
diff --git a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py
index 6c43632d97..3b37f8a9bc 100644
--- a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py
+++ b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py
@@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-import echo
+from samba.dcerpc import echo
import unittest
from samba.tests import RpcInterfaceTestCase
diff --git a/source4/scripting/python/samba/tests/dcerpc/sam.py b/source4/scripting/python/samba/tests/dcerpc/sam.py
index 8ef12dad86..a6816153c0 100644
--- a/source4/scripting/python/samba/tests/dcerpc/sam.py
+++ b/source4/scripting/python/samba/tests/dcerpc/sam.py
@@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-import samr
+from samba.dcerpc import samr
from samba.tests import RpcInterfaceTestCase
class SamrTests(RpcInterfaceTestCase):
diff --git a/source4/scripting/python/samba/tests/dcerpc/unix.py b/source4/scripting/python/samba/tests/dcerpc/unix.py
index 78a987cedd..aa47b71b16 100644
--- a/source4/scripting/python/samba/tests/dcerpc/unix.py
+++ b/source4/scripting/python/samba/tests/dcerpc/unix.py
@@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-import unixinfo
+from samba.dcerpc import unixinfo
from samba.tests import RpcInterfaceTestCase
class UnixinfoTests(RpcInterfaceTestCase):
diff --git a/source4/scripting/python/samba/tests/provision.py b/source4/scripting/python/samba/tests/provision.py
index b9e0e16d3c..76c10145f0 100644
--- a/source4/scripting/python/samba/tests/provision.py
+++ b/source4/scripting/python/samba/tests/provision.py
@@ -21,7 +21,7 @@ import os
from samba.provision import setup_secretsdb, secretsdb_become_dc, findnss
import samba.tests
from ldb import Dn
-import param
+from samba import param
import unittest
lp = samba.tests.cmdline_loadparm
diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh
index 5a9cdafe3b..2f65561ceb 100755
--- a/source4/selftest/samba4_tests.sh
+++ b/source4/selftest/samba4_tests.sh
@@ -355,3 +355,5 @@ plantest "blackbox.upgrade" none $PYTHON setup/upgrade $CONFIGURATION --targetdi
rm -rf $PREFIX/provision
mkdir $PREFIX/provision
plantest "blackbox.provision.py" none PYTHON="$PYTHON" $samba4srcdir/setup/tests/blackbox_provision.sh "$PREFIX/provision" "$CONFIGURATION"
+plantest "blackbox.setpassword.py" none PYTHON="$PYTHON" $samba4srcdir/setup/tests/blackbox_setpassword.sh "$PREFIX/provision" "$CONFIGURATION"
+plantest "blackbox.newuser.py" none PYTHON="$PYTHON" $samba4srcdir/setup/tests/blackbox_newuser.sh "$PREFIX/provision" "$CONFIGURATION"
diff --git a/source4/setup/enableaccount b/source4/setup/enableaccount
index 849b515675..061997b804 100644..100755
--- a/source4/setup/enableaccount
+++ b/source4/setup/enableaccount
@@ -5,17 +5,19 @@
# Copyright Jelmer Vernooij 2008
# Released under the GNU GPL version 3 or later
#
+import os, sys
+
+sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), "../bin/python"))
import samba.getopt as options
import optparse
import pwd
-import sys
import ldb
-from auth import system_session
+from samba.auth import system_session
from samba.samdb import SamDB
-parser = optparse.OptionParser("setpassword [username] [options]")
+parser = optparse.OptionParser("enableaccount [username] [options]")
sambaopts = options.SambaOptions(parser)
parser.add_option_group(sambaopts)
parser.add_option_group(options.VersionOptions(parser))
diff --git a/source4/setup/krb5.conf b/source4/setup/krb5.conf
new file mode 100644
index 0000000000..7dad63de73
--- /dev/null
+++ b/source4/setup/krb5.conf
@@ -0,0 +1,17 @@
+[libdefaults]
+ default_realm = ${REALM}
+ dns_lookup_realm = false
+ dns_lookup_kdc = false
+ ticket_lifetime = 24h
+ forwardable = yes
+
+[realms]
+ ${REALM} = {
+ kdc = ${HOSTNAME}.${DNSDOMAIN}:88
+ admin_server = ${HOSTNAME}.${DNSDOMAIN}:749
+ default_domain = ${DNSDOMAIN}
+ }
+
+[domain_realm]
+ .${DNSDOMAIN} = ${REALM}
+ ${DNSDOMAIN} = ${REALM}
diff --git a/source4/setup/named.conf b/source4/setup/named.conf
index 9cf0b48a7c..4f98bbd914 100644
--- a/source4/setup/named.conf
+++ b/source4/setup/named.conf
@@ -66,20 +66,6 @@ zone "123.168.192.in-addr.arpa" in {
tkey-gssapi-credential "DNS/${DNSDOMAIN}";
tkey-domain "${REALM}";
-# - Add settings for the ${REALM} realm to the Kerberos configuration on the DNS
-# server. The easiest way is to add the following blocks to the appropriate
-# sections in /etc/krb5.conf:
-[realms]
- ${REALM} = {
- kdc = ${HOSTNAME}.${DNSDOMAIN}:88
- admin_server = ${HOSTNAME}.${DNSDOMAIN}:749
- default_domain = ${DNSDOMAIN}
- }
-
-[domain_realm]
- .${DNSDOMAIN} = ${REALM}
- ${DNSDOMAIN} = ${REALM}
-
# - Modify BIND init scripts to pass the location of the generated keytab file.
# Fedora 8 & later provide a variable named KEYTAB_FILE in /etc/sysconfig/named
# for this purpose:
diff --git a/source4/setup/newuser b/source4/setup/newuser
index 26bac76f02..991afa36d8 100755
--- a/source4/setup/newuser
+++ b/source4/setup/newuser
@@ -15,7 +15,7 @@ import samba.getopt as options
import optparse
import pwd
from getpass import getpass
-from auth import system_session
+from samba.auth import system_session
from samba.samdb import SamDB
parser = optparse.OptionParser("newuser [options] <username> [<password>]")
diff --git a/source4/setup/provision b/source4/setup/provision
index 2579bc4f19..c1d6cd157a 100755
--- a/source4/setup/provision
+++ b/source4/setup/provision
@@ -30,10 +30,10 @@ import os, sys
sys.path.insert(0, "bin/python")
import samba
-import param
-from auth import system_session
+from samba.auth import system_session
import samba.getopt as options
+from samba import param
from samba.provision import (provision,
FILL_FULL, FILL_NT4SYNC,
FILL_DRS)
diff --git a/source4/setup/provision_basedn_modify.ldif b/source4/setup/provision_basedn_modify.ldif
index f5e1bb5add..63332e937b 100644
--- a/source4/setup/provision_basedn_modify.ldif
+++ b/source4/setup/provision_basedn_modify.ldif
@@ -75,6 +75,6 @@ subRefs: ${CONFIGDN}
subRefs: ${SCHEMADN}
-
replace: gPLink
-gPLink: [LDAP://CN={${POLICYGUID}},CN=Policies,CN=System,${DOMAINDN};2]
+gPLink: [LDAP://CN={${POLICYGUID}},CN=Policies,CN=System,${DOMAINDN};0]
-
${DOMAINGUID_MOD}
diff --git a/source4/setup/setpassword b/source4/setup/setpassword
index 977a6a5ee8..65770e1f4d 100644
--- a/source4/setup/setpassword
+++ b/source4/setup/setpassword
@@ -6,12 +6,17 @@
# Released under the GNU GPL version 3 or later
#
+import os, sys
+
+# Find right directory when running from source tree
+sys.path.insert(0, "bin/python")
+
import samba.getopt as options
import optparse
import pwd
import sys
from getpass import getpass
-from auth import system_session
+from samba.auth import system_session
from samba.samdb import SamDB
parser = optparse.OptionParser("setpassword [username] [options]")
diff --git a/source4/setup/tests/blackbox_newuser.sh b/source4/setup/tests/blackbox_newuser.sh
new file mode 100755
index 0000000000..fed5f7d263
--- /dev/null
+++ b/source4/setup/tests/blackbox_newuser.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+if [ $# -lt 2 ]; then
+cat <<EOF
+Usage: blackbox_newuser.sh PREFIX CONFIGURATION
+EOF
+exit 1;
+fi
+
+PREFIX="$1"
+CONFIGURATION="$2"
+shift 2
+
+. `dirname $0`/../../../testprogs/blackbox/subunit.sh
+
+
+testit "simple-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc
+
+testit "newuser" $PYTHON ./setup/newuser --configfile=$PREFIX/simple-dc/etc/smb.conf testuser testpass
+
+exit $failed
diff --git a/source4/setup/tests/blackbox_provision.sh b/source4/setup/tests/blackbox_provision.sh
index 19f37cef2d..2afa9dc952 100755
--- a/source4/setup/tests/blackbox_provision.sh
+++ b/source4/setup/tests/blackbox_provision.sh
@@ -11,21 +11,7 @@ PREFIX="$1"
CONFIGURATION="$2"
shift 2
-testit() {
- name="$1"
- shift
- cmdline="$*"
- echo "test: $name"
- $cmdline
- status=$?
- if [ x$status = x0 ]; then
- echo "success: $name"
- else
- echo "failure: $name"
- failed=`expr $failed + 1`
- fi
- return $status
-}
+. `dirname $0`/../../../testprogs/blackbox/subunit.sh
testit "simple-default" $PYTHON ./setup/provision $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-default
testit "simple-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc
@@ -34,9 +20,6 @@ testit "simple-standalone" $PYTHON ./setup/provision $CONFIGURATION --server-rol
testit "blank-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/blank-dc --blank
testit "partitions-only-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/partitions-only-dc --partitions-only
-testit "newuser" $PYTHON ./setup/newuser --configfile=$PREFIX/simple-dc/etc/smb.conf testuser testpass
-testit "setpassword" $PYTHON ./setup/setpassword --configfile=$PREFIX/simple-dc/etc/smb.conf testuser --newpassword=testpass
-
reprovision() {
$PYTHON ./setup/provision $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/reprovision"
$PYTHON ./setup/provision $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/reprovision"
diff --git a/source4/setup/tests/blackbox_setpassword.sh b/source4/setup/tests/blackbox_setpassword.sh
new file mode 100755
index 0000000000..725466150c
--- /dev/null
+++ b/source4/setup/tests/blackbox_setpassword.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+if [ $# -lt 2 ]; then
+cat <<EOF
+Usage: blackbox_setpassword.sh PREFIX CONFIGURATION
+EOF
+exit 1;
+fi
+
+PREFIX="$1"
+CONFIGURATION="$2"
+shift 2
+
+. `dirname $0`/../../../testprogs/blackbox/subunit.sh
+
+testit "simple-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc
+
+testit "newuser" $PYTHON ./setup/newuser --configfile=$PREFIX/simple-dc/etc/smb.conf testuser testpass
+
+testit "setpassword" $PYTHON ./setup/setpassword --configfile=$PREFIX/simple-dc/etc/smb.conf testuser --newpassword=testpass
+
+exit $failed
diff --git a/source4/setup/upgrade b/source4/setup/upgrade
index b1d9ffa37c..03c6747d4e 100755
--- a/source4/setup/upgrade
+++ b/source4/setup/upgrade
@@ -11,10 +11,10 @@ import os, sys
# Find right directory when running from source tree
sys.path.insert(0, "bin/python")
-import param
import samba
import samba.getopt as options
-from auth import system_session
+from samba import param
+from samba.auth import system_session
parser = optparse.OptionParser("upgrade [options] <libdir> <smbconf>")
sambaopts = options.SambaOptions(parser)
diff --git a/testprogs/blackbox/subunit.sh b/testprogs/blackbox/subunit.sh
index 7a6b21e540..100dfd1a46 100755
--- a/testprogs/blackbox/subunit.sh
+++ b/testprogs/blackbox/subunit.sh
@@ -56,12 +56,12 @@ testit () {
shift
cmdline="$*"
subunit_start_test "$name"
- $cmdline
+ output=`$cmdline 2>&1`
status=$?
if [ x$status = x0 ]; then
subunit_pass_test "$name"
else
- subunit_fail_test "$name"
+ echo $output | subunit_fail_test "$name"
fi
return $status
}
diff --git a/testprogs/blackbox/test_kinit.sh b/testprogs/blackbox/test_kinit.sh
index db4b65f327..d3cece0af7 100755
--- a/testprogs/blackbox/test_kinit.sh
+++ b/testprogs/blackbox/test_kinit.sh
@@ -23,7 +23,7 @@ samba4bindir=`dirname $0`/../../source/bin
smbclient=$samba4bindir/smbclient
samba4kinit=$samba4bindir/samba4kinit
net=$samba4bindir/net
-enableaccount="$samba4bindir/smbpython `dirname $0`/../../source/setup/enableaccount"
+enableaccount="$PYTHON `dirname $0`/../../source/setup/enableaccount"
. `dirname $0`/subunit.sh