1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s4-join Add a partitions DN when we join a subdomain

This commit is contained in:
Andrew Bartlett 2011-08-26 16:07:05 +10:00
parent c271b71420
commit dd9138d9c6

View File

@ -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