From 1a5445ca4e729389a7b5c226cf1d9b73429013a1 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 2 Nov 2016 16:49:49 +1300 Subject: [PATCH] KCC: avoid infinite recursion when edgelist contains self Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett Reviewed-by: Garming Sam --- python/samba/kcc/kcc_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/samba/kcc/kcc_utils.py b/python/samba/kcc/kcc_utils.py index 1d4b9d61f18..aefe1aa1a85 100644 --- a/python/samba/kcc/kcc_utils.py +++ b/python/samba/kcc/kcc_utils.py @@ -1791,7 +1791,9 @@ class GraphNode(object): text = text + "\n\tmax_edges=%d" % self.max_edges for i, edge in enumerate(self.edge_from): - text = text + "\n\tedge_from[%d]=%s" % (i, edge) + if isinstance(edge, str): + text += "\n\tedge_from[%d]=%s" % (i, edge) + return text def add_edge_from(self, from_dsa_dnstr): @@ -1799,7 +1801,7 @@ class GraphNode(object): :param from_dsa_dnstr: the dsa that the edge emanates from """ - assert from_dsa_dnstr is not None + assert isinstance(from_dsa_dnstr, str) # No edges from myself to myself if from_dsa_dnstr == self.dsa_dnstr: