From dd9138d9c64cbc6d381ce589eb247a33b8f5e217 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 26 Aug 2011 16:07:05 +1000 Subject: s4-join Add a partitions DN when we join a subdomain --- source4/scripting/python/samba/join.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source4/scripting/python/samba/join.py b/source4/scripting/python/samba/join.py index 2967ddf7e7..cf2033481e 100644 --- a/source4/scripting/python/samba/join.py +++ b/source4/scripting/python/samba/join.py @@ -154,6 +154,8 @@ class dc_join(object): ctx.del_noerror(ctx.server_dn, recursive=True) if ctx.topology_dn: ctx.del_noerror(ctx.topology_dn) + if ctx.partition_dn: + ctx.del_noerror(ctx.partition_dn) if res: ctx.new_krbtgt_dn = res[0]["msDS-Krbtgtlink"][0] ctx.del_noerror(ctx.new_krbtgt_dn) @@ -373,6 +375,19 @@ class dc_join(object): rec["invocationId"] = ndr_pack(misc.GUID(str(uuid.uuid4()))) ctx.DsAddEntry(rec) + if ctx.subdomain: + print "Adding %s" % ctx.partition_dn + rec = { + "dn" : ctx.partition_dn, + "objectclass" : "crossRef", + "systemFlags" : str(samba.dsdb.SYSTEM_FLAG_CR_NTDS_NC|samba.dsdb.SYSTEM_FLAG_CR_NTDS_DOMAIN), + "dnsRoot": ctx.dnsdomain, + "nCName" : extended_base_dn, + "nETBIOSName" : ctx.domain_name, + "ntMixedDomain": str(0), + "msDS-Behavior-Version" : str(ctx.behavior_version)} + ctx.DsAddEntry(rec) + # find the GUID of our NTDS DN res = ctx.samdb.search(base=ctx.ntds_dn, scope=ldb.SCOPE_BASE, attrs=["objectGUID"]) ctx.ntds_guid = misc.GUID(ctx.samdb.schema_format_value("objectGUID", res[0]["objectGUID"][0])) @@ -643,6 +658,7 @@ def join_subdomain(server=None, creds=None, lp=None, site=None, netbios_name=Non ctx.domain_name = netbios_domain ctx.realm = dnsdomain ctx.dnsdomain = dnsdomain + ctx.partition_dn = "CN=%s,CN=Partitions,%s" % (ctx.domain_name, ctx.config_dn) ctx.base_dn = samba.dn_from_dns_name(dnsdomain) ctx.domsid = str(security.random_sid()) ctx.acct_dn = None -- cgit