From f4a07f0b819b1fb669e436f91c34e61d0ec8ff92 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Wed, 9 Nov 2011 09:32:55 +0100 Subject: s4:join.py - fix up "DsAddEntry" against Windows Server 2000 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is important to consider the result level regarding error information. Windows 2000 seems to send us back v2, all other implementations v3. Consider post "Joining W2k AD domain" Reviewed-by: abartlet Autobuild-User: Matthias Dieter Wallnöfer Autobuild-Date: Wed Nov 9 23:37:08 CET 2011 on sn-devel-104 --- source4/scripting/python/samba/join.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'source4/scripting/python') diff --git a/source4/scripting/python/samba/join.py b/source4/scripting/python/samba/join.py index 7ce53442a4..96b07a6fbf 100644 --- a/source4/scripting/python/samba/join.py +++ b/source4/scripting/python/samba/join.py @@ -363,15 +363,24 @@ class dc_join(object): prev = o (level, ctr) = ctx.drsuapi.DsAddEntry(ctx.drsuapi_handle, 2, req2) - if ctr.err_ver != 1: - raise RuntimeError("expected err_ver 1, got %u" % ctr.err_ver) - if ctr.err_data.status != (0, 'WERR_OK'): - print("DsAddEntry failed with status %s info %s" % (ctr.err_data.status, - ctr.err_data.info.extended_err)) - raise RuntimeError("DsAddEntry failed") - if ctr.err_data.dir_err != drsuapi.DRSUAPI_DIRERR_OK: - print("DsAddEntry failed with dir_err %u" % ctr.err_data.dir_err) - raise RuntimeError("DsAddEntry failed") + if level == 2: + if ctr.dir_err != drsuapi.DRSUAPI_DIRERR_OK: + print("DsAddEntry failed with dir_err %u" % ctr.dir_err) + raise RuntimeError("DsAddEntry failed") + if ctr.extended_err != (0, 'WERR_OK'): + print("DsAddEntry failed with status %s info %s" % (ctr.extended_err)) + raise RuntimeError("DsAddEntry failed") + if level == 3: + if ctr.err_ver != 1: + raise RuntimeError("expected err_ver 1, got %u" % ctr.err_ver) + if ctr.err_data.status != (0, 'WERR_OK'): + print("DsAddEntry failed with status %s info %s" % (ctr.err_data.status, + ctr.err_data.info.extended_err)) + raise RuntimeError("DsAddEntry failed") + if ctr.err_data.dir_err != drsuapi.DRSUAPI_DIRERR_OK: + print("DsAddEntry failed with dir_err %u" % ctr.err_data.dir_err) + raise RuntimeError("DsAddEntry failed") + return ctr.objects def join_add_ntdsdsa(ctx): -- cgit