From 877e48cac8bd9c6bcf0ee983abcb187780ec294d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 5 Sep 2011 17:23:48 +1000 Subject: s4-subdomain: don't delete account DN not created in subdomain join Pair-Programmed-With: Andrew Bartlett --- source4/scripting/python/samba/join.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'source4') diff --git a/source4/scripting/python/samba/join.py b/source4/scripting/python/samba/join.py index ddc4380a65..e30d699d92 100644 --- a/source4/scripting/python/samba/join.py +++ b/source4/scripting/python/samba/join.py @@ -145,11 +145,14 @@ class dc_join(object): try: # find the krbtgt link print("checking samaccountname") - res = ctx.samdb.search(base=ctx.samdb.get_default_basedn(), - expression='samAccountName=%s' % ldb.binary_encode(ctx.samname), - attrs=["msDS-krbTgtLink"]) - if res: - ctx.del_noerror(res[0].dn, recursive=True) + if ctx.subdomain: + res = None + else: + res = ctx.samdb.search(base=ctx.samdb.get_default_basedn(), + expression='samAccountName=%s' % ldb.binary_encode(ctx.samname), + attrs=["msDS-krbTgtLink"]) + if res: + ctx.del_noerror(res[0].dn, recursive=True) if ctx.connection_dn is not None: ctx.del_noerror(ctx.connection_dn) if ctx.krbtgt_dn is not None: -- cgit