[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Thu Sep 6 00:28:02 UTC 2018


The branch, master has been updated
       via  05862b7 s4/selftest: enable samba4.schemaInfo.python for py3
       via  42dfc98 s4/selftest: Enable samba.tests.blackbox.smbcontrol for py3
       via  06f43e9 s4/selftest: enable samba.tests.blackbox.traffic_summary for py3
       via  d055384 s4/selftest: Enable samba.tests.blackbox.traffic_learner for py3
       via  ad17284 python/samba/tests: Change native string to binary for py2/py3 compat
       via  4ca09e4 s4/selftest: samba.tests.blackbox.traffic_replay enabled for py3
       via  6401eba s4/selftest: samba.tests.emulate.traffic_packet enable for py3
       via  5c2e06f s4/selftest: enable samba.tests.emulate.traffic for py3
       via  2a97996 python/samba/emulate: PY3 port of samba.tests.emulate.traffic_packet
       via  94c9820 python/samba/tests: fix traffic for py2/py3 compatability
       via  9dd1271 s4/selftest: enable samba.tests.py_credentials for py3
       via  c73c9be python/samba/tests: port samba.tests.py_credentials for py2/py3 compat
       via  3fd9b77 auth/credentials: py2/py3 credential key needs to return bytes
       via  8970ec1 selftest/knownfail.d: Add PY3 rule for samba.tests.py_credentials
       via  5ffcc32 s4/selftest: enable samba.tests.encrypted_secrets for python3
       via  e96fcb8 python/samba/tests: PY3 port of samba.tests.encrypted_secrets
       via  c719b03 selftest/knownfail.d: Add PY3 rule for samba.tests.encrypted_secrets
       via  b7909eb s4/selftest: enable samba.tests.password_hash_ldap for python3
       via  0854cca s4/selftest: enable samba.tests.password_hash_fl2008 for python3
       via  1d18ef2 python/samba/tests: py3 port for samba.test.password_hash_ldap
       via  5bb286a s4/selftest: enable samba.tests.password_hash_gpgme for python3
       via  ccbecac python/samba/tests: make password_hash.py py2/py3 compatible
       via  36c3c7d s4/selftest: enable tdb.python for python3
      from  778878a selftest: Run libsmbclient tests with NT1 and SMB3

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


- Log -----------------------------------------------------------------
commit 05862b7bb0e62ba500b68cfc3403a85b00aa61dc
Author: Noel Power <noel.power at suse.com>
Date:   Thu May 10 13:16:28 2018 +0100

    s4/selftest: enable samba4.schemaInfo.python for py3
    
    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): Thu Sep  6 02:27:51 CEST 2018 on sn-devel-144

commit 42dfc985424358061542cdccfadb88f8abc223e9
Author: Noel Power <noel.power at suse.com>
Date:   Thu May 10 12:51:19 2018 +0100

    s4/selftest: Enable samba.tests.blackbox.smbcontrol for py3
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 06f43e9b9d1c3cb5714558c64fe25fde227d4764
Author: Noel Power <noel.power at suse.com>
Date:   Thu May 10 12:39:36 2018 +0100

    s4/selftest: enable samba.tests.blackbox.traffic_summary for py3
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d0553847fdb4b3ebf8e0a1f11736f5a050da5375
Author: Noel Power <noel.power at suse.com>
Date:   Thu May 10 12:36:32 2018 +0100

    s4/selftest: Enable samba.tests.blackbox.traffic_learner for py3
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ad1728417434d437da3e207d838ab8253403359d
Author: Noel Power <noel.power at suse.com>
Date:   Thu May 10 12:35:58 2018 +0100

    python/samba/tests: Change native string to binary for py2/py3 compat
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 4ca09e43bf75b895c16a96b90b6dd9f333cb7873
Author: Noel Power <noel.power at suse.com>
Date:   Thu May 10 12:23:08 2018 +0100

    s4/selftest: samba.tests.blackbox.traffic_replay enabled for py3
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6401eba1850fc271cf7e624a7c6fa71c413bcf75
Author: Noel Power <noel.power at suse.com>
Date:   Thu May 10 11:58:35 2018 +0100

    s4/selftest: samba.tests.emulate.traffic_packet enable for py3
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 5c2e06f78ca8fb2d5564ee57f594ac2ce10832b4
Author: Noel Power <noel.power at suse.com>
Date:   Wed May 9 20:09:10 2018 +0100

    s4/selftest: enable samba.tests.emulate.traffic for py3
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 2a97996c0aa0aa40cb2280145327cb17bd08df49
Author: Noel Power <noel.power at suse.com>
Date:   Thu May 10 11:57:59 2018 +0100

    python/samba/emulate: PY3 port of samba.tests.emulate.traffic_packet
    
    Fixes
    + None cannot be used with '<' or '>' operators
    + ord expects 'str'
    + unicode doesn't exist in py3
    + bytes class does not have encode method
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 94c982004f8182bcbe8ade897b2128efde28168d
Author: Noel Power <noel.power at suse.com>
Date:   Wed May 9 20:05:36 2018 +0100

    python/samba/tests: fix traffic for py2/py3 compatability
    
    load/save operations return randomly sorted dictionaries in python3
    these changes make sure the already sorted expected results are
    compared with sorted actual values.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 9dd1271a35a1ce4939a61fdae237e20ad5776d94
