[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Wed Nov 14 07:21:02 UTC 2018


The branch, master has been updated
       via  483d5ea5c88 CI: Autobuild: Remove build_samba_ad_dc_2_py3 CI job
       via  321002e37e3 CI: Add new CI job for new purepy3-ad-dc-2 autobuild task
       via  2ca3b3ebd8a script: Add new (temporary) pure python3 ad-dc-2 test
       via  3495f3fc838 s4/scripting/bin: gensec_client.update needs bytes
       via  a5c8ab277b1 python/samba/tests: Ensure samba_dnsupdate called with correct python version
       via  48cc8a4e321 s4/scripting/bin: PY3 convert servicePrincipalName attr to string
       via  8bf82d9f858 python/samba/tests: PY3 Fix str/bytes issue for json.loads
       via  f176461cf29 python/samba: PY3 fix can't compare string with int
       via  fe859a44772 s4/dsdb/tests: PY3 port of samba4.ldap.acl.python
       via  e6ea052c8cb s4/dsdb/tests/python: PY3 port samba4.ldap.secdesc
       via  17158129158 s4/dsdb/tests/python: PY3 port samba4.ldap_schema.python
       via  32a490d6818 python/samba/netcmd: PY3 port samba4.blackbox.ldapcmp_restore
       via  fdb3aa487f0 python/samba/netcmd: PY3 port samba.tests.samba_tool.edit
       via  a25367685d8 s3/torture: PY3 port samba.ntlm_auth
       via  b16043f57d5 python/samba/tests: PY3 port samba.tests.blackbox.netads_json
       via  108109360a5 python/samba/tests: Port samba.tests.blackbox.samba_dnsupdate for PY2/PY3
       via  0ef6e3da4b6 testprogs/blackbox: PY3 bulk change for python scripts use correct python
       via  5b4c6648566 python/samba/provision: PY3 port samba4.dlz_bind9.version
       via  008b9652cac ctdb: Fix an out of bound array access
       via  050d1e7d53c lib:util Always initialize start and space
       via  159f753732c libgpo: Make sure status is intialized
       via  9c37ed26f0a librpc:ndr: Initialize inblob
       via  56ac8944eb5 s3:rpcclient: Initialize domain_name
      from  3634e20c760 s3: lib: nmbname: Ensure we limit the NetBIOS name correctly. CID: 1433607

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 483d5ea5c88a0cd9a107957883534b2e5b65f3b0
Author: Noel Power <noel.power at suse.com>
Date:   Thu Oct 25 17:54:38 2018 +0100

    CI: Autobuild: Remove build_samba_ad_dc_2_py3 CI job
    
    We now run a purepython3 ad-dc-2 test job, later when the whole
    build is running under python3 we will resurrect build_samba_ad_dc_2_py3
    but as (build_samba_ad_dc_py2) for python2
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Wed Nov 14 08:20:55 CET 2018 on sn-devel-144

commit 321002e37e3cb467c44dc927b081f2e6c64cfcce
Author: Noel Power <noel.power at suse.com>
Date:   Thu Oct 25 17:53:35 2018 +0100

    CI: Add new CI job for new purepy3-ad-dc-2 autobuild task
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 2ca3b3ebd8ac31e1b3a33b57d706740ed0edf110
Author: Noel Power <noel.power at suse.com>
Date:   Thu Oct 25 17:50:18 2018 +0100

    script: Add new (temporary) pure python3 ad-dc-2 test
    
    Ideally we want all the tests to run under python3 by default (no
    special task for this) and then convert the existing '-py3' tasks
    to run the python tests with python3.
    However at the moment the convertion process is not ready to do this,
    for a while we need to run separate autobuild tasks for this.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3495f3fc838376b9a2dd3b43976a8884574842fb
Author: Noel Power <noel.power at suse.com>
Date:   Tue Oct 30 13:29:13 2018 +0000

    s4/scripting/bin: gensec_client.update needs bytes
    
    PY3 test was failing as param passed to update was str rather than bytes
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a5c8ab277b1fa75289ca6a7ee2c87e079b9a6b7d
Author: Noel Power <noel.power at suse.com>
Date:   Tue Oct 30 13:22:11 2018 +0000

    python/samba/tests: Ensure samba_dnsupdate called with correct python version
    
    We need to examine the contents of PYTHON env variable which should defined the
    python version to be used when running tests.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 48cc8a4e3214a571b2917dc3b677b44cccfa7286
Author: Tim Beale <timbeale at catalyst.net.nz>
Date:   Tue Oct 30 12:51:54 2018 +0000

    s4/scripting/bin: PY3 convert servicePrincipalName attr to string
    
    res[0]["servicePrincipalName"] is an instance of ldb.bytes in PY3
    If we wish to get the string value we need to call the custom
    str function which attempts to decode the bytes to 'utf8'
    
    Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed by: Noel Power <npower at samba.org>

commit 8bf82d9f8584673a00529166263b39ff796d1985
Author: Noel Power <noel.power at suse.com>
Date:   Thu Oct 25 19:10:30 2018 +0100

    python/samba/tests: PY3 Fix str/bytes issue for json.loads
    
    Python 3.4 seems to need a string
    
        parsed = json.loads (out_jsobj)
      File "/usr/lib/python3.4/json/__init__.py", line 312, in loads
        s.__class__.__name__))
    TypeError: the JSON object must be str, not 'bytes'
    
    however Python 3.5 seems to be happy to consume bytes (or string)
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit f176461cf29908f3555eecc2463d00e2ffdc693d
Author: Noel Power <noel.power at suse.com>
Date:   Fri Oct 12 17:15:39 2018 +0100

    python/samba: PY3 fix can't compare string with int
    
    Testing a string against an int value is illegal and
    is not necessary in this case, this patch removes the
    problematic test.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit fe859a44772054975d46c63c14f3f5c20c221dfa
