[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Fri Feb 9 11:35:03 UTC 2018
The branch, master has been updated
via cefb41b sambatool drs showrepl: prefer self over ctx in python classes
via f6f1929 samba-tool rodc: consistently use self.outf, not stdout
via 055b730 subunit.run: report failure in process return code
via d8aa50b python samdb.newuser(): use user DN not samaccountname to set password
via a43dbb9 tests/samba_tool user virtualCryptSHA: remove unused py3 incompatible import
via 0e912a7 tests/password_hash: avoid py3-incompatible md5 module
via 57784b4 tests/samba-tool user_wdigest: avoid py3-incompatible md5 module
via 5a483bc lib/crypto/REQUIREMENTS: DRSUAPI replication replicated secrets was missing from the RC4 section
from be3c8d0 lib: Make g_lock_locks use TDB_DATA
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit cefb41b0edb273a0095e5bda85c9ce5cc3208fa3
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu Feb 1 16:08:34 2018 +1300
sambatool drs showrepl: prefer self over ctx in python classes
and the line length too.
(Now only python/samba/join.py uses ctx for self, but at least it does
it consistently. This was the only ctx function in the class).
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Fri Feb 9 12:34:06 CET 2018 on sn-devel-144
commit f6f192934c8d170b1786eb2fd09560b7e02b50d4
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu Feb 1 15:28:28 2018 +1300
samba-tool rodc: consistently use self.outf, not stdout
This increases the output of some commands from the point of view of
tests which read the outf, so we also need to change those tests a
bit.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 055b7308d252d3b1501f61884defcd5bbe91049e
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Fri Feb 9 09:51:54 2018 +1300
subunit.run: report failure in process return code
The protocol requires that the TestResult object remembers when it has failed, but
in subclassing unittest.TestResult we forgot to ensure this is true.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit d8aa50b217b16b7e809fa5d59b6240a5671e86b8
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Fri Feb 2 10:35:25 2018 +1300
python samdb.newuser(): use user DN not samaccountname to set password
This is noticably faster in cases (e.g. tests) where the same user
is added and deleted many times.
The rreason is samaccountname is retained for deleted objects, so the
search finds multiple objects that need to be filtered out internally.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit a43dbb93ffa47c2c39e7bb1d89f3f93941b9e566
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu Feb 1 12:02:29 2018 +1300
tests/samba_tool user virtualCryptSHA: remove unused py3 incompatible import
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 0e912a7303bdc859175a6a65106b63d404f85684
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu Feb 1 12:01:10 2018 +1300
tests/password_hash: avoid py3-incompatible md5 module
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 57784b41c1245397b1d8eaabdff0553f205b5231
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu Feb 1 11:56:06 2018 +1300
tests/samba-tool user_wdigest: avoid py3-incompatible md5 module
In Python3, the md5 and sha modules are gone, but the functions are
available via hashlib (which is also in python 2.5+).
The md5.hexdigest() does what binascii.hexlify(md5.digest()) does.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 5a483bc0d1d1daf68999c397a0094631fadacc40
Author: Andrew Bartlett <abartlet at samba.org>
Date: Fri Feb 9 16:51:22 2018 +1300
lib/crypto/REQUIREMENTS: DRSUAPI replication replicated secrets was missing from the RC4 section
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
-----------------------------------------------------------------------
Summary of changes:
lib/crypto/REQUIREMENTS | 1 +
python/samba/netcmd/drs.py | 5 +++--
python/samba/netcmd/rodc.py | 4 ++--
python/samba/samdb.py | 4 +++-
python/samba/subunit/run.py | 7 +++++++
python/samba/tests/password_hash.py | 4 ++--
python/samba/tests/samba_tool/rodc.py | 7 +++++--
python/samba/tests/samba_tool/user_virtualCryptSHA.py | 2 --
python/samba/tests/samba_tool/user_wdigest.py | 6 ++----
9 files changed, 25 insertions(+), 15 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/crypto/REQUIREMENTS b/lib/crypto/REQUIREMENTS
index 3cd8a15..ff91a2f 100644
--- a/lib/crypto/REQUIREMENTS
+++ b/lib/crypto/REQUIREMENTS
@@ -16,6 +16,7 @@ ARCFOUR (RC4)
- Password encryption on SAMR for password set/get
- NETLOGON SamLogon session keys
- Schannel
+ - DRSUAPI replication replicated secrets
# GNUTLS >= 3.0.0
# NETTLE
diff --git a/python/samba/netcmd/drs.py b/python/samba/netcmd/drs.py
index e1886b9..0ccbf9a 100644
--- a/python/samba/netcmd/drs.py
+++ b/python/samba/netcmd/drs.py
@@ -112,13 +112,14 @@ class cmd_drs_showrepl(Command):
self.message("\t\tLast success @ %s" % nttime2string(n.last_success))
self.message("")
- def drsuapi_ReplicaInfo(ctx, info_type):
+ def drsuapi_ReplicaInfo(self, info_type):
'''call a DsReplicaInfo'''
req1 = drsuapi.DsReplicaGetInfoRequest1()
req1.info_type = info_type
try:
- (info_type, info) = ctx.drsuapi.DsReplicaGetInfo(ctx.drsuapi_handle, 1, req1)
+ (info_type, info) = self.drsuapi.DsReplicaGetInfo(
+ self.drsuapi_handle, 1, req1)
except Exception, e:
raise CommandError("DsReplicaGetInfo of type %u failed" % info_type, e)
return (info_type, info)
diff --git a/python/samba/netcmd/rodc.py b/python/samba/netcmd/rodc.py
index 41a7a85..533f944 100644
--- a/python/samba/netcmd/rodc.py
+++ b/python/samba/netcmd/rodc.py
@@ -149,9 +149,9 @@ class cmd_rodc_preload(Command):
local_samdb.transaction_commit()
if len(errors) > 0:
- print "\nPreload encountered problematic users:"
+ self.message("\nPreload encountered problematic users:")
for error in errors:
- print " %s" % error
+ self.message(" %s" % error)
class cmd_rodc(SuperCommand):
diff --git a/python/samba/samdb.py b/python/samba/samdb.py
index d1048a7..7f52a5e 100644
--- a/python/samba/samdb.py
+++ b/python/samba/samdb.py
@@ -459,7 +459,9 @@ member: %s
# Sets the password for it
if setpassword:
- self.setpassword("(samAccountName=%s)" % ldb.binary_encode(username), password,
+ self.setpassword(("(distinguishedName=%s)" %
+ ldb.binary_encode(user_dn)),
+ password,
force_password_change_at_next_login_req)
except:
self.transaction_cancel()
diff --git a/python/samba/subunit/run.py b/python/samba/subunit/run.py
index efaeef9..bb598b4 100755
--- a/python/samba/subunit/run.py
+++ b/python/samba/subunit/run.py
@@ -94,6 +94,10 @@ class TestProtocolClient(unittest.TestResult):
def __init__(self, stream):
unittest.TestResult.__init__(self)
self._stream = stream
+ self.failed = False
+
+ def wasSuccessful(self):
+ return not self.failed
def addError(self, test, error=None):
"""Report an error in test test.
@@ -102,6 +106,7 @@ class TestProtocolClient(unittest.TestResult):
exc_info tuple.
"""
self._addOutcome("error", test, error=error)
+ self.failed = True
def addExpectedFailure(self, test, error=None):
"""Report an expected failure in test test.
@@ -118,6 +123,7 @@ class TestProtocolClient(unittest.TestResult):
exc_info tuple.
"""
self._addOutcome("failure", test, error=error)
+ self.failed = True
def _addOutcome(self, outcome, test, error=None, error_permitted=True):
"""Report a failure in test test.
@@ -161,6 +167,7 @@ class TestProtocolClient(unittest.TestResult):
"""Report an unexpected success in test test.
"""
self._addOutcome("uxsuccess", test, error_permitted=False)
+ self.failed = True
def startTest(self, test):
"""Mark a test as starting its test run."""
diff --git a/python/samba/tests/password_hash.py b/python/samba/tests/password_hash.py
index 611983e..a3a74aa 100644
--- a/python/samba/tests/password_hash.py
+++ b/python/samba/tests/password_hash.py
@@ -32,7 +32,7 @@ from samba.tests import delete_force
import ldb
import samba
import binascii
-import md5
+from hashlib import md5
import crypt
@@ -60,7 +60,7 @@ def get_package(sc, name):
def calc_digest(user, realm, password):
data = "%s:%s:%s" % (user, realm, password)
- return binascii.hexlify(md5.new(data).digest())
+ return md5(data).hexdigest()
class PassWordHashTests(TestCase):
diff --git a/python/samba/tests/samba_tool/rodc.py b/python/samba/tests/samba_tool/rodc.py
index 4851a53..870b5d4 100644
--- a/python/samba/tests/samba_tool/rodc.py
+++ b/python/samba/tests/samba_tool/rodc.py
@@ -104,7 +104,8 @@ class RodcCmdTestCase(SambaToolCmdTest):
"--server", os.environ["DC_SERVER"],
"--ignore-errors")
self.assertCmdSuccess(result, out, err, "ensuring rodc prefetch ran successfully")
- self.assertEqual(out, "Replicating DN CN=sambatool5,CN=Users,%s\n" % self.base_dn)
+ self.assertTrue(out.startswith("Replicating DN CN=sambatool5,CN=Users,%s\n"
+ % self.base_dn))
def test_multi_with_missing_name_failure(self):
(result, out, err) = self.runsubcmd("rodc", "preload",
@@ -119,7 +120,9 @@ class RodcCmdTestCase(SambaToolCmdTest):
"--server", os.environ["DC_SERVER"],
"--ignore-errors")
self.assertCmdSuccess(result, out, err, "ensuring rodc prefetch ran successfully")
- self.assertEqual(out, "Replicating DN CN=sambatool6,CN=Users,%s\nReplicating DN CN=sambatool5,CN=Users,%s\n" % (self.base_dn, self.base_dn))
+ self.assertTrue(out.startswith("Replicating DN CN=sambatool6,CN=Users,%s\n"
+ "Replicating DN CN=sambatool5,CN=Users,%s\n"
+ % (self.base_dn, self.base_dn)))
def test_multi_without_group_failure(self):
(result, out, err) = self.runsubcmd("rodc", "preload",
diff --git a/python/samba/tests/samba_tool/user_virtualCryptSHA.py b/python/samba/tests/samba_tool/user_virtualCryptSHA.py
index 909de37..3edf1a4 100644
--- a/python/samba/tests/samba_tool/user_virtualCryptSHA.py
+++ b/python/samba/tests/samba_tool/user_virtualCryptSHA.py
@@ -28,8 +28,6 @@ from samba.auth import system_session
from samba.ndr import ndr_unpack
from samba.dcerpc import drsblobs
from samba import dsdb
-import binascii
-import md5
import re
import random
import string
diff --git a/python/samba/tests/samba_tool/user_wdigest.py b/python/samba/tests/samba_tool/user_wdigest.py
index b531ad0..497855c 100644
--- a/python/samba/tests/samba_tool/user_wdigest.py
+++ b/python/samba/tests/samba_tool/user_wdigest.py
@@ -30,8 +30,7 @@ from samba import (
)
from samba.ndr import ndr_unpack
from samba.dcerpc import drsblobs
-import binascii
-import md5
+from hashlib import md5
import re
import random
import string
@@ -47,8 +46,7 @@ USER_PASS = ''.join(random.choice(string.ascii_uppercase +
#
def calc_digest(user, realm, password):
data = "%s:%s:%s" % (user, realm, password)
- return "%s:%s:%s" % (user, realm, binascii.hexlify(md5.new(data).digest()))
-
+ return "%s:%s:%s" % (user, realm, md5(data).hexdigest())
class UserCmdWdigestTestCase(SambaToolCmdTest):
--
Samba Shared Repository
More information about the samba-cvs
mailing list