The branch, master has been updated via 8c754b4 dlz_bind9: torture tests exploring rndc reload behaviour via 1c16c0c netcmd: domain backup offline bug fix - ignore sock files via 8514b5b buildtools/wafsamba: add_manual_dependency needs bytes for value via 9a6052b buildtools/wafsamba: fix basestring not defined error in PY3 via 2ea47f3 s4/web_server: PY3: port to python3 via f71675d python/samba: PY3 add compat function urllib_join to replace urllib.urljoin via d28b4fa PY3: md5 related functions need to be passed bytes via 2d94839 PY3: decode bytes in py3 where strings are needed via e8fec94 PY3: fix "TabError: inconsistent use of tabs and spaces" via cddd54e lib/ldb: Ensure ldb.Dn can accept utf8 encoded unicode via d1492ab lib/ldb/tests: add test for ldb.Dn passed utf8 unicode via d786e1f lib/ldb: Test correct variable for no mem condition from 5a73f90 py3 kcc tests: mark verify test as flapping
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 8c754b4396d958cb153c792615769efb00ed4bbd Author: Aaron Haslett <aaronhasl...@catalyst.net.nz> Date: Thu Aug 9 17:09:01 2018 +1200 dlz_bind9: torture tests exploring rndc reload behaviour These tests establish that the process triggered by the command 'rndc reload' does not cause samba's bind9 dlz plugin to crash. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13214 Signed-off-by: Aaron Haslett <aaronhasl...@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Autobuild-User(master): Andrew Bartlett <abart...@samba.org> Autobuild-Date(master): Thu Sep 27 04:47:16 CEST 2018 on sn-devel-144 commit 1c16c0cfafb11cb3468401431ab84329102a632d Author: Aaron Haslett <aaronhasl...@catalyst.net.nz> Date: Mon Sep 24 16:27:33 2018 +1200 netcmd: domain backup offline bug fix - ignore sock files Ignoring autogenerated .sock files and directories during file system based offline domain backup. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13604 Signed-off-by: Aaron Haslett <aaronhasl...@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 8514b5b1c69792a7bb3108506cc2510911eece70 Author: Noel Power <noel.po...@suse.com> Date: Wed Sep 26 16:26:45 2018 +0100 buildtools/wafsamba: add_manual_dependency needs bytes for value Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 9a6052b5218f4179173008c7122d1f5c9da9b000 Author: Noel Power <noel.po...@suse.com> Date: Wed Sep 26 16:22:35 2018 +0100 buildtools/wafsamba: fix basestring not defined error in PY3 Test for str first (which exists in py3 & py2) this avoids the undefined runtime error. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 2ea47f3e0f8c39a1c1bd651c7bd60b152f9b611c Author: Noel Power <noel.po...@suse.com> Date: Fri Aug 3 17:55:09 2018 +0100 s4/web_server: PY3: port to python3 Note: Unlike other libraries this library is been only built for the configured python version. It depends on availability of 'swat' python module. The swat module is hosted externally, it seems not to have been modified for a number of years, I don't think swat is python3 compatabile. These changes are enough to get allow the samba binary to launch a web server (which will just display a placeholder page announcing you need to install swat). It maybe that removing this functionality is what we should do, but that is a decision that can be made at a later time. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit f71675dcbee6cef5b1c6972d1281feb37e8e70b0 Author: Noel Power <noel.po...@suse.com> Date: Wed Sep 19 10:52:52 2018 +0200 python/samba: PY3 add compat function urllib_join to replace urllib.urljoin Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit d28b4fa3611a8b2aaac4c37ec79907a724d6f0f7 Author: Noel Power <noel.po...@suse.com> Date: Tue Jul 31 17:02:54 2018 +0100 PY3: md5 related functions need to be passed bytes Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 2d94839f9f5b34f951d9b15532cecbdf3334a7b1 Author: Noel Power <noel.po...@suse.com> Date: Fri Jul 27 16:54:16 2018 +0100 PY3: decode bytes in py3 where strings are needed Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit e8fec94827c933041acd5b447eeeefd0b7b507ef Author: Noel Power <noel.po...@suse.com> Date: Fri Jul 27 14:26:35 2018 +0100 PY3: fix "TabError: inconsistent use of tabs and spaces" Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit cddd54e8654c94dedd57c08af1987ce03212ce20 Author: Noel Power <noel.po...@suse.com> Date: Mon Sep 24 12:20:20 2018 +0100 lib/ldb: Ensure ldb.Dn can accept utf8 encoded unicode Additionally remove the associated known fail. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13616 Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit d1492ab919b19d1ca72f1d7c97ac0ca3bee13a2a Author: Noel Power <noel.po...@suse.com> Date: Mon Sep 24 14:37:50 2018 +0100 lib/ldb/tests: add test for ldb.Dn passed utf8 unicode object dn format should be a utf8 encoded string Note: Currently this fails in python2 as the c python binding for the dn string param uses PyArg_ParseTupleAndKeywords() with 's' format, this will accept str *or* unicode in the default encoding. The default encoding in python2 is... ascii. Also adding here a knownfail to squash the error produced by the test. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit d786e1fca95395e793867278bc0408e33c19908b Author: Noel Power <noel.po...@suse.com> Date: Mon Sep 24 11:28:47 2018 +0100 lib/ldb: Test correct variable for no mem condition Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> ----------------------------------------------------------------------- Summary of changes: auth/credentials/wscript_build | 10 ++--- buildtools/wafsamba/pkgconfig.py | 2 +- buildtools/wafsamba/samba_conftests.py | 2 +- buildtools/wafsamba/samba_perl.py | 5 ++- buildtools/wafsamba/samba_utils.py | 4 +- buildtools/wafsamba/samba_version.py | 4 +- buildtools/wafsamba/wscript | 2 +- examples/winexe/wscript | 20 ++++----- lib/ldb/pyldb.c | 32 ++++++++------ lib/ldb/tests/python/api.py | 4 ++ python/samba/compat.py | 2 + python/samba/netcmd/domain_backup.py | 7 +++ python/samba/web_server/__init__.py | 31 +++++++------ source4/auth/wscript_build | 4 +- source4/heimdal/lib/wind/UnicodeData.py | 2 +- source4/torture/dns/dlz_bind9.c | 78 +++++++++++++++++++++++++++++++++ source4/web_server/wsgi.c | 66 ++++++++++++++++++---------- 17 files changed, 195 insertions(+), 80 deletions(-) Changeset truncated at 500 lines: diff --git a/auth/credentials/wscript_build b/auth/credentials/wscript_build index 73e8e67..aaef541 100644 --- a/auth/credentials/wscript_build +++ b/auth/credentials/wscript_build @@ -28,8 +28,8 @@ for env in bld.gen_python_environments(): pytalloc_util = bld.pyembed_libname('pytalloc-util') pyparam_util = bld.pyembed_libname('pyparam_util') - bld.SAMBA_PYTHON('pycredentials', - source='pycredentials.c', - public_deps='samba-credentials cmdline-credentials %s %s CREDENTIALS_KRB5 CREDENTIALS_SECRETS' % (pytalloc_util, pyparam_util), - realname='samba/credentials.so' - ) + bld.SAMBA_PYTHON('pycredentials', + source='pycredentials.c', + public_deps='samba-credentials cmdline-credentials %s %s CREDENTIALS_KRB5 CREDENTIALS_SECRETS' % (pytalloc_util, pyparam_util), + realname='samba/credentials.so' + ) diff --git a/buildtools/wafsamba/pkgconfig.py b/buildtools/wafsamba/pkgconfig.py index 6094114..b83d5f3 100644 --- a/buildtools/wafsamba/pkgconfig.py +++ b/buildtools/wafsamba/pkgconfig.py @@ -52,7 +52,7 @@ def PKG_CONFIG_FILES(bld, pc_files, vnum=None, extra_name=None): rule=subst_at_vars, source=f+'.in', target=target) - bld.add_manual_dependency(bld.path.find_or_declare(f), bld.env['PREFIX']) + bld.add_manual_dependency(bld.path.find_or_declare(f), bld.env['PREFIX'].encode('utf8')) t.vars = [] if t.env.RPATH_ON_INSTALL: t.env.LIB_RPATH = t.env.RPATH_ST % t.env.LIBDIR diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py index 4981ff5..d8f7936 100644 --- a/buildtools/wafsamba/samba_conftests.py +++ b/buildtools/wafsamba/samba_conftests.py @@ -508,7 +508,7 @@ def CHECK_STANDARD_LIBPATH(conf): # at least gcc and clang support this: try: cmd = conf.env.CC + ['-print-search-dirs'] - out = Utils.cmd_output(cmd).split('\n') + out = Utils.cmd_output(cmd).decode('utf8').split('\n') except ValueError: # option not supported by compiler - use a standard list of directories dirlist = [ '/usr/lib', '/usr/lib64' ] diff --git a/buildtools/wafsamba/samba_perl.py b/buildtools/wafsamba/samba_perl.py index eca72d6..3d4fe29 100644 --- a/buildtools/wafsamba/samba_perl.py +++ b/buildtools/wafsamba/samba_perl.py @@ -15,7 +15,10 @@ def SAMBA_CHECK_PERL(conf, mandatory=True, version=(5,0,0)): conf.check_perl_version(version) def read_perl_config_var(cmd): - return Utils.to_list(Utils.cmd_output([conf.env.get_flat('PERL'), '-MConfig', '-e', cmd])) + output = Utils.cmd_output([conf.env.get_flat('PERL'), '-MConfig', '-e', cmd]) + if not isinstance(output, str): + output = output.decode('utf8') + return Utils.to_list(output) def check_perl_config_var(var): conf.start_msg("Checking for perl $Config{%s}:" % var) diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py index fd61b84..b4da3c5 100644 --- a/buildtools/wafsamba/samba_utils.py +++ b/buildtools/wafsamba/samba_utils.py @@ -358,13 +358,13 @@ try: # Even if hashlib.md5 exists, it may be unusable. # Try to use MD5 function. In FIPS mode this will cause an exception # and we'll get to the replacement code - foo = md5('abcd') + foo = md5(b'abcd') except: try: import md5 # repeat the same check here, mere success of import is not enough. # Try to use MD5 function. In FIPS mode this will cause an exception - foo = md5.md5('abcd') + foo = md5.md5(b'abcd') except: Context.SIG_NIL = hash('abcd') class replace_md5(object): diff --git a/buildtools/wafsamba/samba_version.py b/buildtools/wafsamba/samba_version.py index 239f244..6a8ffb6 100644 --- a/buildtools/wafsamba/samba_version.py +++ b/buildtools/wafsamba/samba_version.py @@ -14,7 +14,7 @@ def git_version_summary(path, env=None): environ = dict(os.environ) environ["GIT_DIR"] = '%s/.git' % path environ["GIT_WORK_TREE"] = path - git = Utils.cmd_output(env.GIT + ' show --pretty=format:"%h%n%ct%n%H%n%cd" --stat HEAD', silent=True, env=environ) + git = Utils.cmd_output(env.GIT + ' show --pretty=format:"%h%n%ct%n%H%n%cd" --stat HEAD', silent=True, env=environ).decode('utf8') lines = git.splitlines() if not lines or len(lines) < 4: @@ -198,7 +198,7 @@ also accepted as dictionary entries here for name in sorted(self.vcs_fields.keys()): string+="#define SAMBA_VERSION_%s " % name value = self.vcs_fields[name] - if isinstance(value, basestring): + if isinstance(value, str) or isinstance(value, basestring): string += "\"%s\"" % value elif type(value) is int: string += "%d" % value diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript index 0b73c85..5c4b037 100644 --- a/buildtools/wafsamba/wscript +++ b/buildtools/wafsamba/wscript @@ -560,7 +560,7 @@ struct foo bar = { .y = 'X', .x = 1 }; # Extra sanity check. if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): Logs.error("Failed endian determination. The PDP-11 is back?") - sys.exit(1) + sys.exit(1) else: if conf.CONFIG_SET("HAVE_BIG_ENDIAN"): conf.DEFINE('WORDS_BIGENDIAN', 1) diff --git a/examples/winexe/wscript b/examples/winexe/wscript index 8e42f01..6b311b1 100644 --- a/examples/winexe/wscript +++ b/examples/winexe/wscript @@ -9,23 +9,23 @@ def configure(conf): for a in AR32: for t in TC: - if conf.find_program(a + '-' + t + '-gcc', var='WINEXE_CC_WIN32'): - found = True - break - if found: + if conf.find_program(a + '-' + t + '-gcc', var='WINEXE_CC_WIN32'): + found = True + break + if found: conf.DEFINE('HAVE_WINEXE_CC_WIN32', 1); - break + break found = False for a in AR64: for t in TC: - if conf.find_program(a + '-' + t + '-gcc', var='WINEXE_CC_WIN64'): - found = True - break - if found: + if conf.find_program(a + '-' + t + '-gcc', var='WINEXE_CC_WIN64'): + found = True + break + if found: conf.DEFINE('HAVE_WINEXE_CC_WIN64', 1); - break + break conf.DEFINE("WINEXE_LDFLAGS", "-s -Wall -Wl,-Bstatic -Wl,-Bdynamic -luserenv") diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 66bc202..3ed9d30 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -893,22 +893,22 @@ static PySequenceMethods py_ldb_dn_seq = { static PyObject *py_ldb_dn_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { - struct ldb_dn *ret; - char *str; - PyObject *py_ldb; - struct ldb_context *ldb_ctx; - TALLOC_CTX *mem_ctx; - PyLdbDnObject *py_ret; + struct ldb_dn *ret = NULL; + char *str = NULL; + PyObject *py_ldb = NULL; + struct ldb_context *ldb_ctx = NULL; + TALLOC_CTX *mem_ctx = NULL; + PyLdbDnObject *py_ret = NULL; const char * const kwnames[] = { "ldb", "dn", NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os", + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oes", discard_const_p(char *, kwnames), - &py_ldb, &str)) - return NULL; + &py_ldb, "utf8", &str)) + goto out; if (!PyLdb_Check(py_ldb)) { PyErr_SetString(PyExc_TypeError, "Expected Ldb"); - return NULL; + goto out; } ldb_ctx = pyldb_Ldb_AsLdbContext(py_ldb); @@ -916,24 +916,28 @@ static PyObject *py_ldb_dn_new(PyTypeObject *type, PyObject *args, PyObject *kwa mem_ctx = talloc_new(NULL); if (mem_ctx == NULL) { PyErr_NoMemory(); - return NULL; + goto out; } ret = ldb_dn_new(mem_ctx, ldb_ctx, str); if (!ldb_dn_validate(ret)) { talloc_free(mem_ctx); PyErr_SetString(PyExc_ValueError, "unable to parse dn string"); - return NULL; + goto out; } py_ret = (PyLdbDnObject *)type->tp_alloc(type, 0); - if (ret == NULL) { + if (py_ret == NULL) { talloc_free(mem_ctx); PyErr_NoMemory(); - return NULL; + goto out; } py_ret->mem_ctx = mem_ctx; py_ret->dn = ret; +out: + if (str != NULL) { + PyMem_Free(discard_const_p(char, str)); + } return (PyObject *)py_ret; } diff --git a/lib/ldb/tests/python/api.py b/lib/ldb/tests/python/api.py index 37e8f4d..f9e2fa5 100755 --- a/lib/ldb/tests/python/api.py +++ b/lib/ldb/tests/python/api.py @@ -138,6 +138,10 @@ class SimpleLdb(LdbBaseTest): l = ldb.Ldb(self.url(), flags=self.flags()) self.assertEqual(len(l.search(controls=["paged_results:0:5"])), 0) + def test_utf8_ldb_Dn(self): + l = ldb.Ldb(self.url(), flags=self.flags()) + dn = ldb.Dn(l, (b'a=' + b'\xc4\x85\xc4\x87\xc4\x99\xc5\x82\xc5\x84\xc3\xb3\xc5\x9b\xc5\xba\xc5\xbc').decode('utf8')) + def test_search_attrs(self): l = ldb.Ldb(self.url(), flags=self.flags()) self.assertEqual(len(l.search(ldb.Dn(l, ""), ldb.SCOPE_SUBTREE, "(dc=*)", ["dc"])), 0) diff --git a/python/samba/compat.py b/python/samba/compat.py index 54f5bce..0c1869a 100644 --- a/python/samba/compat.py +++ b/python/samba/compat.py @@ -70,6 +70,7 @@ if PY3: return (x > y) - (x < y) # compat functions from urllib.parse import quote as urllib_quote + from urllib.parse import urljoin as urllib_join from urllib.request import urlopen as urllib_urlopen from functools import cmp_to_key as cmp_to_key_fn @@ -146,6 +147,7 @@ else: # compat functions from urllib import quote as urllib_quote from urllib import urlopen as urllib_urlopen + from urlparse import urljoin as urllib_join # compat types integer_types = (int, long) diff --git a/python/samba/netcmd/domain_backup.py b/python/samba/netcmd/domain_backup.py index 5ddc1c1..9c8457d 100644 --- a/python/samba/netcmd/domain_backup.py +++ b/python/samba/netcmd/domain_backup.py @@ -949,6 +949,8 @@ class cmd_domain_backup_offline(samba.netcmd.Command): for (working_dir, _, filenames) in os.walk(backup_dir): if working_dir.startswith(paths.sysvol): continue + if working_dir.endswith('.sock') or '.sock/' in working_dir: + continue for filename in filenames: if filename in all_files: @@ -959,6 +961,11 @@ class cmd_domain_backup_offline(samba.netcmd.Command): if filename.endswith(self.backup_ext): os.remove(os.path.join(working_dir, filename)) continue + + # Sock files are autogenerated at runtime, ignore. + if filename.endswith('.sock'): + continue + all_files.append(os.path.join(working_dir, filename)) # Backup secrets, sam.ldb and their downstream files diff --git a/python/samba/web_server/__init__.py b/python/samba/web_server/__init__.py index d4873fa..96214f6 100644 --- a/python/samba/web_server/__init__.py +++ b/python/samba/web_server/__init__.py @@ -21,32 +21,31 @@ from __future__ import print_function - def render_placeholder(environ, start_response): """Send the user a simple placeholder about missing SWAT.""" status = '200 OK' response_headers = [('Content-type', 'text/html')] start_response(status, response_headers) - yield "<!doctype html>\n" - yield "<html>\n" - yield " <title>The Samba web service</title>\n" - yield "</html>\n" + yield b"<!doctype html>\n" + yield b"<html>\n" + yield b" <title>The Samba web service</title>\n" + yield b"</html>\n" - yield "<body>\n" - yield "<p>Welcome to this Samba web server.</p>\n" - yield "<p>This page is a simple placeholder. You probably want to install " - yield "SWAT. More information can be found " - yield "<a href='http://wiki.samba.org/index.php/SWAT2'>on the wiki</a>.</p>" - yield "</p>\n" - yield "</body>\n" - yield "</html>\n" + yield b"<body>\n" + yield b"<p>Welcome to this Samba web server.</p>\n" + yield b"<p>This page is a simple placeholder. You probably want to install " + yield b"SWAT. More information can be found " + yield b"<a href='http://wiki.samba.org/index.php/SWAT2'>on the wiki</a>.</p>" + yield b"</p>\n" + yield b"</body>\n" + yield b"</html>\n" def __call__(environ, start_response): """Handle a HTTP request.""" from wsgiref.util import application_uri, shift_path_info - from urlparse import urljoin + from samba.compat import urllib_join try: import swat @@ -62,7 +61,7 @@ def __call__(environ, start_response): if name == "": if have_swat: start_response('301 Redirect', - [('Location', urljoin(application_uri(environ), 'swat')), ]) + [('Location', urllib_join(application_uri(environ), 'swat')), ]) return [] else: return render_placeholder(environ, start_response) @@ -72,7 +71,7 @@ def __call__(environ, start_response): status = '404 Not found' response_headers = [('Content-type', 'text/html')] start_response(status, response_headers) - return ["The path %s (%s) was not found" % (orig_path, name)] + return [("The path %s (%s) was not found" % (orig_path, name)).encode('iso-8859-1')] if __name__ == '__main__': diff --git a/source4/auth/wscript_build b/source4/auth/wscript_build index d3452d2..7d67c3d 100644 --- a/source4/auth/wscript_build +++ b/source4/auth/wscript_build @@ -54,8 +54,8 @@ for env in bld.gen_python_environments(): pyparam_util = bld.pyembed_libname('pyparam_util') pyldb_util = bld.pyembed_libname('pyldb-util') pycredentials = 'pycredentials' - if bld.env['IS_EXTRA_PYTHON']: - pycredentials = 'extra-' + pycredentials + if bld.env['IS_EXTRA_PYTHON']: + pycredentials = 'extra-' + pycredentials bld.SAMBA_PYTHON('pyauth', source='pyauth.c', public_deps='auth_system_session', diff --git a/source4/heimdal/lib/wind/UnicodeData.py b/source4/heimdal/lib/wind/UnicodeData.py index dd6dfa7..8ce3bca 100644 --- a/source4/heimdal/lib/wind/UnicodeData.py +++ b/source4/heimdal/lib/wind/UnicodeData.py @@ -50,7 +50,7 @@ def read(filename): continue f = l.split(';') key = int(f[0], 0x10) - if key in ret: + if key in ret: raise Exception('Duplicate key in UnicodeData') ret[key] = f[1:] ud.close() diff --git a/source4/torture/dns/dlz_bind9.c b/source4/torture/dns/dlz_bind9.c index ef7220b..a627e23 100644 --- a/source4/torture/dns/dlz_bind9.c +++ b/source4/torture/dns/dlz_bind9.c @@ -30,6 +30,9 @@ #include "auth/credentials/credentials.h" #include "lib/cmdline/popt_common.h" +/* Tests that configure multiple DLZs will use this. Increase to add stress. */ +#define NUM_DLZS_TO_CONFIGURE 4 + struct torture_context *tctx_static; static void dlz_bind9_log_wrapper(int level, const char *fmt, ...) @@ -144,6 +147,74 @@ static bool test_dlz_bind9_configure(struct torture_context *tctx) return true; } +static bool test_dlz_bind9_multiple_configure(struct torture_context *tctx) +{ + int i; + for(i = 0; i < NUM_DLZS_TO_CONFIGURE; i++){ + test_dlz_bind9_configure(tctx); + } + return true; +} + +static bool configure_multiple_dlzs(struct torture_context *tctx, + void **dbdata, int count) +{ + int i, res; + const char *argv[] = { + "samba_dlz", + "-H", + test_dlz_bind9_binddns_dir(tctx, "dns/sam.ldb"), + NULL + }; + + tctx_static = tctx; + for(i = 0; i < count; i++){ + res = dlz_create("samba_dlz", 3, argv, &(dbdata[i]), + "log", dlz_bind9_log_wrapper, + "writeable_zone", + dlz_bind9_writeable_zone_hook, NULL); + torture_assert_int_equal(tctx, res, ISC_R_SUCCESS, + "Failed to create samba_dlz"); + + res = dlz_configure((void*)tctx, dbdata[i]); + torture_assert_int_equal(tctx, res, ISC_R_SUCCESS, + "Failed to configure samba_dlz"); + } + + return true; +} + +static bool test_dlz_bind9_destroy_oldest_first(struct torture_context *tctx) +{ + void *dbdata[NUM_DLZS_TO_CONFIGURE]; + int i; + + configure_multiple_dlzs(tctx, dbdata, NUM_DLZS_TO_CONFIGURE); + + /* Reload faults are reported to happen on the first destroy */ + dlz_destroy(dbdata[0]); + + for(i = 1; i < NUM_DLZS_TO_CONFIGURE; i++){ + dlz_destroy(dbdata[i]); + } + + return true; +} + +static bool test_dlz_bind9_destroy_newest_first(struct torture_context *tctx) +{ + void *dbdata[NUM_DLZS_TO_CONFIGURE]; + int i; + + configure_multiple_dlzs(tctx, dbdata, NUM_DLZS_TO_CONFIGURE); + + for(i = NUM_DLZS_TO_CONFIGURE - 1; i >= 0; i--) { + dlz_destroy(dbdata[i]); + } + + return true; +} + /* * Test that a ticket obtained for the DNS service will be accepted on the Samba DLZ side * @@ -1092,6 +1163,13 @@ static struct torture_suite *dlz_bind9_suite(TALLOC_CTX *ctx) torture_suite_add_simple_test(suite, "version", test_dlz_bind9_version); torture_suite_add_simple_test(suite, "create", test_dlz_bind9_create); torture_suite_add_simple_test(suite, "configure", test_dlz_bind9_configure); + torture_suite_add_simple_test(suite, "destroyoldestfirst", + test_dlz_bind9_destroy_oldest_first); + torture_suite_add_simple_test(suite, "destroynewestfirst", + test_dlz_bind9_destroy_newest_first); + torture_suite_add_simple_test(suite, "multipleconfigure", + test_dlz_bind9_multiple_configure); + torture_suite_add_simple_test(suite, "gssapi", test_dlz_bind9_gssapi); torture_suite_add_simple_test(suite, "spnego", test_dlz_bind9_spnego); torture_suite_add_simple_test(suite, "lookup", test_dlz_bind9_lookup); diff --git a/source4/web_server/wsgi.c b/source4/web_server/wsgi.c index 0e31dad..b506d10 100644 --- a/source4/web_server/wsgi.c +++ b/source4/web_server/wsgi.c @@ -27,6 +27,7 @@ #include "lib/tls/tls.h" #include "lib/tsocket/tsocket.h" #include "python/modules.h" +#include "python/py3compat.h" typedef struct { PyObject_HEAD @@ -73,19 +74,19 @@ static PyObject *start_response(PyObject *self, PyObject *args, PyObject *kwargs py_name = PyTuple_GetItem(item, 0); - if (!PyString_Check(py_name)) { + if (!PyStr_Check(py_name)) { -- Samba Shared Repository