Author: Noel Power <noel.power at suse.com>
Date:   Wed May 9 16:11:49 2018 +0100

    s4/selftest: enable samba.tests.py_credentials for py3
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c73c9be14feb58fcac9bb2298ed5372d6b60a59d
Author: Noel Power <noel.power at suse.com>
Date:   Wed Aug 8 12:51:20 2018 +0100

    python/samba/tests: port samba.tests.py_credentials for py2/py3 compat
    
    + ord takes 'str' param
    + unicode doesn't exist in py3
    + py3 bytes class doesn't have encode method, try to ensure py2
      code runs unchanged while adapting code (by using get_string)
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3fd9b77ad49aa8c482c15f7b408c3599c157716b
Author: Noel Power <noel.power at suse.com>
Date:   Wed May 9 16:09:00 2018 +0100

    auth/credentials: py2/py3 credential key needs to return bytes
    
    new_client_authenticator returns a dictionary. The key
    'credential' needs to return bytes in Python3, without this
    change the the code will attempt to convert the binary data to
    a string (resulting sometimes in decode errors).
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 8970ec195c6a3a18486bd7f4fada3adf90ff8f13
Author: Noel Power <noel.power at suse.com>
Date:   Mon Sep 3 15:21:07 2018 +0100

    selftest/knownfail.d: Add PY3 rule for samba.tests.py_credentials
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 5ffcc323b1d1e48d21dbe575e3ffeb828584ced8
Author: Noel Power <noel.power at suse.com>
Date:   Wed May 9 12:11:48 2018 +0100

    s4/selftest: enable samba.tests.encrypted_secrets for python3
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e96fcb88c23b470c5d26cf18b4da1ef2a38c0def
Author: Noel Power <noel.power at suse.com>
Date:   Wed May 9 12:07:20 2018 +0100

    python/samba/tests: PY3 port of samba.tests.encrypted_secrets
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c719b0362bbdd0e587bbc9d1d45a68e98e5452b1
Author: Noel Power <noel.power at suse.com>
Date:   Mon Sep 3 14:22:17 2018 +0100

    selftest/knownfail.d: Add PY3 rule for samba.tests.encrypted_secrets
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b7909eb29dc4be813561d84c2205ba38d5c06109
Author: Noel Power <noel.power at suse.com>
Date:   Wed May 9 11:37:42 2018 +0100

    s4/selftest: enable samba.tests.password_hash_ldap for python3
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 0854cca4ff375612614b38b1fecc6cd9677f5e2f
Author: Noel Power <noel.power at suse.com>
Date:   Wed May 9 11:27:40 2018 +0100

    s4/selftest: enable samba.tests.password_hash_fl2008 for python3
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 1d18ef26562615f91dd1065f9213a2a57285e605
Author: Noel Power <noel.power at suse.com>
Date:   Wed May 9 11:37:16 2018 +0100

    python/samba/tests: py3 port for samba.test.password_hash_ldap
    
    user samba.compat.text_type instead of unicode
    
    in py2 text_type is an alias for unicode
    in py3 text_type is an alias for str (which does nothing if
    the input is already str)
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 5bb286ab79562594eac86a2b463a1f987f98c792
Author: Noel Power <noel.power at suse.com>
Date:   Wed May 9 11:26:02 2018 +0100

    s4/selftest: enable samba.tests.password_hash_gpgme for python3
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ccbecac3b22d6039e2196ba766ad4113220cbde5
Author: Noel Power <noel.power at suse.com>
Date:   Wed May 9 11:24:48 2018 +0100

    python/samba/tests: make password_hash.py py2/py3 compatible
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 36c3c7d1a46df07af1f94d99fb7f22222e70506b
Author: Noel Power <noel.power at suse.com>
Date:   Wed May 9 10:20:35 2018 +0100

    s4/selftest: enable tdb.python for python3
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 auth/credentials/pycredentials.c               |  2 +-
 python/samba/emulate/traffic.py                | 16 ++++++-------
 python/samba/emulate/traffic_packets.py        |  9 ++++----
 python/samba/tests/blackbox/traffic_learner.py |  4 ++--
 python/samba/tests/emulate/traffic.py          | 12 ++++++----
 python/samba/tests/encrypted_secrets.py        |  2 +-
 python/samba/tests/password_hash.py            |  8 +++----
 python/samba/tests/password_hash_ldap.py       |  3 ++-
 python/samba/tests/py_credentials.py           | 22 ++++++++----------
 selftest/knownfail.d/encrypted_secrets         |  2 ++
 selftest/knownfail.d/ntlmv1-restrictions       |  5 +++-
 source4/selftest/tests.py                      | 32 +++++++++++++-------------
 12 files changed, 62 insertions(+), 55 deletions(-)


