mirror of
https://github.com/samba-team/samba.git
synced 2025-08-05 12:22:11 +03:00
s4-join Add a partitions DN when we join a subdomain
This commit is contained in:
@ -154,6 +154,8 @@ class dc_join(object):
|
|||||||
ctx.del_noerror(ctx.server_dn, recursive=True)
|
ctx.del_noerror(ctx.server_dn, recursive=True)
|
||||||
if ctx.topology_dn:
|
if ctx.topology_dn:
|
||||||
ctx.del_noerror(ctx.topology_dn)
|
ctx.del_noerror(ctx.topology_dn)
|
||||||
|
if ctx.partition_dn:
|
||||||
|
ctx.del_noerror(ctx.partition_dn)
|
||||||
if res:
|
if res:
|
||||||
ctx.new_krbtgt_dn = res[0]["msDS-Krbtgtlink"][0]
|
ctx.new_krbtgt_dn = res[0]["msDS-Krbtgtlink"][0]
|
||||||
ctx.del_noerror(ctx.new_krbtgt_dn)
|
ctx.del_noerror(ctx.new_krbtgt_dn)
|
||||||
@ -373,6 +375,19 @@ class dc_join(object):
|
|||||||
rec["invocationId"] = ndr_pack(misc.GUID(str(uuid.uuid4())))
|
rec["invocationId"] = ndr_pack(misc.GUID(str(uuid.uuid4())))
|
||||||
ctx.DsAddEntry(rec)
|
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
|
# find the GUID of our NTDS DN
|
||||||
res = ctx.samdb.search(base=ctx.ntds_dn, scope=ldb.SCOPE_BASE, attrs=["objectGUID"])
|
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]))
|
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.domain_name = netbios_domain
|
||||||
ctx.realm = dnsdomain
|
ctx.realm = dnsdomain
|
||||||
ctx.dnsdomain = 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.base_dn = samba.dn_from_dns_name(dnsdomain)
|
||||||
ctx.domsid = str(security.random_sid())
|
ctx.domsid = str(security.random_sid())
|
||||||
ctx.acct_dn = None
|
ctx.acct_dn = None
|
||||||
|
Reference in New Issue
Block a user