remove_dc: Fix removal of an old Windows DC
authorTim Beale <timbeale@catalyst.net.nz>
Thu, 14 Jun 2018 23:54:37 +0000 (11:54 +1200)
committerGary Lockyer <gary@samba.org>
Tue, 26 Jun 2018 21:32:51 +0000 (23:32 +0200)
Windows has 'CN=DNS Settings' child object underneath the Server object.
This was causing the removal of the server object in remove_dc() to
fail.

Noticed this problem while testing the backup/restore tool manually
against a Windows VM.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13484

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Tue Jun 26 23:32:51 CEST 2018 on sn-devel-144

python/samba/remove_dc.py

index b9726f5b84fca60371a48880de2c1ce6014448b8..d1904610e91bf1039fd717d5e81c5387becb4049 100644 (file)
@@ -240,8 +240,9 @@ def offline_remove_server(samdb, logger,
         dnsHostName = None
 
     if remove_server_obj:
-        # Remove the server DN
-        samdb.delete(server_dn)
+        # Remove the server DN (do a tree-delete as it could still have a
+        # 'DNS Settings' child object if it's a Windows DC)
+        samdb.delete(server_dn, ["tree_delete:0"])
 
     if computer_dn is not None:
         computer_msgs = samdb.search(base=computer_dn,