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

KCC: Use ndrpack(GUID) sorting for all graph vertex operations

For intrasite rings, DSA GUIDs are sorted by their ndr_pack
representation, not their string/as-if-128-bit-int representation.

Supposing some consistency across KCC, the graph vertex guids might be
compared the same way. But we don't yet know for sure.

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-17 11:50:02 +13:00 committed by Andrew Bartlett
parent abfb70272c
commit 7e4dfb7e75
2 changed files with 6 additions and 3 deletions

View File

@ -2278,11 +2278,12 @@ class InternalEdge(object):
if self_time != other_time: if self_time != other_time:
return self_time > other_time return self_time > other_time
#XXX guid comparison using ndr_pack
if self.v1.guid != other.v1.guid: if self.v1.guid != other.v1.guid:
return self.v1.guid < other.v1.guid return self.v1.ndrpacked_guid < other.v1.ndrpacked_guid
if self.v2.guid != other.v2.guid: if self.v2.guid != other.v2.guid:
return self.v2.guid < other.v2.guid return self.v2.ndrpacked_guid < other.v2.ndrpacked_guid
return self.e_type < other.e_type return self.e_type < other.e_type

View File

@ -1049,6 +1049,7 @@ class KCC(object):
for site_guid, site in self.site_table.items(): for site_guid, site in self.site_table.items():
vertex = Vertex(site, part) vertex = Vertex(site, part)
vertex.guid = site_guid vertex.guid = site_guid
vertex.ndrpacked_guid = ndr_pack(site.site_guid)
g.vertices.add(vertex) g.vertices.add(vertex)
if not guid_to_vertex.get(site_guid): if not guid_to_vertex.get(site_guid):
@ -3041,7 +3042,8 @@ def add_int_edge(graph, internal_edges, examine, v1, v2):
newIntEdge = InternalEdge(root1, root2, red_red, ri2, examine.con_type) newIntEdge = InternalEdge(root1, root2, red_red, ri2, examine.con_type)
# Order by vertex guid # Order by vertex guid
if newIntEdge.v1.guid > newIntEdge.v2.guid: #XXX guid comparison using ndr_pack
if newIntEdge.v1.ndrpacked_guid > newIntEdge.v2.ndrpacked_guid:
newIntEdge.v1 = root2 newIntEdge.v1 = root2
newIntEdge.v2 = root1 newIntEdge.v2 = root1