1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
samba-mirror/python
Tim Beale 256684c7a8 join: Use a specific attribute order for the DsAddEntry nTDSDSA object
Joining a Windows domain can throw an error if the HasMasterNCs
attribute occurs before msDS-HasMasterNCs. This patch changes the
attribute order so that msDS-HasMasterNCs is always first.

Previously on python2, the dictionary hash order was arbitrary but
constant. By luck, msDS-HasMasterNCs was always before HasMasterNCs, so
we never noticed any problem. With python3, the dictionary hash order
now changes everytime you run the command, so the order is
unpredictable.

To enforce a order, we can change to use an OrderedDict, which will
return the keys in the order they're added.

I've asked Microsoft to clarify the protocol requirement here WRT
attribute order. However, in the meantime we may as well fix the problem
for users.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14046
RN: When trying to join a Windows domain (with functional level 2008R2)
as an AD domain controller, the 'samba-tool domain join' command could
throw a python exception: 'RuntimeError ("DsAddEntry failed")'. When
this problem occurred, you would also see the message "DsAddEntry failed
with status WERR_ACCESS_DENIED info (8363, 'WERR_DS_NO_CROSSREF_FOR_NC')"
in the command output. This issue has now been resolved. Note that this
problem would only occur on Samba v4.10 when using the Python3 packages.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jul 24 04:18:21 UTC 2019 on sn-devel-184
2019-07-24 04:18:21 +00:00
..
examples PY3: change shebang to python3 in misc dirs 2018-12-14 18:00:40 +01:00
samba join: Use a specific attribute order for the DsAddEntry nTDSDSA object 2019-07-24 04:18:21 +00:00
samba_external
modules.c py3: Remove PyStr_FromString() compatability macro 2019-06-24 17:24:27 +00:00
modules.h python: Create macro to hide ugly function signature cast 2019-05-16 17:55:16 +00:00
py3compat.h py3: Remove PyStr_AsUTF8AndSize() compatability macro 2019-06-24 17:24:27 +00:00
pyglue.c py3: Remove PyStr_FromString() compatability macro 2019-06-24 17:24:27 +00:00
wscript build: Remove bld.gen_python_environments() 2019-03-21 04:06:14 +00:00