s4-join: show a reasonable error on DsAddEntry() failing
authorAndrew Tridgell <tridge@samba.org>
Wed, 17 Nov 2010 00:09:59 +0000 (11:09 +1100)
committerAndrew Tridgell <tridge@samba.org>
Wed, 17 Nov 2010 00:30:07 +0000 (11:30 +1100)
DsAddEntry() gives errors in a reply container

source4/scripting/python/samba/join.py

index 23ec845ea686fae571a66c1ea3aad64931268374..091b58c4301b2e4c795fd3a77f97046728245b7d 100644 (file)
@@ -294,7 +294,12 @@ class dc_join:
         req2.first_object = first_object
 
         (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")
 
     def join_add_objects(ctx):
         '''add the various objects needed for the join'''