The branch, master has been updated via ce63db2 traffic_relay: bulk port print to modern py3 style via c034caa s4/webserver: initialise optional parameter via 30fb803 s4/lib/py-registry: initialize optional parameters for open_* functions via 2a30501 s3/py_passdb: initialize optional parameters earlier via 399c22a nbt/pynbt: initialize optional parameter in nbt_name_refresh via e62d2bd nbt/pynbt: initialize optional parameter in nbt_name_register via 0d56edb ldb/pyldb: initialize optional parameter in ldb_connect() via 6eb3391 kcc/graph: add __hash__ to InternalEdge for py3 via c7f3c91 kcc: fix sort for py3 via 9491094 kcc/kcc_utils: fix divide for py3 via 09081ea kcc/kcc_utils: convert dict.keys to list via 767f6e5 kcc/graph_utils: port string.translate for py3 via 16a228c selftest/graph: enable py3 for samba.tests.graph via d1312c8 python/tests/graph: actually test graphs, don't print via 6d696d6 graph: fix sort for py3 via fadd2ce graph: fix divide for py3 via 470499f selftest: enable py3 for samba.tests.krb5_credentials via a9f5913 selftest: enable py3 for samba.tests.docs via c070680 selftest: enable py3 for samba.tests.source via eec07f2 selftest: enable py3 for samba.tests.lsa_string via fb97281 selftest: enable py3 for samba.tests.dcerpc.registry via 9b8b40f selftest: enable py3 for samba.tests.dcerpc.rpcecho via e209cc2 selftest: enable py3 for samba.tests.dcerpc.bare via 01ace23 selftest: enable py3 for samba.tests.dcerpc.sam via aeb6e07 python: fix unicode escape in doc string via 5258add python: bulk convert zip to list via 8432ca2 python: bulk replace file to open for py3 via 9d79329 python: bulk replace dict.itervalues to values for py3 via 2892293 python: bulk port tdb iterkeys for py3 via f3b5287 python: bulk replace dict.iteritems to items for py3 via 6716971c python/wscript: build grouping library for py2/py3 (--extra-python) via 6210510 s3/lib/policy/wscript_build: build samba_policy lib for extra-python/py3 via 84f7ead s3/libnet/wscript: build samba-net lib for extra-python/py3 via f24f0e1 s3/param/wscript: build PROVISION subsytem for extra-python/py3 via 4a58393 wscript_build: make sure we link extra-python versions of libraries via e48e6b0 python: create test for pysmb module. via 5c7e7ca s4/libcli: python3 port for smb module from 23d8410 dbwrap: Fix "use mmap = no"
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit ce63db26a1d9fd2272e7d708965557d0461a4eac Author: Joe Guo <j...@catalyst.net.nz> Date: Fri Apr 13 15:00:01 2018 +1200 traffic_relay: bulk port print to modern py3 style Change print to function and avoid the ugly `print >>sys.stderr`. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Garming Sam <garm...@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagn...@samba.org> Autobuild-Date(master): Fri Apr 13 10:36:32 CEST 2018 on sn-devel-144 commit c034caaf956dd7bf151ca86fe028928befe88f7b Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Apr 12 17:19:20 2018 +1200 s4/webserver: initialise optional parameter OK, this is unused and unimplemented. Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 30fb803ec07eb865c4c31c54320cef08e1cafff0 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Apr 12 17:15:19 2018 +1200 s4/lib/py-registry: initialize optional parameters for open_* functions Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 2a305014b530145563a581e880a14af17fc3fc04 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Apr 12 17:13:05 2018 +1200 s3/py_passdb: initialize optional parameters earlier It is just a bit easier to see what is happening. Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 399c22a86f0b8614137f783d957547ade219e431 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Apr 12 17:10:10 2018 +1200 nbt/pynbt: initialize optional parameter in nbt_name_refresh Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit e62d2bd498cae5465d8f192c5fc20daf772aa843 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Apr 12 17:09:45 2018 +1200 nbt/pynbt: initialize optional parameter in nbt_name_register Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 0d56edb9bbffe137f1e0ac90c0c90f1d3cba9909 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Apr 12 17:07:38 2018 +1200 ldb/pyldb: initialize optional parameter in ldb_connect() Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 6eb3391cc251cac484ce34397c18373331ffcb78 Author: Joe Guo <j...@catalyst.net.nz> Date: Tue Apr 10 15:06:51 2018 +1200 kcc/graph: add __hash__ to InternalEdge for py3 In py3, if a class defines `__eq__()` but not `__hash__()`, its instances will not be usable as items in hashable collections, e.g.: set. Add `__hash__()` to InternalEdge, so it can be added to a set in py3. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit c7f3c91b62c3f8f2bb44fc23bf65710e4b290105 Author: Joe Guo <j...@catalyst.net.nz> Date: Tue Apr 10 14:51:37 2018 +1200 kcc: fix sort for py3 py2: list.sort(cmp=None, key=None, reverse=False) sorted(iterable[, cmp[, key[, reverse]]]) py3: list.sort(key=None, reverse=False) sorted(iterable, *, key=None, reverse=False) The `cmp` arg was removed in py3, make use of `key` arg to work around. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 949109442f7d74b2bab820c6ef0a5a80685b5694 Author: Joe Guo <j...@catalyst.net.nz> Date: Tue Apr 10 12:58:52 2018 +1200 kcc/kcc_utils: fix divide for py3 `/` will return float other than int in py3. Use `//` to keep consistent with py2. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 09081eae3d821352786dfb38630ae10e6072040e Author: Joe Guo <j...@catalyst.net.nz> Date: Tue Apr 10 15:42:42 2018 +1200 kcc/kcc_utils: convert dict.keys to list In py3, `dict.keys()` will return a iterator not a list. Convert it to list to support both py2 and py3. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 767f6e599af81f7b2be42981d997c3c02f7ac70c Author: Joe Guo <j...@catalyst.net.nz> Date: Tue Apr 10 12:45:34 2018 +1200 kcc/graph_utils: port string.translate for py3 In py3, `str.translate` removed the second positional argument `deletechars`, which means you can not use it to delete chars from str. Use `replace` for this case. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 16a228ca3303e750d5035735fdc1472e18e9ee58 Author: Joe Guo <j...@catalyst.net.nz> Date: Tue Apr 10 15:52:47 2018 +1200 selftest/graph: enable py3 for samba.tests.graph Changes are made separatedly in previous commits. No change needed here. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit d1312c86d6ad5c813838eb653f71eedda8a97292 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Apr 12 15:57:09 2018 +1200 python/tests/graph: actually test graphs, don't print Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 6d696d61dd2b3eb144a2ccabb0f7e2cd974959b7 Author: Joe Guo <j...@catalyst.net.nz> Date: Tue Apr 10 15:51:34 2018 +1200 graph: fix sort for py3 `sorted` can not sort `None` with str in py3, use the `key` arg to fix. Sort None as ''. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit fadd2cec39ab38215c36e4d996ced38b95f66d37 Author: Joe Guo <j...@catalyst.net.nz> Date: Tue Apr 10 15:48:35 2018 +1200 graph: fix divide for py3 `/` will return float other than int in py3. Use `//` to keep consistent with py2. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 470499fda32f10769a03df5c9a68a64d4261b2e6 Author: Joe Guo <j...@catalyst.net.nz> Date: Wed Apr 11 17:44:26 2018 +1200 selftest: enable py3 for samba.tests.krb5_credentials Fix encoding issue. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit a9f591369ee9359961237a03eb19672a47cb4e11 Author: Joe Guo <j...@catalyst.net.nz> Date: Thu Apr 5 13:48:36 2018 +1200 selftest: enable py3 for samba.tests.docs Popen methods will return bytes. Decode output to string before using. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit c07068038857bb93e3cf7f9f058054a3c9bda253 Author: Joe Guo <j...@catalyst.net.nz> Date: Thu Apr 5 12:49:09 2018 +1200 selftest: enable py3 for samba.tests.source In py2, `open` has no `encoding` arg, python guesses file encoding from locale. This could be wrong. Use `io.open` to open a file, so we can specify encoding in both py2 and py3. Also, open file with `r` instead of `rb` for py3. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit eec07f2fe5eab8046eed78c7c4439732f9f2118b Author: Joe Guo <j...@catalyst.net.nz> Date: Wed Apr 11 17:17:48 2018 +1200 selftest: enable py3 for samba.tests.lsa_string No change needed. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit fb972815656618654b787d3414bc4ac4f41adb41 Author: Joe Guo <j...@catalyst.net.nz> Date: Wed Apr 11 16:42:54 2018 +1200 selftest: enable py3 for samba.tests.dcerpc.registry No changes needed. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 9b8b40fabf64ae92ebb0694529c13fc178edaf55 Author: Joe Guo <j...@catalyst.net.nz> Date: Wed Apr 11 16:38:03 2018 +1200 selftest: enable py3 for samba.tests.dcerpc.rpcecho Prefix `b` for bytes. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit e209cc2ee2f0dae5733e58b681eb27ab9bb3beae Author: Joe Guo <j...@catalyst.net.nz> Date: Wed Apr 11 11:39:56 2018 +1200 selftest: enable py3 for samba.tests.dcerpc.bare Prefix b to bytes. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 01ace23512adaf956e9db9dfaf559b14dc23c589 Author: Joe Guo <j...@catalyst.net.nz> Date: Tue Apr 10 16:27:47 2018 +1200 selftest: enable py3 for samba.tests.dcerpc.sam 1. Fix invalid declaration syntax for toArray 2. Simplify toArray implementation with list comprehension. 3. Remove ending L for long integer. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit aeb6e07df3c65356ca6560c48d3c45648c550774 Author: Joe Guo <j...@catalyst.net.nz> Date: Wed Apr 11 16:32:19 2018 +1200 python: fix unicode escape in doc string The doc string has `\u` mark inside, which will cause encoding error in py3. prefix `r` to doc string to fix. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 5258add3aaf9b9f077d4629355afc7b35cc58cd1 Author: Joe Guo <j...@catalyst.net.nz> Date: Tue Apr 10 15:49:40 2018 +1200 python: bulk convert zip to list In py3, zip will return a iterator other than a list. Convert it to a list to support both py2 and py3. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 8432ca2b48385e4372fed306329f03185b46a620 Author: Joe Guo <j...@catalyst.net.nz> Date: Wed Apr 11 16:03:34 2018 +1200 python: bulk replace file to open for py3 The builtin function `file` was removed in py3. Use `open` instead. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 9d79329d3d346780f4b3543a979c6af1e3bdc5f0 Author: Joe Guo <j...@catalyst.net.nz> Date: Wed Apr 11 10:44:24 2018 +1200 python: bulk replace dict.itervalues to values for py3 In py3, iterxxx methods are removed. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 2892293182f282336f08ed17315ae744aa72bddc Author: Joe Guo <j...@catalyst.net.nz> Date: Thu Apr 12 16:07:24 2018 +1200 python: bulk port tdb iterkeys for py3 In py3, `dict.iterkeys()` is removed, we need to use `keys()` instead. This is compatible with py2 since `dict.keys()` exists for py2. tdb pretents to be a dict, however, not completely. It provides `iterkeys()` for py2 only, and `keys()` for py3 only, which means replace `iterkeys()` to `keys()` will break py2. In python, iter a dict will implicitly iter on keys. Use this feature to work around. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit f3b52875388da6e064567621a53e9ccb508dc6d5 Author: Joe Guo <j...@catalyst.net.nz> Date: Wed Apr 11 10:32:06 2018 +1200 python: bulk replace dict.iteritems to items for py3 In py3, iterxxx methods are removed. Signed-off-by: Joe Guo <j...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 6716971ce1b023affc2503b72e83c22581faf64a Author: Noel Power <noel.po...@suse.com> Date: Fri Apr 6 16:35:49 2018 +0100 python/wscript: build grouping library for py2/py3 (--extra-python) Grouping library is not used for any delivered libraries, however it is used internally when building local libraries used when "make test TESTS='blah'" is invoked. Failure to provide the grouping library results in missing symbols (and cores) when running tests Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 62105101463b0e2247737483d0078fa768ccc1c5 Author: Noel Power <noel.po...@suse.com> Date: Thu Apr 5 17:05:10 2018 +0100 s3/lib/policy/wscript_build: build samba_policy lib for extra-python/py3 pypolicy module needs appropriate samba_policy library for extra-python/py3 therefore we need to build it for it to be available Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 84f7ead29ab6cd71a24022994c8af5812738b913 Author: Noel Power <noel.po...@suse.com> Date: Thu Apr 5 16:58:33 2018 +0100 s3/libnet/wscript: build samba-net lib for extra-python/py3 python_net needs to link appropriate samba-net library for extra-py/py3 version so we need to build it for extra-python/py3 Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit f24f0e1faff6531b6229238c94e2ad8463abcdab Author: Noel Power <noel.po...@suse.com> Date: Thu Apr 5 16:34:12 2018 +0100 s3/param/wscript: build PROVISION subsytem for extra-python/py3 Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 4a58393b2b4ebb8f7744ed367f14953f40d2e948 Author: Noel Power <noel.po...@suse.com> Date: Wed Apr 4 09:53:14 2018 +0100 wscript_build: make sure we link extra-python versions of libraries Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit e48e6b08a5ba357726db7b4ec3dd5ba9b143471d Author: David Mulder <dmul...@suse.com> Date: Fri Feb 9 08:42:18 2018 -0700 python: create test for pysmb module. Signed-off-by: David Mulder <dmul...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 5c7e7cad4bf82ad08c5f11616d15f80842a930e1 Author: Noel Power <noel.po...@suse.com> Date: Thu Dec 14 11:32:23 2017 +0000 s4/libcli: python3 port for smb module Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> ----------------------------------------------------------------------- Summary of changes: auth/credentials/wscript_build | 5 +- buildtools/wafsamba/samba_version.py | 2 +- lib/ldb-samba/wscript_build | 5 +- lib/ldb/pyldb.c | 2 +- lib/talloc/wscript | 2 +- lib/tdb/python/tdbdump.py | 2 +- libcli/nbt/pynbt.c | 2 + libgpo/wscript_build | 5 +- python/samba/emulate/traffic.py | 22 +- python/samba/graph.py | 12 +- python/samba/kcc/__init__.py | 14 +- python/samba/kcc/graph.py | 5 + python/samba/kcc/graph_utils.py | 4 +- python/samba/kcc/kcc_utils.py | 11 +- python/samba/netcmd/__init__.py | 2 +- python/samba/netcmd/common.py | 2 +- python/samba/netcmd/gpo.py | 6 +- python/samba/netcmd/main.py | 4 +- python/samba/netcmd/visualize.py | 26 +- python/samba/provision/__init__.py | 4 +- python/samba/provision/sambadns.py | 2 +- python/samba/samba3/__init__.py | 8 +- python/samba/subunit/run.py | 2 +- python/samba/tests/dcerpc/bare.py | 8 +- python/samba/tests/dcerpc/rpcecho.py | 6 +- python/samba/tests/dcerpc/sam.py | 10 +- python/samba/tests/docs.py | 23 +- python/samba/tests/graph.py | 414 ++++++++++++++++++++++++- python/samba/tests/krb5_credentials.py | 7 +- python/samba/tests/netcmd.py | 5 +- python/samba/tests/smb.py | 89 ++++++ python/samba/tests/source.py | 3 +- python/wscript | 22 +- script/traffic_replay | 105 ++++--- selftest/subunithelper.py | 2 +- selftest/tests.py | 6 +- source3/passdb/py_passdb.c | 6 +- source3/wscript_build | 5 +- source4/auth/wscript_build | 5 +- source4/dsdb/tests/python/linked_attributes.py | 4 +- source4/lib/messaging/wscript_build | 2 +- source4/lib/policy/wscript_build | 15 +- source4/lib/registry/pyregistry.c | 8 +- source4/libcli/pysmb.c | 45 ++- source4/libcli/wscript_build | 16 +- source4/libnet/wscript_build | 27 +- source4/librpc/wscript_build | 49 +-- source4/param/wscript_build | 21 +- source4/scripting/bin/w32err_code.py | 4 +- source4/selftest/tests.py | 21 +- source4/web_server/wsgi.c | 2 +- 51 files changed, 802 insertions(+), 277 deletions(-) create mode 100644 python/samba/tests/smb.py Changeset truncated at 500 lines: diff --git a/auth/credentials/wscript_build b/auth/credentials/wscript_build index 30c0f72..73e8e67 100644 --- a/auth/credentials/wscript_build +++ b/auth/credentials/wscript_build @@ -25,8 +25,11 @@ bld.SAMBA_SUBSYSTEM('CREDENTIALS_NTLM', deps='samba-credentials') for env in bld.gen_python_environments(): + pytalloc_util = bld.pyembed_libname('pytalloc-util') + pyparam_util = bld.pyembed_libname('pyparam_util') + bld.SAMBA_PYTHON('pycredentials', source='pycredentials.c', - public_deps='samba-credentials cmdline-credentials pytalloc-util pyparam_util CREDENTIALS_KRB5 CREDENTIALS_SECRETS', + public_deps='samba-credentials cmdline-credentials %s %s CREDENTIALS_KRB5 CREDENTIALS_SECRETS' % (pytalloc_util, pyparam_util), realname='samba/credentials.so' ) diff --git a/buildtools/wafsamba/samba_version.py b/buildtools/wafsamba/samba_version.py index 950a855..be26439 100644 --- a/buildtools/wafsamba/samba_version.py +++ b/buildtools/wafsamba/samba_version.py @@ -95,7 +95,7 @@ also accepted as dictionary entries here self.VENDOR_SUFFIX=None self.VENDOR_PATCH=None - for a, b in version_dict.iteritems(): + for a, b in version_dict.items(): if a.startswith("SAMBA_VERSION_"): setattr(self, a[14:], b) else: diff --git a/lib/ldb-samba/wscript_build b/lib/ldb-samba/wscript_build index c538b5a..c846426 100644 --- a/lib/ldb-samba/wscript_build +++ b/lib/ldb-samba/wscript_build @@ -21,8 +21,11 @@ bld.SAMBA_SUBSYSTEM('ldbwrap', for env in bld.gen_python_environments(): pyparam_util = bld.pyembed_libname('pyparam_util') pyldb_util = bld.pyembed_libname('pyldb-util') + pyauth = 'pyauth' + if bld.env['IS_EXTRA_PYTHON']: + pyauth = 'extra-' + pyauth bld.SAMBA_PYTHON('python_samba__ldb', 'pyldb.c', - deps='ldbsamba %s ldbwrap %s pyauth' % (pyparam_util, pyldb_util), + deps='ldbsamba %s ldbwrap %s %s' % (pyparam_util, pyldb_util, pyauth), realname='samba/_ldb.so') bld.SAMBA_MODULE('ldbsamba_extensions', diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 4b02edb..67ecafb 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -1154,7 +1154,7 @@ static PyObject *py_ldb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs static PyObject *py_ldb_connect(PyLdbObject *self, PyObject *args, PyObject *kwargs) { - char *url; + char *url = NULL; unsigned int flags = 0; PyObject *py_options = Py_None; int ret; diff --git a/lib/talloc/wscript b/lib/talloc/wscript index 0834341..1b31672 100644 --- a/lib/talloc/wscript +++ b/lib/talloc/wscript @@ -165,7 +165,7 @@ def build(bld): bld.SAMBA_PYTHON('test_pytalloc', 'test_pytalloc.c', - deps='pytalloc', + deps=name, enabled=bld.PYTHON_BUILD_IS_ENABLED(), realname='_test_pytalloc.so', install=False) diff --git a/lib/tdb/python/tdbdump.py b/lib/tdb/python/tdbdump.py index a16d26e..08769ea 100644 --- a/lib/tdb/python/tdbdump.py +++ b/lib/tdb/python/tdbdump.py @@ -9,5 +9,5 @@ if len(sys.argv) < 2: sys.exit(1) db = tdb.Tdb(sys.argv[1]) -for (k, v) in db.iteritems(): +for (k, v) in db.items(): print("{\nkey(%d) = %r\ndata(%d) = %r\n}" % (len(k), k, len(v), v)) diff --git a/libcli/nbt/pynbt.c b/libcli/nbt/pynbt.c index 6337092..254c98a 100644 --- a/libcli/nbt/pynbt.c +++ b/libcli/nbt/pynbt.c @@ -265,6 +265,7 @@ static PyObject *py_nbt_name_register(PyObject *self, PyObject *args, PyObject * io.in.broadcast = true; io.in.multi_homed = true; io.in.register_demand = true; + io.in.ttl = 0; io.in.timeout = 0; io.in.retries = 0; @@ -320,6 +321,7 @@ static PyObject *py_nbt_name_refresh(PyObject *self, PyObject *args, PyObject *k io.in.broadcast = true; io.in.nb_flags = 0; + io.in.ttl = 0; io.in.timeout = 0; io.in.retries = 0; diff --git a/libgpo/wscript_build b/libgpo/wscript_build index f456d41..9fbff9d 100644 --- a/libgpo/wscript_build +++ b/libgpo/wscript_build @@ -8,7 +8,8 @@ bld.SAMBA3_LIBRARY('gpext', private_library=True) for env in bld.gen_python_environments(): + pyparam_util = bld.pyembed_libname('pyparam_util') + pyrpc_util = bld.pyembed_libname('pyrpc_util') bld.SAMBA3_PYTHON('python_samba_libgpo', 'pygpo.c', - deps='''pyparam_util gpext talloc ads TOKEN_UTIL - auth pyrpc_util''', + deps='%s gpext talloc ads TOKEN_UTIL auth %s' % (pyparam_util, pyrpc_util), realname='samba/gpo.so') diff --git a/python/samba/emulate/traffic.py b/python/samba/emulate/traffic.py index 240d0eb..9d95e3a 100644 --- a/python/samba/emulate/traffic.py +++ b/python/samba/emulate/traffic.py @@ -1065,7 +1065,7 @@ def guess_server_address(conversations): def stringify_keys(x): y = {} - for k, v in x.iteritems(): + for k, v in x.items(): k2 = '\t'.join(k) y[k2] = v return y @@ -1073,7 +1073,7 @@ def stringify_keys(x): def unstringify_keys(x): y = {} - for k, v in x.iteritems(): + for k, v in x.items(): t = tuple(str(k).split('\t')) y[t] = v return y @@ -1133,12 +1133,12 @@ class TrafficModel(object): def save(self, f): ngrams = {} - for k, v in self.ngrams.iteritems(): + for k, v in self.ngrams.items(): k = '\t'.join(k) ngrams[k] = dict(Counter(v)) query_details = {} - for k, v in self.query_details.iteritems(): + for k, v in self.query_details.items(): query_details[k] = dict(Counter('\t'.join(x) if x else '-' for x in v)) @@ -1161,15 +1161,15 @@ class TrafficModel(object): d = json.load(f) - for k, v in d['ngrams'].iteritems(): + for k, v in d['ngrams'].items(): k = tuple(str(k).split('\t')) values = self.ngrams.setdefault(k, []) - for p, count in v.iteritems(): + for p, count in v.items(): values.extend([str(p)] * count) - for k, v in d['query_details'].iteritems(): + for k, v in d['query_details'].items(): values = self.query_details.setdefault(str(k), []) - for p, count in v.iteritems(): + for p, count in v.items(): if p == '-': values.extend([()] * count) else: @@ -1398,9 +1398,9 @@ def replay(conversations, print(("we have %d accounts but %d conversations" % (accounts, conversations)), file=sys.stderr) - cstack = zip(sorted(conversations, - key=lambda x: x.start_time, reverse=True), - accounts) + cstack = list(zip( + sorted(conversations, key=lambda x: x.start_time, reverse=True), + accounts)) # Set the process group so that the calling scripts are not killed # when the forked child processes are killed. diff --git a/python/samba/graph.py b/python/samba/graph.py index f626287..6cdd2ef 100644 --- a/python/samba/graph.py +++ b/python/samba/graph.py @@ -129,7 +129,7 @@ def shorten_vertex_names(edges, vertices, suffix=',...', aggressive=False): break else: map = dict((k, v.replace(',CN=Servers,', ',**,')) - for k, v in map.iteritems()) + for k, v in map.items()) replacements.append(('**', 'CN=Servers')) for v in vertices2: @@ -137,7 +137,7 @@ def shorten_vertex_names(edges, vertices, suffix=',...', aggressive=False): break else: map = dict((k, v.replace('CN=NTDS Settings,', '*,')) - for k, v in map.iteritems()) + for k, v in map.items()) replacements.append(('*', 'CN=NTDS Settings')) edges2 = [(map.get(a, a), map.get(b, b)) for a, b in edges2] @@ -463,11 +463,11 @@ def find_transitive_distance(vertices, edges): for i in range(inf): changed = False new_distances = {} - for v, d in distances.iteritems(): + for v, d in distances.items(): new_d = d.copy() new_distances[v] = new_d - for dest, cost in d.iteritems(): - for leaf, cost2 in distances[dest].iteritems(): + for dest, cost in d.items(): + for leaf, cost2 in distances[dest].items(): new_cost = cost + cost2 old_cost = d.get(leaf, inf) if new_cost < old_cost: @@ -497,7 +497,7 @@ def get_transitive_colourer(colours, n_vertices): n = 1 + int(n_vertices ** 0.5) def f(link): - return scale[min(link * m / n, m - 1)] + return scale[min(link * m // n, m - 1)] else: def f(link): diff --git a/python/samba/kcc/__init__.py b/python/samba/kcc/__init__.py index f004663..1a962bb 100644 --- a/python/samba/kcc/__init__.py +++ b/python/samba/kcc/__init__.py @@ -46,18 +46,6 @@ from samba.kcc.debug import DEBUG, DEBUG_FN, logger from samba.kcc import debug -def sort_replica_by_dsa_guid(rep1, rep2): - """Helper to sort NCReplicas by their DSA guids - - The guids need to be sorted in their NDR form. - - :param rep1: An NC replica - :param rep2: Another replica - :return: -1, 0, or 1, indicating sort order. - """ - return cmp(ndr_pack(rep1.rep_dsa_guid), ndr_pack(rep2.rep_dsa_guid)) - - def sort_dsa_by_gc_and_guid(dsa1, dsa2): """Helper to sort DSAs by guid global catalog status @@ -2194,7 +2182,7 @@ class KCC(object): # on the local DC r_list.append(l_of_x) - r_list.sort(sort_replica_by_dsa_guid) + r_list.sort(key=lambda rep: ndr_pack(rep.rep_dsa_guid)) r_len = len(r_list) max_node_edges = self.intrasite_max_node_edges(r_len) diff --git a/python/samba/kcc/graph.py b/python/samba/kcc/graph.py index a0bff69..fb3ca0c 100644 --- a/python/samba/kcc/graph.py +++ b/python/samba/kcc/graph.py @@ -805,6 +805,11 @@ class InternalEdge(object): self.e_type = eType self.site_link = site_link + def __hash__(self): + return hash(( + self.v1, self.v2, self.red_red, self.repl_info, self.e_type, + self.site_link)) + def __eq__(self, other): return not self < other and not other < self diff --git a/python/samba/kcc/graph_utils.py b/python/samba/kcc/graph_utils.py index c564bee..086b651 100644 --- a/python/samba/kcc/graph_utils.py +++ b/python/samba/kcc/graph_utils.py @@ -32,7 +32,7 @@ def write_dot_file(basename, edge_list, vertices=None, label=None, s = dot_graph(vertices, edge_list, title=label, **kwargs) if label: # sanitise DN and guid labels - basename += '_' + label.translate(None, ', ') + basename += '_' + label.replace(', ', '') filename = os.path.join(dot_file_dir, "%s.dot" % basename) if debug is not None: @@ -235,7 +235,7 @@ def verify_graph_directed_double_ring(edges, vertices, edge_vertices): raise GraphError("wanted double directed ring, found a leaf node" "(%s)" % vertex) - for vertex in edge_map.keys(): + for vertex in list(edge_map.keys()): nset = edge_map[vertex] if not nset: continue diff --git a/python/samba/kcc/kcc_utils.py b/python/samba/kcc/kcc_utils.py index a4870a3..2118570 100644 --- a/python/samba/kcc/kcc_utils.py +++ b/python/samba/kcc/kcc_utils.py @@ -1581,7 +1581,9 @@ class Site(object): # Which is a fancy way of saying "sort all the nTDSDSA objects # in the site by guid in ascending order". Place sorted list # in D_sort[] - D_sort = sorted(self.rw_dsa_table.values(), cmp=sort_dsa_by_guid) + D_sort = sorted( + self.rw_dsa_table.values(), + key=lambda dsa: ndr_pack(dsa.dsa_guid)) # double word number of 100 nanosecond intervals since 1600s @@ -1669,7 +1671,7 @@ class Site(object): # # Note: We don't want to divide by zero here so they must # have meant "f" instead of "o!interSiteTopologyFailover" - k_idx = (i_idx + ((self.nt_now - t_time) / f)) % len(D_sort) + k_idx = (i_idx + ((self.nt_now - t_time) // f)) % len(D_sort) # The local writable DC acts as an ISTG for its site if and # only if dk is the nTDSDSA object for the local DC. If the @@ -2221,11 +2223,6 @@ def get_dsa_config_rep(dsa): dsa.dsa_dnstr) -def sort_dsa_by_guid(dsa1, dsa2): - "use ndr_pack for GUID comparison, as appears correct in some places""" - return cmp(ndr_pack(dsa1.dsa_guid), ndr_pack(dsa2.dsa_guid)) - - def new_connection_schedule(): """Create a default schedule for an NTDSConnection or Sitelink. This is packed differently from the repltimes schedule used elsewhere diff --git a/python/samba/netcmd/__init__.py b/python/samba/netcmd/__init__.py index 9037d03..7797678 100644 --- a/python/samba/netcmd/__init__.py +++ b/python/samba/netcmd/__init__.py @@ -130,7 +130,7 @@ class Command(object): prog=prog,epilog=epilog) parser.add_options(self.takes_options) optiongroups = {} - for name, optiongroup in self.takes_optiongroups.iteritems(): + for name, optiongroup in self.takes_optiongroups.items(): optiongroups[name] = optiongroup(parser) parser.add_option_group(optiongroups[name]) return parser, optiongroups diff --git a/python/samba/netcmd/common.py b/python/samba/netcmd/common.py index 5c0bd95..2d0ff62 100644 --- a/python/samba/netcmd/common.py +++ b/python/samba/netcmd/common.py @@ -23,7 +23,7 @@ from samba.net import Net def _get_user_realm_domain(user): - """ get the realm or the domain and the base user + r""" get the realm or the domain and the base user from user like: * username * DOMAIN\username diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py index 5f4ad0e..cd946d9 100644 --- a/python/samba/netcmd/gpo.py +++ b/python/samba/netcmd/gpo.py @@ -252,7 +252,7 @@ def copy_directory_remote_to_local(conn, remotedir, localdir): os.mkdir(l_name) else: data = conn.loadfile(r_name) - file(l_name, 'w').write(data) + open(l_name, 'w').write(data) def copy_directory_local_to_remote(conn, localdir, remotedir): @@ -274,7 +274,7 @@ def copy_directory_local_to_remote(conn, localdir, remotedir): r_dirs.append(r_name) conn.mkdir(r_name) else: - data = file(l_name, 'r').read() + data = open(l_name, 'r').read() conn.savefile(r_name, data) @@ -943,7 +943,7 @@ class cmd_create(Command): os.mkdir(os.path.join(gpodir, "Machine")) os.mkdir(os.path.join(gpodir, "User")) gpt_contents = "[General]\r\nVersion=0\r\n" - file(os.path.join(gpodir, "GPT.INI"), "w").write(gpt_contents) + open(os.path.join(gpodir, "GPT.INI"), "w").write(gpt_contents) except Exception as e: raise CommandError("Error Creating GPO files", e) diff --git a/python/samba/netcmd/main.py b/python/samba/netcmd/main.py index 3b56f1a..40762fa 100644 --- a/python/samba/netcmd/main.py +++ b/python/samba/netcmd/main.py @@ -42,12 +42,10 @@ class cache_loader(dict): except KeyError: return default - def iteritems(self): + def items(self): for key in self: yield (key, self[key]) - def items(self): - return list(self.iteritems()) class cmd_sambatool(SuperCommand): """Main samba administration tool.""" diff --git a/python/samba/netcmd/visualize.py b/python/samba/netcmd/visualize.py index 3e5b950..b983e18 100644 --- a/python/samba/netcmd/visualize.py +++ b/python/samba/netcmd/visualize.py @@ -178,7 +178,7 @@ def get_partition_maps(samdb): } long_to_short = {} - for s, l in short_to_long.iteritems(): + for s, l in short_to_long.items(): long_to_short[l] = s return short_to_long, long_to_short @@ -266,18 +266,18 @@ class cmd_reps(GraphCommand): # get_reps_tables() returns two dictionaries mapping # dns to NCReplica objects c, n = remote_dsa.get_rep_tables() - for part, rep in c.iteritems(): + for part, rep in c.items(): if partition is None or part == partition: nc_reps[part]['current'].append((dsa_dn, rep)) - for part, rep in n.iteritems(): + for part, rep in n.items(): if partition is None or part == partition: nc_reps[part]['needed'].append((dsa_dn, rep)) all_edges = {'needed': {'to': [], 'from': []}, 'current': {'to': [], 'from': []}} - for partname, part in nc_reps.iteritems(): - for state, edgelists in all_edges.iteritems(): + for partname, part in nc_reps.items(): + for state, edgelists in all_edges.items(): for dsa_dn, rep in part[state]: short_name = long_partitions.get(partname, partname) for r in rep.rep_repsFrom: @@ -302,12 +302,12 @@ class cmd_reps(GraphCommand): 'from': "RepsFrom objects for %s", 'to': "RepsTo objects for %s", } - for state, edgelists in all_edges.iteritems(): - for direction, items in edgelists.iteritems(): + for state, edgelists in all_edges.items(): + for direction, items in edgelists.items(): part_edges = defaultdict(list) for src, dest, part in items: part_edges[part].append((src, dest)) - for part, edges in part_edges.iteritems(): + for part, edges in part_edges.items(): s = distance_matrix(None, edges, utf8=utf8, colour=color_scheme, @@ -324,8 +324,8 @@ class cmd_reps(GraphCommand): dot_vertices = set() used_colours = {} key_set = set() - for state, edgelist in all_edges.iteritems(): - for direction, items in edgelist.iteritems(): + for state, edgelist in all_edges.items(): + for direction, items in edgelist.items(): for src, dest, part in items: colour = used_colours.setdefault((part), colour_hash((part, @@ -472,7 +472,7 @@ class cmd_ntdsconn(GraphCommand): source_denies = [] dest_denies = [] both_deny = [] - for e, conn in edges.iteritems(): + for e, conn in edges.items(): if conn.dest_attests: graph_edges.append(e) if not conn.src_attests: @@ -517,7 +517,7 @@ class cmd_ntdsconn(GraphCommand): edge_styles = [] edge_labels = [] n_servers = len(dsas) - for k, e in sorted(edges.iteritems()): + for k, e in sorted(edges.items()): dot_edges.append(k) if e.observations == n_servers or not talk_to_remote: edge_colours.append('#000000') @@ -573,6 +573,6 @@ class cmd_visualize(SuperCommand): """Produces graphical representations of Samba network state""" subcommands = {} -- Samba Shared Repository