1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

KCC: Help RW DCs to ignore RODCs when doing kcc

As far as writable DCs are concerned, RODCs don't even exist. So we make
tables that leave out the RO ones.

An RODC needs to know itself as well as writable DCs, so we add it in
that case.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2015-03-27 18:08:53 +13:00 committed by Andrew Bartlett
parent ceb6ab99b5
commit 39da46e72c
2 changed files with 18 additions and 4 deletions

View File

@ -1391,6 +1391,7 @@ class Site(object):
self.site_topo_generator = None
self.site_topo_failover = 0 # appears to be in minutes
self.dsa_table = {}
self.rw_dsa_table = {}
self.unix_now = unix_now
def load_site(self, samdb):
@ -1454,8 +1455,11 @@ class Site(object):
# Assign this dsa to my dsa table
# and index by dsa dn
self.dsa_table[dnstr] = dsa
if not dsa.is_ro():
self.rw_dsa_table[dnstr] = dsa
def get_dsa_by_guidstr(self, guidstr):
def get_dsa_by_guidstr(self, guidstr): #XXX unused
for dsa in self.dsa_table.values():
if str(dsa.dsa_guid) == guidstr:
return dsa
@ -1506,7 +1510,7 @@ class Site(object):
# Which is a fancy way of saying "sort all the nTDSDSA objects
# in the site by guid in ascending order". Place sorted list
# in D_sort[]
D_sort = sorted(self.dsa_table.values(), cmp=sort_dsa_by_guid)
D_sort = sorted(self.rw_dsa_table.values(), cmp=sort_dsa_by_guid)
ntnow = unix2nttime(self.unix_now) # double word number of 100 nanosecond
# intervals since 1600s

View File

@ -245,6 +245,16 @@ class KCC(object):
self.my_dsa = self.my_site.get_dsa(self.my_dsa_dnstr)
if self.my_dsa_dnstr not in self.dsa_by_dnstr:
DEBUG_DARK_YELLOW("my_dsa %s isn't in self.dsas_by_dnstr: it must be RODC."
"Let's add it, because my_dsa is a special case!\n"
"(likewise for self.dsa_by_guid of course)" %
self.my_dsas_dnstr)
self.dsa_by_dnstr[self.my_dsa_dnstr] = self.my_dsa
self.dsa_by_guid[str(self.my_dsa.dsa_guid)] = self.my_dsa
def load_all_partitions(self):
"""Discover all NCs thru the Partitions dn and
instantiate and load the NCs.
@ -1142,8 +1152,8 @@ class KCC(object):
DEBUG_RED("get_all_bridgeheads with %s, part%s, partial_ok %s"
" detect_failed %s" % (site.site_dnstr, part.partstr,
partial_ok, detect_failed))
logger.debug(site.dsa_table)
for key, dsa in site.dsa_table.items():
logger.debug(site.rw_dsa_table)
for dsa in site.rw_dsa_table.values():
pdnstr = dsa.get_parent_dnstr()