Author: Noel Power <noel.power at suse.com>
Date:   Thu Oct 11 14:36:06 2018 +0100

    s4/dsdb/tests: PY3 port of samba4.ldap.acl.python
    
    convert various attribute results to str so assert function
    as expected for tests.
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e6ea052c8cbb5981aa02158745c361d0d33880dc
Author: Noel Power <noel.power at suse.com>
Date:   Wed Oct 10 21:48:38 2018 +0100

    s4/dsdb/tests/python: PY3 port samba4.ldap.secdesc
    
    User str/bytes as needed for various asserts
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 1715812915820aa089fbcfd5b8c326e0838727a9
Author: Noel Power <noel.power at suse.com>
Date:   Thu Nov 1 14:20:20 2018 +0000

    s4/dsdb/tests/python: PY3 port samba4.ldap_schema.python
    
    + Misc attributes needed to be converted to strings from bytes to
    ensure various asserts work as expected.
    + Fix ndr_unpack call which needs bytes not str
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 32a490d6818a805b781290cf1ee03f4b870a78be
Author: Noel Power <noel.power at suse.com>
Date:   Wed Oct 10 19:46:42 2018 +0100

    python/samba/netcmd: PY3 port samba4.blackbox.ldapcmp_restore
    
    Convert attribute from bytes to str
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit fdb3aa487f0ceb9989959036efd98f54563cd3ce
Author: Noel Power <noel.power at suse.com>
Date:   Wed Oct 10 19:19:24 2018 +0100

    python/samba/netcmd: PY3 port samba.tests.samba_tool.edit
    
    Need to write bytes to file
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a25367685d82437b6535d762eb0628c47bef2cc8
Author: Noel Power <noel.power at suse.com>
Date:   Wed Oct 10 18:45:32 2018 +0100

    s3/torture: PY3 port samba.ntlm_auth
    
    Use bytes in test rather than str
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b16043f57d5e0b9a769de61d512c6e01c5e05a7d
Author: Noel Power <noel.power at suse.com>
Date:   Wed Oct 10 17:35:53 2018 +0100

    python/samba/tests: PY3 port samba.tests.blackbox.netads_json
    
    convert output from check_output to text
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 108109360a5b8ca45b8bf0eef020fe001af61d1d
Author: Noel Power <noel.power at suse.com>
Date:   Tue Oct 30 13:25:59 2018 +0000

    python/samba/tests: Port samba.tests.blackbox.samba_dnsupdate for PY2/PY3
    
    Make sure either the output of tests and/or the item we are searching match
    in type. Output of cmd in python3 is bytes, depending on the was the test is
    written it may be easier just to convert all output or just a single string
    that is used in the test
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 0ef6e3da4b6dd8e36ced3ad344f9981901aaa2f2
Author: Noel Power <noel.power at suse.com>
Date:   Wed Oct 10 17:14:39 2018 +0100

    testprogs/blackbox: PY3 bulk change for python scripts use correct python
    
    Change all instance where python scripts are called so that the
    correct python version as specified by $PYTHON is used
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 5b4c664856602e411bf2897e44e5453c7831035f
Author: Noel Power <noel.power at suse.com>
Date:   Wed Oct 10 16:34:52 2018 +0100

    python/samba/provision: PY3 port samba4.dlz_bind9.version
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 008b9652cacdfd99e68db9d88f4e0c33eefa87e9
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Nov 12 10:21:15 2018 +0100

    ctdb: Fix an out of bound array access
    
    Found by cppcheck.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13680
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 050d1e7d53c068efac109ec4ff7a686d152e6a45
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Nov 12 10:17:37 2018 +0100

    lib:util Always initialize start and space
    
    Found by cppcheck.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13680
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 159f753732cdc1e4491f93617779861fb9d73bc7
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Nov 12 10:16:06 2018 +0100

    libgpo: Make sure status is intialized
    
    Found by cppcheck.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13680
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 9c37ed26f0a814f77c934ae190f48d0a1e673f83
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Nov 12 10:13:51 2018 +0100

    librpc:ndr: Initialize inblob
    
    Found by cppcheck.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13680
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 56ac8944eb58f234422b4bd4dd9a64b8e51e874d
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Nov 12 10:09:23 2018 +0100

    s3:rpcclient: Initialize domain_name
    
    This could be passed uninitialized to dcerpc_netr_DsRGetDCName()
    
    Found by cppcheck.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13680
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 .gitlab-ci.yml                                   | 11 ++---
 ctdb/common/logging.c                            |  2 +-
 lib/util/talloc_report.c                         |  7 +--
 libgpo/gpo_ldap.c                                |  2 +-
 librpc/ndr/ndr_backupkey.c                       |  4 +-
 python/samba/getopt.py                           |  3 --
 python/samba/netcmd/domain_backup.py             |  1 +
 python/samba/netcmd/user.py                      |  2 +-
 python/samba/provision/sambadns.py               |  7 +--
 python/samba/tests/__init__.py                   |  3 +-
 python/samba/tests/blackbox/netads_json.py       |  7 +--
 python/samba/tests/blackbox/samba_dnsupdate.py   | 21 +++++----
 python/samba/tests/samba_tool/edit.sh            |  6 +--
 script/autobuild.py                              | 18 ++++++++
 source3/rpcclient/cmd_netlogon.c                 |  2 +-
 source3/torture/test_ntlm_auth.py                | 59 ++++++++++++------------
 source4/dsdb/tests/python/acl.py                 | 23 ++++-----
 source4/dsdb/tests/python/ldap_schema.py         | 16 +++----
 source4/dsdb/tests/python/sec_descriptor.py      | 16 +++----
 source4/scripting/bin/samba_dnsupdate            |  3 +-
 source4/scripting/bin/samba_spnupdate            |  2 +-
 testprogs/blackbox/dbcheck.sh                    | 16 +++----
 testprogs/blackbox/test_chgdcpass.sh             |  8 ++--
 testprogs/blackbox/test_export_keytab_heimdal.sh | 18 ++++----
 testprogs/blackbox/test_export_keytab_mit.sh     | 16 +++----
 testprogs/blackbox/test_kinit_heimdal.sh         | 18 ++++----
 testprogs/blackbox/test_kinit_mit.sh             | 18 ++++----
 testprogs/blackbox/test_kinit_trusts_heimdal.sh  |  4 +-
 testprogs/blackbox/test_kpasswd_heimdal.sh       | 12 ++---
 testprogs/blackbox/test_kpasswd_mit.sh           | 12 ++---
 testprogs/blackbox/test_ktpass.sh                |  2 +-
 testprogs/blackbox/test_password_settings.sh     | 34 +++++++-------
 testprogs/blackbox/test_pkinit_heimdal.sh        | 12 ++---
 testprogs/blackbox/test_samba_upgradedns.sh      | 10 ++--
 testprogs/blackbox/test_trust_user_account.sh    |  4 +-
 testprogs/blackbox/test_trust_utils.sh           |  8 ++--
 36 files changed, 212 insertions(+), 195 deletions(-)