Changeset truncated at 500 lines:

diff --git a/auth/credentials/pycredentials.c b/auth/credentials/pycredentials.c
index c626e3f..56174fe 100644
--- a/auth/credentials/pycredentials.c
+++ b/auth/credentials/pycredentials.c
@@ -659,7 +659,7 @@ static PyObject *py_creds_new_client_authenticator(PyObject *self,
 	netlogon_creds_client_authenticator(
 		nc,
 		&auth);
-	ret = Py_BuildValue("{ss#si}",
+	ret = Py_BuildValue("{s"PYARG_BYTES_LEN"si}",
 			    "credential",
 			    (const char *) &auth.cred, sizeof(auth.cred),
 			    "timestamp", auth.timestamp);
diff --git a/python/samba/emulate/traffic.py b/python/samba/emulate/traffic.py
index 8f58042..ca05108 100644
--- a/python/samba/emulate/traffic.py
+++ b/python/samba/emulate/traffic.py
@@ -50,6 +50,7 @@ from samba.dsdb import (
 from samba.dcerpc.misc import SEC_CHAN_BDC
 from samba import gensec
 from samba import sd_utils
+from samba.compat import get_string
 
 SLEEP_OVERHEAD = 3e-4
 
@@ -436,8 +437,8 @@ class ReplayContext(object):
            than that requested, but not significantly.
         """
         if not failed_last_time:
-            if (self.badpassword_frequency > 0 and
-               random.random() < self.badpassword_frequency):
+            if (self.badpassword_frequency and self.badpassword_frequency > 0
+                and random.random() < self.badpassword_frequency):
                 try:
                     f(bad)
                 except:
@@ -718,7 +719,7 @@ class ReplayContext(object):
     def get_authenticator(self):
         auth = self.machine_creds.new_client_authenticator()
         current  = netr_Authenticator()
-        current.cred.data = [ord(x) for x in auth["credential"]]
+        current.cred.data = [x if isinstance(x, int) else ord(x) for x in auth["credential"]]
         current.timestamp = auth["timestamp"]
 
         subsequent = netr_Authenticator()
@@ -1658,9 +1659,8 @@ def create_machine_account(ldb, instance_id, netbios_name, machinepass):
 
     ou = ou_name(ldb, instance_id)
     dn = "cn=%s,%s" % (netbios_name, ou)
-    utf16pw = unicode(
-        '"' + machinepass.encode('utf-8') + '"', 'utf-8'
-    ).encode('utf-16-le')
+    utf16pw = ('"%s"' % get_string(machinepass)).encode('utf-16-le')
+
     start = time.time()
     ldb.add({
         "dn": dn,
@@ -1678,9 +1678,7 @@ def create_user_account(ldb, instance_id, username, userpass):
     """Create a user account via ldap."""
     ou = ou_name(ldb, instance_id)
     user_dn = "cn=%s,%s" % (username, ou)
-    utf16pw = unicode(
-        '"' + userpass.encode('utf-8') + '"', 'utf-8'
-    ).encode('utf-16-le')
+    utf16pw = ('"%s"' % get_string(userpass)).encode('utf-16-le')
     start = time.time()
     ldb.add({
         "dn": user_dn,
diff --git a/python/samba/emulate/traffic_packets.py b/python/samba/emulate/traffic_packets.py
index aa1d9eeeb..2628727 100644
--- a/python/samba/emulate/traffic_packets.py
+++ b/python/samba/emulate/traffic_packets.py
@@ -564,10 +564,10 @@ def packet_rpc_netlogon_30(packet, conversation, context):
     # subsequent runs
     newpass = context.machine_creds.get_password().encode('utf-16-le')
     pwd_len = len(newpass)
-    filler  = [ord(x) for x in os.urandom(DATA_LEN - pwd_len)]
+    filler  = [x if isinstance(x, int) else ord(x) for x in os.urandom(DATA_LEN - pwd_len)]
     pwd = netlogon.netr_CryptPassword()
     pwd.length = pwd_len
-    pwd.data = filler + [ord(x) for x in newpass]
+    pwd.data = filler + [x if isinstance(x, int) else ord(x) for x in newpass]
     context.machine_creds.encrypt_netr_crypt_password(pwd)
     c.netr_ServerPasswordSet2(context.server,
                               # must ends with $, so use get_username instead
@@ -645,10 +645,11 @@ def samlogon_logon_info(domain_name, computer_name, creds):
 
     logon = netlogon.netr_NetworkInfo()
 
-    logon.challenge     = [ord(x) for x in challenge]
+    logon.challenge     = [x if isinstance(x, int) else ord(x) for x in challenge]
     logon.nt            = netlogon.netr_ChallengeResponse()
     logon.nt.length     = len(response["nt_response"])
-    logon.nt.data       = [ord(x) for x in response["nt_response"]]
+    logon.nt.data       = [x if isinstance(x, int) else ord(x) for x in response["nt_response"]]
+
     logon.identity_info = netlogon.netr_IdentityInfo()
 
     (username, domain)  = creds.get_ntlm_username_domain()
diff --git a/python/samba/tests/blackbox/traffic_learner.py b/python/samba/tests/blackbox/traffic_learner.py
index edafc21..6e945ce 100644
--- a/python/samba/tests/blackbox/traffic_learner.py
+++ b/python/samba/tests/blackbox/traffic_learner.py
@@ -43,8 +43,8 @@ class TrafficLearnerTests(BlackboxTestCase):
 
     def test_no_output_file(self):
         """Run the script with no output file specified"""
-        expected = ("No output file was specified to write the model to.\n"
-                    "Please specify a filename using the --out option.\n")
+        expected = (b"No output file was specified to write the model to.\n"
+                    b"Please specify a filename using the --out option.\n")
         actual = self.check_output(LEARNER)
         self.assertEquals(expected, actual)
 
diff --git a/python/samba/tests/emulate/traffic.py b/python/samba/tests/emulate/traffic.py
index 0cfae02..eb1276b 100644
--- a/python/samba/tests/emulate/traffic.py
+++ b/python/samba/tests/emulate/traffic.py
@@ -93,8 +93,10 @@ class TrafficEmulatorTests(samba.tests.TestCase):
         f.seek(0)
         model2.load(f)
 
-        self.assertEqual(expected_ngrams, model2.ngrams)
-        self.assertEqual(expected_query_details, model2.query_details)
+        ngrams = {k: sorted(v) for k, v in model2.ngrams.items()}
+        details = {k: sorted(v) for k, v in model2.query_details.items()}
+        self.assertEqual(expected_ngrams, ngrams)
+        self.assertEqual(expected_query_details, details)
 
     def test_parse_ngrams(self):
         f = open(TEST_FILE)
@@ -156,5 +158,7 @@ class TrafficEmulatorTests(samba.tests.TestCase):
         f.seek(0)
         model2.load(f)
 
-        self.assertEqual(expected_ngrams, model2.ngrams)
-        self.assertEqual(expected_query_details, model2.query_details)
+        ngrams = {k: sorted(v) for k, v in model2.ngrams.items()}
+        details = {k: sorted(v) for k, v in model2.query_details.items()}
+        self.assertEqual(expected_ngrams, ngrams)
+        self.assertEqual(expected_query_details, details)
diff --git a/python/samba/tests/encrypted_secrets.py b/python/samba/tests/encrypted_secrets.py
index 114f3b9..db08227 100644
--- a/python/samba/tests/encrypted_secrets.py
+++ b/python/samba/tests/encrypted_secrets.py
@@ -80,4 +80,4 @@ class EncryptedSecretsTests(TestCase):
         self.assertTrue(len(res) > 0)
         self.assertTrue("requiredFeatures" in res[0])
         required_features = res[0]["requiredFeatures"]
-        self.assertTrue("encryptedSecrets" in required_features)
+        self.assertTrue(b"encryptedSecrets" in required_features)
diff --git a/python/samba/tests/password_hash.py b/python/samba/tests/password_hash.py
index cd1577f..9892c32 100644
--- a/python/samba/tests/password_hash.py
+++ b/python/samba/tests/password_hash.py
@@ -111,7 +111,7 @@ class PassWordHashTests(TestCase):
         res = self.ldb.search(base=self.ldb.get_config_basedn(),
                               expression="ncName=%s" % self.ldb.get_default_basedn(),
                               attrs=["nETBIOSName"])
-        self.netbios_domain = res[0]["nETBIOSName"][0]
+        self.netbios_domain = str(res[0]["nETBIOSName"][0])
         self.dns_domain = self.ldb.domain_dns_name()
 
         # Gets back the basedn
@@ -161,7 +161,7 @@ class PassWordHashTests(TestCase):
     # Calculate and validate a Wdigest value
     def check_digest(self, user, realm, password, digest):
         expected = calc_digest(user, realm, password)
-        actual = binascii.hexlify(bytearray(digest))
+        actual = binascii.hexlify(bytearray(digest)).decode('utf8')
         error = "Digest expected[%s], actual[%s], " \
                 "user[%s], realm[%s], pass[%s]" % \
                 (expected, actual, user, realm, password)
@@ -312,7 +312,7 @@ class PassWordHashTests(TestCase):
         for (tag, alg, rounds) in expected:
             self.assertEquals(tag, up.hashes[i].scheme)
 
-            data = up.hashes[i].value.split("$")
+            data = up.hashes[i].value.decode('utf8').split("$")
             # Check we got the expected crypt algorithm
             self.assertEquals(alg, data[1])
 
@@ -323,7 +323,7 @@ class PassWordHashTests(TestCase):
 
             # Calculate the expected hash value
             expected = crypt.crypt(USER_PASS, cmd)
-            self.assertEquals(expected, up.hashes[i].value)
+            self.assertEquals(expected, up.hashes[i].value.decode('utf8'))
             i += 1
 
     # Check that the correct nt_hash was stored for userPassword
diff --git a/python/samba/tests/password_hash_ldap.py b/python/samba/tests/password_hash_ldap.py
index c1e6cd5..5bb407e 100644
--- a/python/samba/tests/password_hash_ldap.py
+++ b/python/samba/tests/password_hash_ldap.py
@@ -46,6 +46,7 @@ from samba.ndr import ndr_unpack
 from samba.dcerpc import drsblobs, drsuapi, misc
 from samba import drs_utils, net
 from samba.credentials import Credentials
+from samba.compat import text_type
 import binascii
 import os
 
@@ -72,7 +73,7 @@ class PassWordHashLDAPTests(PassWordHashTests):
         req8.destination_dsa_guid          = null_guid
         req8.source_dsa_invocation_id      = null_guid
         req8.naming_context                = drsuapi.DsReplicaObjectIdentifier()
-        req8.naming_context.dn             = unicode(dn)
+        req8.naming_context.dn             = text_type(dn)
 
         req8.highwatermark = drsuapi.DsReplicaHighWaterMark()
         req8.highwatermark.tmp_highest_usn = 0
diff --git a/python/samba/tests/py_credentials.py b/python/samba/tests/py_credentials.py
index bcf5d3a..b16c726 100644
--- a/python/samba/tests/py_credentials.py
+++ b/python/samba/tests/py_credentials.py
@@ -39,8 +39,11 @@ from samba.dsdb import (
 from samba.ndr import ndr_pack
 from samba.samdb import SamDB
 from samba import NTSTATUSError, ntstatus
+from samba.compat import get_string
+
 import ctypes
 
+
 """
 Integration tests for pycredentials
 """
@@ -48,7 +51,6 @@ Integration tests for pycredentials
 MACHINE_NAME = "PCTM"
 USER_NAME    = "PCTU"
 
-
 class PyCredentialsTests(TestCase):
 
     def setUp(self):
@@ -232,10 +234,10 @@ class PyCredentialsTests(TestCase):
         newpass = samba.generate_random_password(PWD_LEN, PWD_LEN)
         encoded = newpass.encode('utf-16-le')
         pwd_len = len(encoded)
-        filler  = [ord(x) for x in os.urandom(DATA_LEN - pwd_len)]
+        filler  = [x if isinstance(x, int) else ord(x) for x in os.urandom(DATA_LEN - pwd_len)]
         pwd = netlogon.netr_CryptPassword()
         pwd.length = pwd_len
-        pwd.data = filler + [ord(x) for x in encoded]
+        pwd.data = filler + [x if isinstance(x, int) else ord(x) for x in encoded]
         self.machine_creds.encrypt_netr_crypt_password(pwd)
         c.netr_ServerPasswordSet2(self.server,
                                   self.machine_creds.get_workstation(),
@@ -265,9 +267,7 @@ class PyCredentialsTests(TestCase):
         # run failed
         delete_force(self.ldb, self.machine_dn)
 
-        utf16pw = unicode(
-            '"' + self.machine_pass.encode('utf-8') + '"', 'utf-8'
-        ).encode('utf-16-le')
+        utf16pw = ('"%s"' % get_string(self.machine_pass)).encode('utf-16-le')
         self.ldb.add({
             "dn": self.machine_dn,
             "objectclass": "computer",
@@ -295,9 +295,7 @@ class PyCredentialsTests(TestCase):
         # run failed
         delete_force(self.ldb, self.user_dn)
 
-        utf16pw = unicode(
-            '"' + self.user_pass.encode('utf-8') + '"', 'utf-8'
-        ).encode('utf-16-le')
+        utf16pw = ('"%s"' % get_string(self.user_pass)).encode('utf-16-le')
         self.ldb.add({
             "dn": self.user_dn,
             "objectclass": "user",
@@ -317,7 +315,7 @@ class PyCredentialsTests(TestCase):
     def get_authenticator(self, c):
         auth = self.machine_creds.new_client_authenticator()
         current = netr_Authenticator()
-        current.cred.data = [ord(x) for x in auth["credential"]]
+        current.cred.data = [x if isinstance(x, int) else ord(x) for x in auth["credential"]]
         current.timestamp = auth["timestamp"]
 
         subsequent = netr_Authenticator()
@@ -367,10 +365,10 @@ def samlogon_logon_info(domain_name, computer_name, creds,
 
     logon = netlogon.netr_NetworkInfo()
 
-    logon.challenge     = [ord(x) for x in challenge]
+    logon.challenge     = [x if isinstance(x, int) else ord(x) for x in challenge]
     logon.nt            = netlogon.netr_ChallengeResponse()
     logon.nt.length     = len(response["nt_response"])
-    logon.nt.data       = [ord(x) for x in response["nt_response"]]
+    logon.nt.data       = [x if isinstance(x, int) else ord(x) for x in response["nt_response"]]
     logon.identity_info = netlogon.netr_IdentityInfo()
 
     (username, domain)  = creds.get_ntlm_username_domain()
diff --git a/selftest/knownfail.d/encrypted_secrets b/selftest/knownfail.d/encrypted_secrets
index a701d1d..e36ff5f 100644
--- a/selftest/knownfail.d/encrypted_secrets
+++ b/selftest/knownfail.d/encrypted_secrets
@@ -6,3 +6,5 @@
 #   * secrets are not stored as encrypted text when this option is specified
 ^samba.tests.encrypted_secrets.samba.tests.encrypted_secrets.EncryptedSecretsTests.test_encrypted_secrets\(fl2000dc:local\)
 ^samba.tests.encrypted_secrets.samba.tests.encrypted_secrets.EncryptedSecretsTests.test_required_features\(fl2000dc:local\)
+^samba.tests.encrypted_secrets.python3.samba.tests.encrypted_secrets.EncryptedSecretsTests.test_encrypted_secrets\(fl2000dc:local\)
+^samba.tests.encrypted_secrets.python3.samba.tests.encrypted_secrets.EncryptedSecretsTests.test_required_features\(fl2000dc:local\)
diff --git a/selftest/knownfail.d/ntlmv1-restrictions b/selftest/knownfail.d/ntlmv1-restrictions
index b4f4f12..3006044 100644
--- a/selftest/knownfail.d/ntlmv1-restrictions
+++ b/selftest/knownfail.d/ntlmv1-restrictions
@@ -2,4 +2,7 @@
 # in both of these, with vampire_dc however allowing MSCHAPv2
 samba.tests.py_credentials.samba.tests.py_credentials.PyCredentialsTests.test_SamLogonExNTLM\(vampire_dc\)
 samba.tests.py_credentials.samba.tests.py_credentials.PyCredentialsTests.test_SamLogonExMSCHAPv2\(promoted_dc\)
-samba.tests.py_credentials.samba.tests.py_credentials.PyCredentialsTests.test_SamLogonExNTLM\(promoted_dc\)
\ No newline at end of file
+samba.tests.py_credentials.samba.tests.py_credentials.PyCredentialsTests.test_SamLogonExNTLM\(promoted_dc\)
+samba.tests.py_credentials.python3.samba.tests.py_credentials.PyCredentialsTests.test_SamLogonExNTLM\(vampire_dc\)
+samba.tests.py_credentials.python3.samba.tests.py_credentials.PyCredentialsTests.test_SamLogonExMSCHAPv2\(promoted_dc\)
+samba.tests.py_credentials.python3.samba.tests.py_credentials.PyCredentialsTests.test_SamLogonExNTLM\(promoted_dc\)
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index a768631..df9b7fa 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -607,7 +607,7 @@ def planoldpythontestsuite(env, module, name=None, extra_path=[], environ={}, ex
 
 
 planoldpythontestsuite("ad_dc_ntvfs:local", "samba.tests.gensec", extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
-planoldpythontestsuite("none", "simple", extra_path=["%s/lib/tdb/python/tests" % srcdir()], name="tdb.python")
+planoldpythontestsuite("none", "simple", extra_path=["%s/lib/tdb/python/tests" % srcdir()], name="tdb.python",  py3_compatible=True)
 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.dcerpc.sam", py3_compatible=True)
 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.dsdb", py3_compatible=True)
 planpythontestsuite("none", "samba.tests.dsdb_lock", py3_compatible=True)
@@ -744,19 +744,19 @@ planoldpythontestsuite("ad_dc",
 # ad_dc:local functional_level >= 2008, gpg keys available
 planoldpythontestsuite("ad_dc:local",
                        "samba.tests.password_hash_gpgme",
-                       extra_args=['-U"$USERNAME%$PASSWORD"'])
+                       extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
 # ad_dc_ntvfs:local functional level >= 2008, gpg keys not available
 planoldpythontestsuite("ad_dc_ntvfs:local",
                        "samba.tests.password_hash_fl2008",
-                       extra_args=['-U"$USERNAME%$PASSWORD"'])
+                       extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
 # fl2003dc:local functional level < 2008, gpg keys not available
 planoldpythontestsuite("fl2003dc:local",
                        "samba.tests.password_hash_fl2003",
-                       extra_args=['-U"$USERNAME%$PASSWORD"'])
+                       extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
 # ad_dc: wDigest values over ldap
 planoldpythontestsuite("ad_dc",
                        "samba.tests.password_hash_ldap",
-                       extra_args=['-U"$USERNAME%$PASSWORD"'])
+                       extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
 planoldpythontestsuite("ad_dc:local",
                        "samba.tests.domain_backup",
                        extra_args=['-U"$USERNAME%$PASSWORD"'])
@@ -767,16 +767,16 @@ planoldpythontestsuite("none",
 # encrypt secret values on disk.
 planoldpythontestsuite("ad_dc:local",
                        "samba.tests.encrypted_secrets",
-                       extra_args=['-U"$USERNAME%$PASSWORD"'])
+                       extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
 planoldpythontestsuite("vampire_dc:local",
                        "samba.tests.encrypted_secrets",
-                       extra_args=['-U"$USERNAME%$PASSWORD"'])
+                       extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
 # The fl2000dc environment is provisioned with the --plaintext_secrets option
 # so this test will fail, which proves the secrets are not being encrypted.
 # There is an entry in known_fail.d.
 planoldpythontestsuite("fl2000dc:local",
                        "samba.tests.encrypted_secrets",
-                       extra_args=['-U"$USERNAME%$PASSWORD"'])
+                       extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
 
 planpythontestsuite("none",
                     "samba.tests.lsa_string",
@@ -790,22 +790,22 @@ planoldpythontestsuite("ad_dc_ntvfs",
 for env in ["ad_dc_ntvfs", "vampire_dc", "promoted_dc"]:
     planoldpythontestsuite(env,
                            "samba.tests.py_credentials",
-                           extra_args=['-U"$USERNAME%$PASSWORD"'])
+                           extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
 planoldpythontestsuite("ad_dc_ntvfs",
                        "samba.tests.emulate.traffic",
-                       extra_args=['-U"$USERNAME%$PASSWORD"'])
+                       extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
 planoldpythontestsuite("ad_dc_ntvfs",
                        "samba.tests.emulate.traffic_packet",
-                       extra_args=['-U"$USERNAME%$PASSWORD"'])
+                       extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
 planoldpythontestsuite("ad_dc_ntvfs",
                        "samba.tests.blackbox.traffic_replay",
-                       extra_args=['-U"$USERNAME%$PASSWORD"'])
+                       extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
 planoldpythontestsuite("ad_dc_ntvfs",
                        "samba.tests.blackbox.traffic_learner",
-                       extra_args=['-U"$USERNAME%$PASSWORD"'])
+                       extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
 planoldpythontestsuite("ad_dc_ntvfs",
                        "samba.tests.blackbox.traffic_summary",
-                       extra_args=['-U"$USERNAME%$PASSWORD"'])
+                       extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
 planoldpythontestsuite("none", "samba.tests.loadparm")
 
 #
@@ -814,7 +814,7 @@ planoldpythontestsuite("none", "samba.tests.loadparm")
 for env in ["ad_dc_ntvfs:local", "ad_dc:local",
             "fl2003dc:local", "fl2008r2dc:local",
             "promoted_dc:local"]:
-    planoldpythontestsuite(env, "samba.tests.blackbox.smbcontrol")
+    planoldpythontestsuite(env, "samba.tests.blackbox.smbcontrol", py3_compatible=True)
 
 plantestsuite_loadlist("samba4.ldap.python(ad_dc_ntvfs)", "ad_dc_ntvfs", [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
 plantestsuite_loadlist("samba4.tokengroups.krb5.python(ad_dc_ntvfs)", "ad_dc_ntvfs:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/token_group.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '-k', 'yes', '$LOADLIST', '$LISTOPT'])
@@ -825,7 +825,7 @@ plantestsuite("samba4.user_account_control.python(ad_dc_ntvfs)", "ad_dc_ntvfs",
 planoldpythontestsuite("ad_dc_ntvfs", "dsdb_schema_info",
                        extra_path=[os.path.join(samba4srcdir, 'dsdb/tests/python')],
                        name="samba4.schemaInfo.python(ad_dc_ntvfs)",
-                       extra_args=['-U"$DOMAIN/$DC_USERNAME%$DC_PASSWORD"'])
+        extra_args=['-U"$DOMAIN/$DC_USERNAME%$DC_PASSWORD"'], py3_compatible=True)
 
 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.dsdb_schema_attributes")
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list