[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Thu Apr 5 10:17:05 UTC 2018
The branch, master has been updated
via 707af5b selftest: enable py3 for samba.tests.blackbox.ndrdump
via 47761ee selftest: enable py3 for samba.tests.samdb_api
via ff66428 selftest: enable py3 for samba.tests.kcc.graph_utils
via a5bc4d8 selftest: enable py3 for samba.tests.kcc.graph
via 5d774fa selftest: enable py3 for samba.tests.upgradeprovision
via 68d89b0 selftest: enable py3 for samba.tests.hostconfig
via 0ebf527 selftest: enable py3 for samba.tests.common
via 80aaafc selftest: enable py3 for samba.tests.dcerpc.string
via a35dfa0 selftest: enable py3 for samba.tests.dcerpc.array
via 55c9661 selftest: enable py3 for samba.tests.dcerpc.rpc_talloc
via 34cf522 selftest: enable py3 for samba.tests.password_quality
via 87743b3 selftest: enable py3 for samba.tests.upgrade
via 908ee2d3 selftest: enable py3 for samba.tests.blackbox.check_output
via d3e4c47 selftest: enable py3 for samba.tests.xattr
via cf85785 selftest: enable py3 for samba.tests.posixacl
via d28379d wscript_build: fix c modules deps name for Python 3
via fe9e629 samba3: work around bytes formatting for Python 3.4
via 2d593c2 get make test TESTS=samba.tests.provision to work
via 7ad9bdd python3 port for provision.c
via 05617a9 samba python tests: enable samba.tests.ntacls for python3
via ed0844f samba python tests: enable samba.tests.posixacl for python3
via c10925e s4/ntvfs/posix/python: python3 (get|set)xattr value should be bytes
via 53e76ed python3 port for smbd module
via 25e336e python samba test: enable samba.tests.libsmb_samba_internal for py3
via 94fd3cf python3 port for libsmb_samba_internal module
via 22d563b selftest python: get samba.tests.s3idmapdb to run with py3
via 5fd49e8 python selftest: enable samba.tests.s3windb to run with py3
via 1734655 python selftest: enabled samba.tests.s3registry to run with py3
via 8caa2cd python selftest: enable samba.tests.s3passdb to run with python3
via e4779b0 python selftest: enable samba.tests.s3param to run with python3
via c6bba60 python3 port for passdb module
via ac88847 python3 port for param module
via 7ad012d python selftest: split samba3 test into separate tests
via ccc0e06 samba test python: enable samba.tests.policy for py3
via 5222433 python3 port for policy module
via 0210f60 python: Write py3 bin to correct args location
from 653a0a1 ldb: Add test to show a reindex failure must not leave the DB corrupt
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 707af5b31b83cc72ec33bd2e12bad1dbbab9a850
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Thu Apr 5 15:03:18 2018 +1200
selftest: enable py3 for samba.tests.blackbox.ndrdump
No change needed.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Thu Apr 5 12:16:41 CEST 2018 on sn-devel-144
commit 47761ee449bd08e89fba05e5bfbe584524c638a5
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Thu Apr 5 10:47:16 2018 +1200
selftest: enable py3 for samba.tests.samdb_api
Fix bytes and string.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit ff6642820179d7921055afa39f38609b4c7b8c0d
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Wed Apr 4 13:07:38 2018 +1200
selftest: enable py3 for samba.tests.kcc.graph_utils
zip will not return a list in Python 3.
Convert to list.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit a5bc4d8c7a4b0d97d54978f37e9fcabfbde1d38b
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Wed Apr 4 11:29:41 2018 +1200
selftest: enable py3 for samba.tests.kcc.graph
In Python 3, range() will not return a list any more.
So `range(7) * 4` will not work.
Convert range to list to fix.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 5d774fa732ddb0d71b42eed09be041efcc76c6fe
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Wed Apr 4 11:19:48 2018 +1200
selftest: enable py3 for samba.tests.upgradeprovision
1. `has_key` was removed from dict in Python 3, use `in` instead.
2. `cmp` was removed in Python 3, define it ourselves.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 68d89b0a19b73fe218938280e7b4395261d7c269
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Tue Apr 3 15:24:28 2018 +1200
selftest: enable py3 for samba.tests.hostconfig
Fix relative import.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 0ebf52744c5171d4eb5f0b0616d3880d7bbd9db4
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Mon Mar 26 17:07:33 2018 +1300
selftest: enable py3 for samba.tests.common
fix dsdb_Dn comparison for Python 3
In Python 3, the builtin `cmp` funtion was dropped. And the `__cmp__` magic
method in object is no longer honored, which is replaced by 6 new methods:
__eq__, __ne__, __lt__, __le__, __gt__, __ge__.
This caused `tests.CommonTests` failed with `py3_compatiable=True`.
Fixed by adding the above methods.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 80aaafc2ce96b3b18ae66d37cdb70cc731edb6e5
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Tue Apr 3 15:15:12 2018 +1200
selftest: enable py3 for samba.tests.dcerpc.string
No change needed.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit a35dfa017ba47f98a42a14adc70fd5430ca73e0e
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Tue Apr 3 15:13:09 2018 +1200
selftest: enable py3 for samba.tests.dcerpc.array
No change needed.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 55c9661468463fa08097820da382de7a81ed8e84
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Tue Apr 3 15:11:48 2018 +1200
selftest: enable py3 for samba.tests.dcerpc.rpc_talloc
No changes needed.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 34cf522e71a958be0817c35ad6f666a5ba91ba9a
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Tue Apr 3 14:47:41 2018 +1200
selftest: enable py3 for samba.tests.password_quality
No change needed.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 87743b3275f2bd218b417d46aa69b18e56a65ed9
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Tue Apr 3 14:29:26 2018 +1200
selftest: enable py3 for samba.tests.upgrade
`os.tempname` is removed in Python 3.
Use `tempfile` instead.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 908ee2d3d290148403b560fb8cf3a4128cbd2ec8
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Fri Mar 23 14:10:28 2018 +1300
selftest: enable py3 for samba.tests.blackbox.check_output
convert bytes to str for Python 3
`BlackboxTestCase.check_output` will return bytes since it uses
`subprocess.communicate` underneath.
Convert expected string result to bytes for comparing.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit d3e4c4737b14408fccaff2b89f260e81d90fb14e
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Thu Apr 5 14:49:55 2018 +1200
selftest: enable py3 for samba.tests.xattr
Fix bytes and str issue.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit cf8578537726d7239cb2c79fbe8282035569c864
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Thu Apr 5 14:49:25 2018 +1200
selftest: enable py3 for samba.tests.posixacl
Fix bytes and str issue.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit d28379dc4acef6ddb887a2ead0c22e9f93a8aa50
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Wed Mar 28 15:53:50 2018 +1300
wscript_build: fix c modules deps name for Python 3
In wscript_build, the lib name in deps list may have postfix for Python
3. Instead of hard coding the base name directly, need to load correct
name for each Python version with `bld.pyembed_libname`.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit fe9e62935c459e4cdab0cefea1412614dd1969a8
Author: Joe Guo <joeg at catalyst.net.nz>
Date: Wed Mar 28 15:08:40 2018 +1300
samba3: work around bytes formatting for Python 3.4
b'%s\x00' % key
The above % formatting for bytes is only available since Python 3.5,
however we need to support Python 3.4 so far.
Work around this with `+`.
Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 2d593c27fd4f7162f5f71f97d44a4fe286d53ff5
Author: Noel Power <noel.power at suse.com>
Date: Mon Mar 5 16:08:01 2018 +0000
get make test TESTS=samba.tests.provision to work
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 7ad9bdd684db2f894e7d5bd911c73ef93252b008
Author: Noel Power <noel.power at suse.com>
Date: Mon Feb 5 10:56:20 2018 +0000
python3 port for provision.c
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 05617a9eee726682e5b2db1e42d2181097bd37c4
Author: Noel Power <noel.power at suse.com>
Date: Wed Mar 28 10:33:12 2018 +0100
samba python tests: enable samba.tests.ntacls for python3
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit ed0844fbb9b7d0f3fe0358cde16b31e453b7306d
Author: Noel Power <noel.power at suse.com>
Date: Tue Mar 6 15:03:57 2018 +0000
samba python tests: enable samba.tests.posixacl for python3
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit c10925e9507f8810f3ba91ac51454357a6c67c8f
Author: Noel Power <noel.power at suse.com>
Date: Tue Mar 6 15:03:13 2018 +0000
s4/ntvfs/posix/python: python3 (get|set)xattr value should be bytes
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 53e76ed2ff1f9a82eb5260c10e86c890d893eb2a
Author: Noel Power <noel.power at suse.com>
Date: Mon Feb 5 11:10:46 2018 +0000
python3 port for smbd module
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 25e336ebbf373bd486ae31a654614925c2cfb111
Author: Noel Power <noel.power at suse.com>
Date: Thu Mar 8 10:37:23 2018 +0000
python samba test: enable samba.tests.libsmb_samba_internal for py3
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 94fd3cfa79e65128f86cd109d2ae4ee1e563bc40
Author: Noel Power <noel.power at suse.com>
Date: Mon Feb 5 11:34:15 2018 +0000
python3 port for libsmb_samba_internal module
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 22d563b13eb122197bdf0b24937a78aec3b260af
Author: Noel Power <noel.power at suse.com>
Date: Thu Mar 22 12:46:55 2018 +0000
selftest python: get samba.tests.s3idmapdb to run with py3
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 5fd49e895637ca491c7d716c3c18033129211f34
Author: Noel Power <noel.power at suse.com>
Date: Thu Mar 22 12:39:43 2018 +0000
python selftest: enable samba.tests.s3windb to run with py3
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 1734655bf805342ce4b2a33c78729b681846da52
Author: Noel Power <noel.power at suse.com>
Date: Thu Mar 22 12:35:11 2018 +0000
python selftest: enabled samba.tests.s3registry to run with py3
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 8caa2cd48a8ad4ce6aeeb16e48a2382f913e073b
Author: Noel Power <noel.power at suse.com>
Date: Thu Mar 22 12:26:15 2018 +0000
python selftest: enable samba.tests.s3passdb to run with python3
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit e4779b0da3140e0a9777a39b82222cd1a8102780
Author: Noel Power <noel.power at suse.com>
Date: Thu Mar 22 12:21:12 2018 +0000
python selftest: enable samba.tests.s3param to run with python3
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit c6bba60c8b3b203396af6713d565fbdea2a8f322
Author: Noel Power <noel.power at suse.com>
Date: Mon Feb 5 12:50:48 2018 +0000
python3 port for passdb module
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit ac888471b05e9529b84c221177ec820bde1be893
Author: Noel Power <noel.power at suse.com>
Date: Mon Feb 5 11:39:58 2018 +0000
python3 port for param module
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 7ad012d4118a1031be3111ee5305109a9d3117d0
Author: Noel Power <noel.power at suse.com>
Date: Wed Mar 21 18:24:18 2018 +0000
python selftest: split samba3 test into separate tests
This patch splits the tests contained in samba3.py into separate
tests s3idmapdb.py, s3param.py, s3passdb.py, s3registry.py, s3windb.py
This allows test of associated python c-modules to be done independently.
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit ccc0e06caa0d4657f70c2461a63efaa7bd1f6d40
Author: Noel Power <noel.power at suse.com>
Date: Thu Mar 8 11:28:16 2018 +0000
samba test python: enable samba.tests.policy for py3
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 522243364139e88352fd6f58a0eda5a950a35c8e
Author: Noel Power <noel.power at suse.com>
Date: Mon Feb 5 11:04:53 2018 +0000
python3 port for policy module
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
commit 0210f60759c90e22fe86738490b328df7ff23b6f
Author: David Mulder <dmulder at suse.com>
Date: Tue Feb 13 08:35:12 2018 -0700
python: Write py3 bin to correct args location
Comands written like this were working:
python /home/dmulder/code/samba/source4/scripting/bin/subunitrun
Changed to:
/usr/bin/python3 /home/dmulder/code/samba/source4/scripting/bin/subunitrun
But commands with env args overwrite the wrong arg:
CLIENT_IP=127.0.0.11 SOCKET_WRAPPER_DEFAULT_IFACE=11 python /home/dmulder/code/samba/source4/scripting/bin/subunitrun
Changed to:
/usr/bin/python3 SOCKET_WRAPPER_DEFAULT_IFACE=11 python /home/dmulder/code/samba/source4/scripting/bin/subunitrun
And were further mangled in plantestsuite_loadlist() to:
/usr/bin/python3 /home/dmulder/code/samba/source4/scripting/bin/subunitrun SOCKET_WRAPPER_DEFAULT_IFACE=11 python /home/dmulder/code/samba/source4/scripting/bin/subunitrun
Signed-off-by: David Mulder <dmulder at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
-----------------------------------------------------------------------
Summary of changes:
python/samba/common.py | 27 +++
python/samba/descriptor.py | 16 +-
python/samba/hostconfig.py | 4 +-
python/samba/ms_schema.py | 14 +-
python/samba/samba3/__init__.py | 49 +++---
python/samba/tests/__init__.py | 4 +-
python/samba/tests/blackbox/check_output.py | 4 +-
python/samba/tests/kcc/graph.py | 6 +-
python/samba/tests/kcc/graph_utils.py | 2 +-
python/samba/tests/posixacl.py | 6 +-
python/samba/tests/provision.py | 2 +-
python/samba/tests/s3idmapdb.py | 57 +++++++
python/samba/tests/s3param.py | 50 ++++++
python/samba/tests/{samba3.py => s3passdb.py} | 86 +---------
python/samba/tests/s3registry.py | 54 ++++++
python/samba/tests/s3windb.py | 45 +++++
python/samba/tests/samdb_api.py | 20 +--
python/samba/tests/xattr.py | 6 +-
python/samba/upgradehelpers.py | 3 +-
selftest/tests.py | 38 +++--
source3/libsmb/pylibsmb.c | 28 +++-
source3/param/pyparam.c | 22 ++-
source3/param/wscript_build | 6 +-
source3/passdb/py_passdb.c | 226 ++++++++++++++------------
source3/passdb/wscript_build | 7 +-
source3/smbd/pysmbd.c | 21 ++-
source3/wscript_build | 11 +-
source4/lib/policy/pypolicy.c | 22 ++-
source4/lib/policy/wscript_build | 13 +-
source4/ntvfs/posix/python/pyposix_eadb.c | 4 +-
source4/ntvfs/posix/python/pyxattr_native.c | 4 +-
source4/ntvfs/posix/python/pyxattr_tdb.c | 4 +-
source4/param/provision.c | 47 +++---
source4/selftest/tests.py | 8 +-
34 files changed, 569 insertions(+), 347 deletions(-)
create mode 100644 python/samba/tests/s3idmapdb.py
create mode 100644 python/samba/tests/s3param.py
rename python/samba/tests/{samba3.py => s3passdb.py} (68%)
create mode 100644 python/samba/tests/s3registry.py
create mode 100644 python/samba/tests/s3windb.py
Changeset truncated at 500 lines:
diff --git a/python/samba/common.py b/python/samba/common.py
index 1c410a4..6600399 100644
--- a/python/samba/common.py
+++ b/python/samba/common.py
@@ -23,6 +23,14 @@ from samba.ndr import ndr_pack
from samba.dcerpc import misc
import binascii
+from samba.compat import PY3
+
+
+if PY3:
+ # cmp() exists only in Python 2
+ def cmp(a, b):
+ return (a > b) - (a < b)
+
def confirm(msg, forced=False, allow_all=False):
"""confirm an action with the user
@@ -110,6 +118,25 @@ class dsdb_Dn(object):
v = cmp(dn1.binary, dn2.binary)
return v
+ # In Python3, __cmp__ is replaced by these 6 methods
+ def __eq__(self, other):
+ return self.__cmp__(other) == 0
+
+ def __ne__(self, other):
+ return self.__cmp__(other) != 0
+
+ def __lt__(self, other):
+ return self.__cmp__(other) < 0
+
+ def __le__(self, other):
+ return self.__cmp__(other) <= 0
+
+ def __gt__(self, other):
+ return self.__cmp__(other) > 0
+
+ def __ge__(self, other):
+ return self.__cmp__(other) >= 0
+
def get_binary_integer(self):
'''return binary part of a dsdb_Dn as an integer, or None'''
if self.prefix == '':
diff --git a/python/samba/descriptor.py b/python/samba/descriptor.py
index cf797cc..a9c5e15 100644
--- a/python/samba/descriptor.py
+++ b/python/samba/descriptor.py
@@ -543,23 +543,23 @@ def get_diff_sds(refsd, cursd, domainsid, checkSacl = True):
hash_cur = chunck_sddl(cursddl)
hash_ref = chunck_sddl(refsddl)
- if not hash_cur.has_key("owner"):
+ if "owner" not in hash_cur:
txt = "\tNo owner in current SD"
- elif hash_ref.has_key("owner") and hash_cur["owner"] != hash_ref["owner"]:
+ elif "owner" in hash_ref and hash_cur["owner"] != hash_ref["owner"]:
txt = "\tOwner mismatch: %s (in ref) %s" \
"(in current)\n" % (hash_ref["owner"], hash_cur["owner"])
- if not hash_cur.has_key("group"):
+ if "group" not in hash_cur:
txt = "%s\tNo group in current SD" % txt
- elif hash_ref.has_key("group") and hash_cur["group"] != hash_ref["group"]:
+ elif "group" in hash_ref and hash_cur["group"] != hash_ref["group"]:
txt = "%s\tGroup mismatch: %s (in ref) %s" \
"(in current)\n" % (txt, hash_ref["group"], hash_cur["group"])
- parts = [ "dacl" ]
+ parts = ["dacl"]
if checkSacl:
parts.append("sacl")
for part in parts:
- if hash_cur.has_key(part) and hash_ref.has_key(part):
+ if part in hash_cur and part in hash_ref:
# both are present, check if they contain the same ACE
h_cur = set()
@@ -590,9 +590,9 @@ def get_diff_sds(refsd, cursd, domainsid, checkSacl = True):
txt = "%s\t\t%s ACE is not present in the" \
" current\n" % (txt, item)
- elif hash_cur.has_key(part) and not hash_ref.has_key(part):
+ elif part in hash_cur and part not in hash_ref:
txt = "%s\tReference ACL hasn't a %s part\n" % (txt, part)
- elif not hash_cur.has_key(part) and hash_ref.has_key(part):
+ elif part not in hash_cur and part in hash_ref:
txt = "%s\tCurrent ACL hasn't a %s part\n" % (txt, part)
return txt
diff --git a/python/samba/hostconfig.py b/python/samba/hostconfig.py
index a66fbc2..08fff4f 100644
--- a/python/samba/hostconfig.py
+++ b/python/samba/hostconfig.py
@@ -16,8 +16,8 @@
#
"""Local host configuration."""
-
-from samdb import SamDB
+from __future__ import absolute_import
+from .samdb import SamDB
class Hostconfig(object):
"""Aggregate object that contains all information about the configuration
diff --git a/python/samba/ms_schema.py b/python/samba/ms_schema.py
index 12a9909..889b7f5 100644
--- a/python/samba/ms_schema.py
+++ b/python/samba/ms_schema.py
@@ -69,13 +69,13 @@ bitFields["schemaflagsex"] = {
# ADTS: 3.1.1.2.2.2
oMObjectClassBER = {
- '1.3.12.2.1011.28.0.702' : base64.b64encode('\x2B\x0C\x02\x87\x73\x1C\x00\x85\x3E'),
- '1.2.840.113556.1.1.1.12': base64.b64encode('\x2A\x86\x48\x86\xF7\x14\x01\x01\x01\x0C'),
- '2.6.6.1.2.5.11.29' : base64.b64encode('\x56\x06\x01\x02\x05\x0B\x1D'),
- '1.2.840.113556.1.1.1.11': base64.b64encode('\x2A\x86\x48\x86\xF7\x14\x01\x01\x01\x0B'),
- '1.3.12.2.1011.28.0.714' : base64.b64encode('\x2B\x0C\x02\x87\x73\x1C\x00\x85\x4A'),
- '1.3.12.2.1011.28.0.732' : base64.b64encode('\x2B\x0C\x02\x87\x73\x1C\x00\x85\x5C'),
- '1.2.840.113556.1.1.1.6' : base64.b64encode('\x2A\x86\x48\x86\xF7\x14\x01\x01\x01\x06')
+ '1.3.12.2.1011.28.0.702' : base64.b64encode(b'\x2B\x0C\x02\x87\x73\x1C\x00\x85\x3E').decode('utf8'),
+ '1.2.840.113556.1.1.1.12': base64.b64encode(b'\x2A\x86\x48\x86\xF7\x14\x01\x01\x01\x0C').decode('utf8'),
+ '2.6.6.1.2.5.11.29' : base64.b64encode(b'\x56\x06\x01\x02\x05\x0B\x1D').decode('utf8'),
+ '1.2.840.113556.1.1.1.11': base64.b64encode(b'\x2A\x86\x48\x86\xF7\x14\x01\x01\x01\x0B').decode('utf8'),
+ '1.3.12.2.1011.28.0.714' : base64.b64encode(b'\x2B\x0C\x02\x87\x73\x1C\x00\x85\x4A').decode('utf8'),
+ '1.3.12.2.1011.28.0.732' : base64.b64encode(b'\x2B\x0C\x02\x87\x73\x1C\x00\x85\x5C').decode('utf8'),
+ '1.2.840.113556.1.1.1.6' : base64.b64encode(b'\x2A\x86\x48\x86\xF7\x14\x01\x01\x01\x06').decode('utf8')
}
# separated by commas in docs, and must be broken up
diff --git a/python/samba/samba3/__init__.py b/python/samba/samba3/__init__.py
index 8df017054..f792783 100644
--- a/python/samba/samba3/__init__.py
+++ b/python/samba/samba3/__init__.py
@@ -19,16 +19,15 @@
__docformat__ = "restructuredText"
-REGISTRY_VALUE_PREFIX = "SAMBA_REGVAL"
+REGISTRY_VALUE_PREFIX = b"SAMBA_REGVAL"
REGISTRY_DB_VERSION = 1
import os
import struct
import tdb
-import passdb
-import param as s3param
-
+import samba.samba3.passdb
+from samba.samba3 import param as s3param
def fetch_uint32(db, key):
try:
@@ -80,7 +79,7 @@ class Registry(DbDatabase):
def keys(self):
"""Return list with all the keys."""
- return [k.rstrip("\x00") for k in self.db.iterkeys() if not k.startswith(REGISTRY_VALUE_PREFIX)]
+ return [k.rstrip(b"\x00") for k in self.db if not k.startswith(REGISTRY_VALUE_PREFIX)]
def subkeys(self, key):
"""Retrieve the subkeys for the specified key.
@@ -88,12 +87,12 @@ class Registry(DbDatabase):
:param key: Key path.
:return: list with key names
"""
- data = self.db.get("%s\x00" % key)
+ data = self.db.get(key + b"\x00")
if data is None:
return []
(num, ) = struct.unpack("<L", data[0:4])
- keys = data[4:].split("\0")
- assert keys[-1] == ""
+ keys = data[4:].split(b"\0")
+ assert keys[-1] == b""
keys.pop()
assert len(keys) == num
return keys
@@ -104,7 +103,7 @@ class Registry(DbDatabase):
:param key: Key to retrieve values for.
:return: Dictionary with value names as key, tuple with type and
data as value."""
- data = self.db.get("%s/%s\x00" % (REGISTRY_VALUE_PREFIX, key))
+ data = self.db.get(REGISTRY_VALUE_PREFIX + b'/' + key + b'\x00')
if data is None:
return {}
ret = {}
@@ -112,7 +111,7 @@ class Registry(DbDatabase):
data = data[4:]
for i in range(num):
# Value name
- (name, data) = data.split("\0", 1)
+ (name, data) = data.split(b"\0", 1)
(type, ) = struct.unpack("<L", data[0:4])
data = data[4:]
@@ -126,11 +125,11 @@ class Registry(DbDatabase):
# High water mark keys
-IDMAP_HWM_GROUP = "GROUP HWM\0"
-IDMAP_HWM_USER = "USER HWM\0"
+IDMAP_HWM_GROUP = b"GROUP HWM\0"
+IDMAP_HWM_USER = b"USER HWM\0"
-IDMAP_GROUP_PREFIX = "GID "
-IDMAP_USER_PREFIX = "UID "
+IDMAP_GROUP_PREFIX = b"GID "
+IDMAP_USER_PREFIX = b"UID "
# idmap version determines auto-conversion
IDMAP_VERSION_V2 = 2
@@ -139,27 +138,27 @@ class IdmapDatabase(DbDatabase):
"""Samba 3 ID map database reader."""
def _check_version(self):
- assert fetch_int32(self.db, "IDMAP_VERSION\0") == IDMAP_VERSION_V2
+ assert fetch_int32(self.db, b"IDMAP_VERSION\0") == IDMAP_VERSION_V2
def ids(self):
"""Retrieve a list of all ids in this database."""
for k in self.db.iterkeys():
if k.startswith(IDMAP_USER_PREFIX):
- yield k.rstrip("\0").split(" ")
+ yield k.rstrip(b"\0").split(b" ")
if k.startswith(IDMAP_GROUP_PREFIX):
- yield k.rstrip("\0").split(" ")
+ yield k.rstrip(b"\0").split(b" ")
def uids(self):
"""Retrieve a list of all uids in this database."""
- for k in self.db.iterkeys():
+ for k in self.db:
if k.startswith(IDMAP_USER_PREFIX):
- yield int(k[len(IDMAP_USER_PREFIX):].rstrip("\0"))
+ yield int(k[len(IDMAP_USER_PREFIX):].rstrip(b"\0"))
def gids(self):
"""Retrieve a list of all gids in this database."""
- for k in self.db.iterkeys():
+ for k in self.db:
if k.startswith(IDMAP_GROUP_PREFIX):
- yield int(k[len(IDMAP_GROUP_PREFIX):].rstrip("\0"))
+ yield int(k[len(IDMAP_GROUP_PREFIX):].rstrip(b"\0"))
def get_sid(self, xid, id_type):
"""Retrive SID associated with a particular id and type.
@@ -178,16 +177,16 @@ class IdmapDatabase(DbDatabase):
:param uid: UID to retrieve SID for.
:return: A SID or None if no mapping was found.
"""
- data = self.db.get("%s%d\0" % (IDMAP_USER_PREFIX, uid))
+ data = self.db.get(IDMAP_USER_PREFIX + str(uid).encode() + b'\0')
if data is None:
return data
- return data.rstrip("\0")
+ return data.rstrip(b"\0")
def get_group_sid(self, gid):
- data = self.db.get("%s%d\0" % (IDMAP_GROUP_PREFIX, gid))
+ data = self.db.get(IDMAP_GROUP_PREFIX + str(gid).encode() + b'\0')
if data is None:
return data
- return data.rstrip("\0")
+ return data.rstrip(b"\0")
def get_user_hwm(self):
"""Obtain the user high-water mark."""
diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py
index 935a087..bc8c185 100644
--- a/python/samba/tests/__init__.py
+++ b/python/samba/tests/__init__.py
@@ -19,6 +19,7 @@
"""Samba Python tests."""
import os
+import tempfile
import ldb
import samba
from samba import param
@@ -254,7 +255,8 @@ class LdbTestCase(TestCase):
def setUp(self):
super(LdbTestCase, self).setUp()
- self.filename = os.tempnam()
+ self.tempfile = tempfile.NamedTemporaryFile(delete=False)
+ self.filename = self.tempfile.name
self.ldb = samba.Ldb(self.filename)
def set_modules(self, modules=[]):
diff --git a/python/samba/tests/blackbox/check_output.py b/python/samba/tests/blackbox/check_output.py
index d7e41a8..8b3643d 100644
--- a/python/samba/tests/blackbox/check_output.py
+++ b/python/samba/tests/blackbox/check_output.py
@@ -100,6 +100,8 @@ class CheckOutputTests(BlackboxTestCase):
try:
with TimeoutHelper(10):
actual = self.check_output(cmdline)
- self.assertEqual(actual, expected)
+ # check_output will return bytes
+ # convert expected to bytes for python 3
+ self.assertEqual(actual, expected.encode('utf-8'))
except TimeoutHelper.Timeout:
self.fail(msg='Timeout!')
diff --git a/python/samba/tests/kcc/graph.py b/python/samba/tests/kcc/graph.py
index dec861a..31db853 100644
--- a/python/samba/tests/kcc/graph.py
+++ b/python/samba/tests/kcc/graph.py
@@ -53,8 +53,8 @@ class GraphFunctionTests(samba.tests.TestCase):
([0xff] * 84, 84 * 8),
([0xaa] * 84, 84 * 4),
([0x03, 0x33] * 42, 42 * 6),
- (range(7) * 12, 12 * 9),
- (range(4) * 21, 21 * 4)):
+ (list(range(7)) * 12, 12 * 9),
+ (list(range(4)) * 21, 21 * 4)):
self.assertEquals(total_schedule(schedule), total)
def test_convert_schedule_to_repltimes(self):
@@ -63,7 +63,7 @@ class GraphFunctionTests(samba.tests.TestCase):
(None, [0x11] * 84),
([0x06] * 168, [0x66] * 84),
([0x03, 0xa] * 84, [0x3a] * 84),
- (range(7) * 24,
+ (list(range(7)) * 24,
[0x01, 0x23, 0x45, 0x60, 0x12, 0x34, 0x56] * 12)):
schedule = ntdsconn_schedule(ntdsconn_times)
self.assertEquals(convert_schedule_to_repltimes(schedule),
diff --git a/python/samba/tests/kcc/graph_utils.py b/python/samba/tests/kcc/graph_utils.py
index 2146fc9..b027838 100644
--- a/python/samba/tests/kcc/graph_utils.py
+++ b/python/samba/tests/kcc/graph_utils.py
@@ -54,7 +54,7 @@ class UndirectedGraphTests(samba.tests.TestCase):
vertices2 = tuple('ijk')
edges = tuple(itertools.combinations(vertices, 2))
edges2 = tuple(itertools.combinations(vertices2, 2))
- line_edges = zip(vertices[1:], vertices[:-1])
+ line_edges = list(zip(vertices[1:], vertices[:-1]))
ring_edges = line_edges + [(vertices[0], vertices[-1])]
tree = make_tree(vertices)
diff --git a/python/samba/tests/posixacl.py b/python/samba/tests/posixacl.py
index ef4ed77..74cabf1 100644
--- a/python/samba/tests/posixacl.py
+++ b/python/samba/tests/posixacl.py
@@ -82,7 +82,7 @@ class PosixAclMappingTests(TestCaseInTempDir):
# This should invalidate the ACL, as we include the posix ACL in the hash
(backend_obj, dbname) = checkset_backend(self.lp, None, None)
backend_obj.wrap_setxattr(dbname,
- self.tempf, "system.fake_access_acl", "")
+ self.tempf, "system.fake_access_acl", b"")
#however, as this is direct DB access, we do not notice it
facl = getntacl(self.lp, self.tempf, direct_db_access=True)
@@ -96,7 +96,7 @@ class PosixAclMappingTests(TestCaseInTempDir):
# This should invalidate the ACL, as we include the posix ACL in the hash
(backend_obj, dbname) = checkset_backend(self.lp, None, None)
backend_obj.wrap_setxattr(dbname,
- self.tempf, "system.fake_access_acl", "")
+ self.tempf, "system.fake_access_acl", b"")
#the hash would break, and we return an ACL based only on the mode, except we set the ACL using the 'ntvfs' mode that doesn't include a hash
facl = getntacl(self.lp, self.tempf)
@@ -112,7 +112,7 @@ class PosixAclMappingTests(TestCaseInTempDir):
# This should invalidate the ACL, as we include the posix ACL in the hash
(backend_obj, dbname) = checkset_backend(self.lp, None, None)
backend_obj.wrap_setxattr(dbname,
- self.tempf, "system.fake_access_acl", "")
+ self.tempf, "system.fake_access_acl", b"")
#the hash will break, and we return an ACL based only on the mode
facl = getntacl(self.lp, self.tempf, direct_db_access=False)
diff --git a/python/samba/tests/provision.py b/python/samba/tests/provision.py
index bada14f..eb6deb5 100644
--- a/python/samba/tests/provision.py
+++ b/python/samba/tests/provision.py
@@ -66,7 +66,7 @@ class ProvisionTestCase(samba.tests.TestCaseInTempDir):
ldb = setup_secretsdb(paths, None, None, lp=env_loadparm())
try:
self.assertEquals("LSA Secrets",
- ldb.searchone(basedn="CN=LSA Secrets", attribute="CN"))
+ ldb.searchone(basedn="CN=LSA Secrets", attribute="CN").decode('utf8'))
finally:
del ldb
os.unlink(path)
diff --git a/python/samba/tests/s3idmapdb.py b/python/samba/tests/s3idmapdb.py
new file mode 100644
index 0000000..1f510f1
--- /dev/null
+++ b/python/samba/tests/s3idmapdb.py
@@ -0,0 +1,57 @@
+# Unix SMB/CIFS implementation.
+# Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2007
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+"""Tests for samba.samba3."""
+
+from samba.samba3 import IdmapDatabase
+from samba.tests import TestCase, TestCaseInTempDir
+from samba.dcerpc.security import dom_sid
+import os
+
+for p in [ "../../../../../testdata/samba3", "../../../../testdata/samba3" ]:
+ DATADIR = os.path.join(os.path.dirname(__file__), p)
+ if os.path.exists(DATADIR):
+ break
+
+class IdmapDbTestCase(TestCase):
+
+ def setUp(self):
+ super(IdmapDbTestCase, self).setUp()
+ self.idmapdb = IdmapDatabase(os.path.join(DATADIR,
+ "winbindd_idmap"))
+
+ def test_user_hwm(self):
+ self.assertEquals(10000, self.idmapdb.get_user_hwm())
+
+ def test_group_hwm(self):
+ self.assertEquals(10002, self.idmapdb.get_group_hwm())
+
+ def test_uids(self):
+ self.assertEquals(1, len(list(self.idmapdb.uids())))
+
+ def test_gids(self):
+ self.assertEquals(3, len(list(self.idmapdb.gids())))
+
+ def test_get_user_sid(self):
+ self.assertEquals(b"S-1-5-21-58189338-3053988021-627566699-501", self.idmapdb.get_user_sid(65534))
+
+ def test_get_group_sid(self):
+ self.assertEquals(b"S-1-5-21-2447931902-1787058256-3961074038-3007", self.idmapdb.get_group_sid(10001))
+
+ def tearDown(self):
+ self.idmapdb.close()
+ super(IdmapDbTestCase, self).tearDown()
diff --git a/python/samba/tests/s3param.py b/python/samba/tests/s3param.py
new file mode 100644
index 0000000..5d06191
--- /dev/null
+++ b/python/samba/tests/s3param.py
@@ -0,0 +1,50 @@
+# Unix SMB/CIFS implementation.
+# Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2007
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+"""Tests for samba.samba3.param"""
+
+from samba.samba3 import param as s3param
+from samba.tests import TestCase, TestCaseInTempDir
+import os
+
+
+for p in [ "../../../../../testdata/samba3", "../../../../testdata/samba3" ]:
+ DATADIR = os.path.join(os.path.dirname(__file__), p)
+ if os.path.exists(DATADIR):
+ break
+
+
+class ParamTestCase(TestCaseInTempDir):
+
+ def setUp(self):
+ super(ParamTestCase, self).setUp()
+ os.system("cp -r %s %s" % (DATADIR, self.tempdir))
+ datadir = os.path.join(self.tempdir, "samba3")
+
+ self.lp = s3param.get_context()
+ self.lp.load(os.path.join(datadir, "smb.conf"))
+
+ def tearDown(self):
+ self.lp = []
+ os.system("rm -rf %s" % os.path.join(self.tempdir, "samba3"))
+ super(ParamTestCase, self).tearDown()
--
Samba Shared Repository
More information about the samba-cvs
mailing list