Changeset truncated at 500 lines:

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ec1c3625f2b..aba3ca7180d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -55,12 +55,6 @@ build_samba_ad_dc_2:
     # this one takes about 1 hours to finish
     - python script/autobuild.py samba-ad-dc-2     --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
 
-build_samba_ad_dc_2_py3:
-  <<: *shared_template
-  script:
-    # this one takes about 1 hours to finish
-    - python script/autobuild.py samba-ad-dc-2-py3 --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
-
 build_samba_libs:
   <<: *shared_template
   script:
@@ -105,3 +99,8 @@ build_samba_purepy3-none_env:
   <<: *shared_template
   script:
     - python3 script/autobuild.py samba-purepy3-none-env           --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
+
+build_samba_purepy3-ad-dc-2:
+  <<: *shared_template
+  script:
+    - python3 script/autobuild.py samba-purepy3-ad-dc-2           --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase
diff --git a/ctdb/common/logging.c b/ctdb/common/logging.c
index aaa93216ef5..7ed500aeb0b 100644
--- a/ctdb/common/logging.c
+++ b/ctdb/common/logging.c
@@ -85,7 +85,7 @@ const char *debug_level_to_string(int log_level)
 {
 	int i;
 
-	for (i=0; ARRAY_SIZE(log_string_map); i++) {
+	for (i=0; i < ARRAY_SIZE(log_string_map); i++) {
 		if (log_string_map[i].log_level == log_level) {
 			return log_string_map[i].log_string;
 		}
diff --git a/lib/util/talloc_report.c b/lib/util/talloc_report.c
index 63213a014b6..bed0fd91e43 100644
--- a/lib/util/talloc_report.c
+++ b/lib/util/talloc_report.c
@@ -33,8 +33,8 @@ static char *talloc_vasprintf_append_largebuf(char *buf, ssize_t *pstr_len,
 					      const char *fmt, va_list ap)
 {
 	ssize_t str_len = *pstr_len;
-	size_t buflen, needed, space;
-	char *start, *tmpbuf;
+	size_t buflen, needed, space = 0;
+	char *start = NULL, *tmpbuf = NULL;
 	va_list ap2;
 	int printlen;
 
@@ -52,9 +52,6 @@ static char *talloc_vasprintf_append_largebuf(char *buf, ssize_t *pstr_len,
 	if (buflen > str_len) {
 		start = buf + str_len;
 		space = buflen - str_len;
-	} else {
-		start = NULL;
-		space = 0;
 	}
 
 	va_copy(ap2, ap);
diff --git a/libgpo/gpo_ldap.c b/libgpo/gpo_ldap.c
index fec00053b49..f087203f28a 100644
--- a/libgpo/gpo_ldap.c
+++ b/libgpo/gpo_ldap.c
@@ -474,7 +474,7 @@ ADS_STATUS ads_get_gpo(ADS_STRUCT *ads,
 		       const char *guid_name,
 		       struct GROUP_POLICY_OBJECT *gpo)
 {
-	ADS_STATUS status;
+	ADS_STATUS status = ADS_ERROR(LDAP_NO_SUCH_OBJECT);
 	LDAPMessage *res = NULL;
 	char *dn;
 	const char *filter;
diff --git a/librpc/ndr/ndr_backupkey.c b/librpc/ndr/ndr_backupkey.c
index 827bc694230..adb6e393287 100644
--- a/librpc/ndr/ndr_backupkey.c
+++ b/librpc/ndr/ndr_backupkey.c
@@ -58,7 +58,9 @@ _PUBLIC_ void ndr_print_bkrp_BackupKey(struct ndr_print *ndr, const char *name,
 		ndr->flags |= LIBNDR_PRINT_SET_VALUES;
 	}
 	if (flags & NDR_IN) {
-		union bkrp_data_in_blob inblob;
+		union bkrp_data_in_blob inblob = {
+			.empty._empty_ = '\0',
+		};
 		DATA_BLOB blob;
 		uint32_t level;
 		enum ndr_err_code ndr_err;
diff --git a/python/samba/getopt.py b/python/samba/getopt.py
index db1c1756e4b..094031ddd52 100644
--- a/python/samba/getopt.py
+++ b/python/samba/getopt.py
@@ -63,9 +63,6 @@ class SambaOptions(optparse.OptionGroup):
         self._configfile = arg
 
     def _set_debuglevel(self, option, opt_str, arg, parser):
-        if arg < 0:
-            raise optparse.OptionValueError("invalid %s option value: %s" %
-                                            (opt_str, arg))
         self._lp.set('debug level', arg)
         parser.values.debuglevel = arg
 
diff --git a/python/samba/netcmd/domain_backup.py b/python/samba/netcmd/domain_backup.py
index 8b8ecda0696..5e7435645c3 100644
--- a/python/samba/netcmd/domain_backup.py
+++ b/python/samba/netcmd/domain_backup.py
@@ -635,6 +635,7 @@ class cmd_domain_backup_rename(samba.netcmd.Command):
         for res_msg in res:
             # dnsRoot can be multi-valued, so only look for the old realm
             for dns_root in res_msg["dnsRoot"]:
+                dns_root = str(dns_root)
                 dn = res_msg.dn
                 if old_realm in dns_root:
                     new_dns_root = re.sub('%s$' % old_realm, new_realm,
diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py
index 0b8314dd1ca..447f1a345f6 100644
--- a/python/samba/netcmd/user.py
+++ b/python/samba/netcmd/user.py
@@ -2421,7 +2421,7 @@ LDAP server using the 'nano' editor.
                     editor = 'vi'
 
             with tempfile.NamedTemporaryFile(suffix=".tmp") as t_file:
-                t_file.write(result_ldif)
+                t_file.write(get_bytes(result_ldif))
                 t_file.flush()
                 try:
                     check_call([editor, t_file.name])
diff --git a/python/samba/provision/sambadns.py b/python/samba/provision/sambadns.py
index 7fb42f65d4e..9b245608c63 100644
--- a/python/samba/provision/sambadns.py
+++ b/python/samba/provision/sambadns.py
@@ -60,7 +60,7 @@ from samba.provision.common import (
 )
 
 from samba.samdb import get_default_backend_store
-
+from samba.compat import get_string
 
 def get_domainguid(samdb, domaindn):
     res = samdb.search(base=domaindn, scope=ldb.SCOPE_BASE, attrs=["objectGUID"])
@@ -798,12 +798,12 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid):
                        scope=ldb.SCOPE_BASE,
                        attrs=["partition", "backendStore"])
     for tmp in res[0]["partition"]:
-        (nc, fname) = tmp.split(':')
+        (nc, fname) = str(tmp).split(':')
         partfile[nc.upper()] = fname
 
     backend_store = get_default_backend_store()
     if "backendStore" in res[0]:
-        backend_store = res[0]["backendStore"][0]
+        backend_store = str(res[0]["backendStore"][0])
 
     # Create empty domain partition
 
@@ -954,6 +954,7 @@ def create_named_conf(paths, realm, dnsdomain, dns_backend, logger):
                                      stdout=subprocess.PIPE,
                                      stderr=subprocess.STDOUT,
                                      cwd='.').communicate()[0]
+        bind_info = get_string(bind_info)
         bind9_8 = '#'
         bind9_9 = '#'
         bind9_10 = '#'
diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py
index 66067fcf8b9..d79fcfbb997 100644
--- a/python/samba/tests/__init__.py
+++ b/python/samba/tests/__init__.py
@@ -384,8 +384,9 @@ class BlackboxTestCase(TestCaseInTempDir):
         cmd = parts[0]
         exe = os.path.join(BINDIR, cmd)
         if os.path.exists(exe):
+            python_cmds = ["samba-tool", "samba_dnsupdate"]
             parts[0] = exe
-            if cmd =='samba-tool' and os.getenv("PYTHON", None):
+            if cmd in python_cmds and os.getenv("PYTHON", None):
                 parts.insert(0, os.environ["PYTHON"])
 
         if not isinstance(line, list):
diff --git a/python/samba/tests/blackbox/netads_json.py b/python/samba/tests/blackbox/netads_json.py
index ce48a2bf062..1c254468d36 100644
--- a/python/samba/tests/blackbox/netads_json.py
+++ b/python/samba/tests/blackbox/netads_json.py
@@ -19,6 +19,7 @@ import json
 import re
 
 import samba.tests
+from samba.compat import get_string
 
 COMMAND         = "bin/net ads"
 # extract keys from non-json version
@@ -42,7 +43,7 @@ class BaseWrapper (object):
             argv = "%s %s --json" % (COMMAND, self.subcmd)
             try:
                 out = self.check_output(argv)
-                json.loads (out)
+                json.loads (get_string(out))
             except samba.tests.BlackboxProcessError as e:
                 self.fail("Error calling [%s]: %s" % (argv, e))
 
@@ -56,7 +57,7 @@ class BaseWrapper (object):
             """
             argv = "%s %s" % (COMMAND, self.subcmd)
             try:
-                out_plain = self.check_output(argv)
+                out_plain = get_string(self.check_output(argv))
             except samba.tests.BlackboxProcessError as e:
                 self.fail("Error calling [%s]: %s" % (argv, e))
 
@@ -66,7 +67,7 @@ class BaseWrapper (object):
             except samba.tests.BlackboxProcessError as e:
                 self.fail("Error calling [%s]: %s" % (argv, e))
 
-            parsed = json.loads (out_jsobj)
+            parsed = json.loads (get_string(out_jsobj))
 
             for key in [ re.match (PLAIN_KEY_REGEX, line).group(1)
                          for line in out_plain.split ("\n")
diff --git a/python/samba/tests/blackbox/samba_dnsupdate.py b/python/samba/tests/blackbox/samba_dnsupdate.py
index 3e206a44e0c..3e168bc00d9 100644
--- a/python/samba/tests/blackbox/samba_dnsupdate.py
+++ b/python/samba/tests/blackbox/samba_dnsupdate.py
@@ -18,6 +18,7 @@
 
 import samba.tests
 from samba.compat import StringIO
+from samba.compat import get_string
 from samba.netcmd.main import cmd_sambatool
 from samba.credentials import Credentials
 from samba.auth import system_session
@@ -34,7 +35,7 @@ class SambaDnsUpdateTests(samba.tests.BlackboxTestCase):
         super(SambaDnsUpdateTests, self).setUp()
         try:
             out = self.check_output("samba_dnsupdate --verbose")
-            self.assertTrue("Looking for DNS entry" in out, out)
+            self.assertTrue(b"Looking for DNS entry" in out, out)
         except samba.tests.BlackboxProcessError:
             pass
 
@@ -43,13 +44,13 @@ class SambaDnsUpdateTests(samba.tests.BlackboxTestCase):
             out = self.check_output("samba_dnsupdate --verbose")
         except samba.tests.BlackboxProcessError as e:
             self.fail("Error calling samba_dnsupdate: %s" % e)
-        self.assertTrue("No DNS updates needed" in out, out)
+        self.assertTrue(b"No DNS updates needed" in out, out)
 
     def test_samba_dnsupate_set_ip(self):
         try:
             out = self.check_output("samba_dnsupdate --verbose --current-ip=10.0.0.1")
-            self.assertTrue(" DNS updates and" in out, out)
-            self.assertTrue(" DNS deletes needed" in out, out)
+            self.assertTrue(b" DNS updates and" in out, out)
+            self.assertTrue(b" DNS deletes needed" in out, out)
         except samba.tests.BlackboxProcessError:
             pass
 
@@ -58,16 +59,16 @@ class SambaDnsUpdateTests(samba.tests.BlackboxTestCase):
         except samba.tests.BlackboxProcessError as e:
             self.fail("Error calling samba_dnsupdate: %s" % e)
 
-        self.assertTrue("No DNS updates needed" in out, out)
+        self.assertTrue(b"No DNS updates needed" in out, out)
         try:
             rpc_out = self.check_output("samba_dnsupdate --verbose --use-samba-tool --rpc-server-ip=%s" % self.server_ip)
         except samba.tests.BlackboxProcessError as e:
             self.fail("Error calling samba_dnsupdate: %s" % e)
 
-        self.assertTrue(" DNS updates and" in rpc_out, rpc_out)
-        self.assertTrue(" DNS deletes needed" in rpc_out, rpc_out)
+        self.assertTrue(b" DNS updates and" in rpc_out, rpc_out)
+        self.assertTrue(b" DNS deletes needed" in rpc_out, rpc_out)
         out = self.check_output("samba_dnsupdate --verbose")
-        self.assertTrue("No DNS updates needed" in out, out + rpc_out)
+        self.assertTrue(b"No DNS updates needed" in out, out + rpc_out)
 
     def test_add_new_uncovered_site(self):
         name = 'sites'
@@ -106,13 +107,13 @@ class SambaDnsUpdateTests(samba.tests.BlackboxTestCase):
             ldb.FLAG_MOD_ADD, "siteList")
 
         dns_c = "samba_dnsupdate --verbose --use-file={0}".format(tmp_uc)
-        out = self.check_output(dns_c)
+        out = get_string(self.check_output(dns_c))
         self.assertFalse(site_name.lower() in out, out)
 
         self.samdb.modify(m)
 
         shutil.copyfile(uc_fn, tmp_uc)
-        out = self.check_output(dns_c)
+        out = get_string(self.check_output(dns_c))
 
         self.assertFalse("No DNS updates needed" in out, out)
         self.assertTrue(site_name.lower() in out, out)
diff --git a/python/samba/tests/samba_tool/edit.sh b/python/samba/tests/samba_tool/edit.sh
index c1ecfde8581..aca4cc247eb 100755
--- a/python/samba/tests/samba_tool/edit.sh
+++ b/python/samba/tests/samba_tool/edit.sh
@@ -33,7 +33,7 @@ failed=0
 
 # Create a test user
 subunit_start_test "Create_User"
-output=$(${STpath}/source4/scripting/bin/samba-tool user create sambatool1 --random-password \
+output=$($PYTHON ${STpath}/source4/scripting/bin/samba-tool user create sambatool1 --random-password \
 -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD")
 status=$?
 if [ "x$status" = "x0" ]; then
@@ -45,7 +45,7 @@ fi
 
 # Edit test user
 subunit_start_test "Edit_User"
-output=$(${STpath}/source4/scripting/bin/samba-tool user edit sambatool1 --editor=$tmpeditor \
+output=$($PYTHON ${STpath}/source4/scripting/bin/samba-tool user edit sambatool1 --editor=$tmpeditor \
 -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD")
 status=$?
 if [ "x$status" = "x0" ]; then
@@ -57,7 +57,7 @@ fi
 
 # Delete test user
 subunit_start_test "Delete_User"
-output=$(${STpath}/source4/scripting/bin/samba-tool user delete sambatool1 \
+output=$($PYTHON ${STpath}/source4/scripting/bin/samba-tool user delete sambatool1 \
 -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD")
 status=$?
 if [ "x$status" = "x0" ]; then
diff --git a/script/autobuild.py b/script/autobuild.py
index 989c69cfec9..e025a2c1920 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -55,6 +55,7 @@ builddirs = {
     "samba-nopython": ".",
     "samba-buildpy3-only": ".",
     "samba-purepy3-none-env": ".",
+    "samba-purepy3-ad-dc-2": ".",
     "ldb": "lib/ldb",
     "tdb": "lib/tdb",
     "talloc": "lib/talloc",
@@ -416,6 +417,23 @@ tasks = {
                        "TESTS='${PY3_ONLY}"
                        "--include-env=none'",
                        "text/plain")],
+    "samba-purepy3-ad-dc-2": [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"),
+                        ("configure", "PYTHON='python3' ./configure.developer --with-selftest-prefix=./bin/ab" + samba_configure_params, "text/plain"),
+                        ("make", "PYTHON='python3' make -j", "text/plain"),
+                        ("test", "PYTHON='python3' make test FAIL_IMMEDIATELY=1 "
+                         "TESTS='${PY3_ONLY}"
+                         "--include-env=chgdcpass "
+                         "--include-env=vampire_2000_dc "
+                         "--include-env=fl2000dc "
+                         "--include-env=ad_dc_no_nss "
+                         "--include-env=backupfromdc "
+                         "--include-env=restoredc "
+                         "--include-env=renamedc "
+                         "--include-env=offlinebackupdc "
+                         "--include-env=labdc "
+                         "'",
+                         "text/plain"),
+                        ("check-clean-tree", "script/clean-source-tree.sh", "text/plain")],
 
     # these are useful for debugging autobuild
     'pass': [("pass", 'echo passing && /bin/true', "text/plain")],
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 8d62ef7e095..631740562c6 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -216,7 +216,7 @@ static WERROR cmd_netlogon_dsr_getdcname(struct rpc_pipe_client *cli,
 	WERROR werr = WERR_OK;
 	uint32_t flags = DS_RETURN_DNS_NAME;
 	const char *server_name = cli->desthost;
-	const char *domain_name;
+	const char *domain_name = NULL;
 	struct GUID domain_guid = GUID_zero();
 	struct GUID site_guid = GUID_zero();
 	struct netr_DsRGetDCNameInfo *info = NULL;
diff --git a/source3/torture/test_ntlm_auth.py b/source3/torture/test_ntlm_auth.py
index 9f1265d1ebf..ac60632347d 100755
--- a/source3/torture/test_ntlm_auth.py
+++ b/source3/torture/test_ntlm_auth.py
@@ -41,12 +41,12 @@ def readLine(pipe):
     Throws ReadChildError if the read fails.
     """
     newline = -1
-    buf = ""
+    buf = b""
     while newline == -1:
         more = os.read(pipe, 2047)
         buf = buf + more
-        newline = buf.find('\n')
-        if more == "":
+        newline = buf.find(b'\n')
+        if more == b"":
             raise ReadChildError()
 
     return buf[:newline]
@@ -60,7 +60,7 @@ def writeLine(pipe, buf):
     written = os.write(pipe, buf)
     if written != len(buf):
         raise WriteChildError()
-    os.write(pipe, "\n")
+    os.write(pipe, b"\n")
 
 
 def parseCommandLine():
@@ -214,113 +214,112 @@ def main():
     if opts.client_helper == "ntlmssp-client-1" and opts.server_helper == "squid-2.5-ntlmssp":
 
         # We're in the parent
-        writeLine(client_out, "YR")
+        writeLine(client_out, b"YR")
         buf = readLine(client_in)
-
-        if buf.count("YR ", 0, 3) != 1:
+        if buf.count(b"YR ", 0, 3) != 1:
             sys.exit(1)
 
         writeLine(server_out, buf)
         buf = readLine(server_in)
 
-        if buf.count("TT ", 0, 3) != 1:
+        if buf.count(b"TT ", 0, 3) != 1:
             sys.exit(2)
 
         writeLine(client_out, buf)
         buf = readLine(client_in)
 
-        if buf.count("AF ", 0, 3) != 1:
+        if buf.count(b"AF ", 0, 3) != 1:
             sys.exit(3)
 
         # Client sends 'AF <base64 blob>' but server expects 'KK <abse64 blob>'
-        buf = buf.replace("AF", "KK", 1)
+        buf = buf.replace(b"AF", b"KK", 1)
 
         writeLine(server_out, buf)
         buf = readLine(server_in)
 
-        if buf.count("AF ", 0, 3) != 1:
+        if buf.count(b"AF ", 0, 3) != 1:
             sys.exit(4)
 
     elif opts.client_helper == "ntlmssp-client-1" and opts.server_helper == "gss-spnego":
         # We're in the parent
-        writeLine(client_out, "YR")
+        writeLine(client_out, b"YR")
         buf = readLine(client_in)
 
-        if buf.count("YR ", 0, 3) != 1:
+        if buf.count(b"YR ", 0, 3) != 1:
             sys.exit(1)
 
         writeLine(server_out, buf)
         buf = readLine(server_in)
 
-        if buf.count("TT ", 0, 3) != 1:
+        if buf.count(b"TT ", 0, 3) != 1:
             sys.exit(2)
 
         writeLine(client_out, buf)
         buf = readLine(client_in)
 
-        if buf.count("AF ", 0, 3) != 1:
+        if buf.count(b"AF ", 0, 3) != 1:
             sys.exit(3)
 
         # Client sends 'AF <base64 blob>' but server expects 'KK <abse64 blob>'
-        buf = buf.replace("AF", "KK", 1)
+        buf = buf.replace(b"AF", b"KK", 1)
 
         writeLine(server_out, buf)
         buf = readLine(server_in)
 
-        if buf.count("AF * ", 0, 5) != 1:
+        if buf.count(b"AF * ", 0, 5) != 1:
             sys.exit(4)
 
     elif opts.client_helper == "gss-spnego-client" and opts.server_helper == "gss-spnego":
         # We're in the parent
-        writeLine(server_out, "YR")
+        writeLine(server_out, b"YR")
         buf = readLine(server_in)
 
         while True:
-            if buf.count("AF ", 0, 3) != 1 and buf.count("TT ", 0, 3) != 1:
+            if buf.count(b"AF ", 0, 3) != 1 and buf.count(b"TT ", 0, 3) != 1:
                 sys.exit(1)
 
             writeLine(client_out, buf)
             buf = readLine(client_in)
 
-            if buf.count("AF", 0, 2) == 1:
+            if buf.count(b"AF", 0, 2) == 1:
                 break
 
-            if buf.count("AF ", 0, 5) != 1 and buf.count("KK ", 0, 3) != 1 and buf.count("TT ", 0, 3) != 1:
+            if buf.count(b"AF ", 0, 5) != 1 and buf.count(b"KK ", 0, 3) != 1 and buf.count(b"TT ", 0, 3) != 1:
                 sys.exit(2)
 
             writeLine(server_out, buf)


-- 
Samba Shared Repository



More information about the samba-cvs mailing list