1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

kcc: Remove DN translation for Site GUID

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Garming Sam 2015-02-24 14:13:52 +13:00 committed by Andrew Bartlett
parent 99d4efc917
commit d583913337
2 changed files with 13 additions and 21 deletions

View File

@ -1439,11 +1439,12 @@ class Site(object):
ssdn = "CN=NTDS Site Settings,%s" % self.site_dnstr
attrs = ["options",
"interSiteTopologyFailover",
"interSiteTopologyGenerator",
"objectGUID"]
"interSiteTopologyGenerator"]
try:
res = samdb.search(base=ssdn, scope=ldb.SCOPE_BASE,
attrs=attrs)
self_res = samdb.search(base=self.site_dnstr, scope=ldb.SCOPE_BASE,
attrs=['objectGUID'])
except ldb.LdbError, (enum, estr):
raise Exception("Unable to find site settings for (%s) - (%s)" %
(ssdn, estr))
@ -1458,6 +1459,7 @@ class Site(object):
if "interSiteTopologyFailover" in msg:
self.site_topo_failover = int(msg["interSiteTopologyFailover"][0])
msg = self_res[0]
if "objectGUID" in msg:
self.site_guid = misc.GUID(samdb.schema_format_value("objectGUID",
msg["objectGUID"][0]))
@ -2131,7 +2133,7 @@ class SiteLink(object):
"siteList" ]
try:
res = samdb.search(base=self.dnstr, scope=ldb.SCOPE_BASE,
attrs=attrs)
attrs=attrs, controls=['extended_dn:0'])
except ldb.LdbError, (enum, estr):
raise Exception("Unable to find SiteLink for (%s) - (%s)" %
@ -2154,9 +2156,9 @@ class SiteLink(object):
if "siteList" in msg:
for value in msg["siteList"]:
dsdn = dsdb_Dn(samdb, value)
dnstr = str(dsdn.dn)
if dnstr not in self.site_list:
self.site_list.append(dnstr)
guid = misc.GUID(dsdn.dn.get_extended_component('GUID'))
if guid not in self.site_list:
self.site_list.append(guid)
def is_sitelink(self, site1_dnstr, site2_dnstr):
"""Given a siteLink object, determine if it is a link

View File

@ -75,8 +75,6 @@ class KCC(object):
self.kcc_failed_links = {}
self.kcc_failed_connections = set()
self.site_dn_to_guid = {}
# Used in inter-site topology computation. A list
# of connections (by NTDSConnection object) that are
# to be kept when pruning un-needed NTDS Connections
@ -163,8 +161,6 @@ class KCC(object):
self.my_site_guid = site.site_guid
self.my_site = site
self.site_dn_to_guid[self.my_site_dnstr.lower()] = str(self.my_site_guid)
def load_all_sites(self):
"""Discover all sites and instantiate and load each
NTDS Site settings.
@ -191,8 +187,6 @@ class KCC(object):
self.site_table[str(site.site_guid)] = site
self.site_dn_to_guid[sitestr.lower()] = str(site.site_guid)
def load_my_dsa(self):
"""Discover my nTDSDSA dn thru the rootDSE entry
@ -1029,8 +1023,7 @@ class KCC(object):
for transport_guid, transport in self.transport_table.items():
# Currently only ever "IP"
for site_link_dn, site_link in self.sitelink_table.items():
new_edge = create_edge(transport_guid, site_link, guid_to_vertex,
self.site_dn_to_guid)
new_edge = create_edge(transport_guid, site_link, guid_to_vertex)
connected_vertices.update(new_edge.vertices)
g.edges.add(new_edge)
@ -2617,16 +2610,13 @@ def write_search_result(samdb, f, res):
lstr = samdb.write_ldif(msg, ldb.CHANGETYPE_NONE)
f.write("%s" % lstr)
def create_edge(con_type, site_link, guid_to_vertex, site_dn_to_guid):
def create_edge(con_type, site_link, guid_to_vertex):
e = MultiEdge()
e.site_link = site_link
e.vertices = []
for site_dn in site_link.site_list:
site_guid = site_dn_to_guid.get(site_dn.lower())
if site_guid is None:
continue
if site_guid in guid_to_vertex:
e.vertices.extend(guid_to_vertex.get(site_guid))
for site_guid in site_link.site_list:
if str(site_guid) in guid_to_vertex:
e.vertices.extend(guid_to_vertex.get(str(site_guid)))
e.repl_info.cost = site_link.cost
e.repl_info.options = site_link.options
e.repl_info.interval = site_link.interval