From: Björn Baumbach Date: Tue, 13 Aug 2019 11:15:58 +0000 (+0200) Subject: samba_kcc: avoid ValueError when local connections are less than 2 X-Git-Tag: ldb-2.1.0~223 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fd65edc91b0f56e044428a32676b079aec9377d;p=thirdparty%2Fsamba.git samba_kcc: avoid ValueError when local connections are less than 2 Signed-off-by: Björn Baumbach Reviewed-by: Douglas Bagnall Autobuild-User(master): Björn Baumbach Autobuild-Date(master): Wed Dec 18 11:37:53 UTC 2019 on sn-devel-184 --- diff --git a/python/samba/kcc/__init__.py b/python/samba/kcc/__init__.py index 6c6c202fa2c..734c7641883 100644 --- a/python/samba/kcc/__init__.py +++ b/python/samba/kcc/__init__.py @@ -499,6 +499,11 @@ class KCC(object): local_connections.append((cn_conn, s_dnstr, packed_guid, removable)) + # Avoid "ValueError: r cannot be bigger than the iterable" in + # for a, b in itertools.permutations(local_connections, 2): + if (len(local_connections) < 2): + return + for a, b in itertools.permutations(local_connections, 2): cn_conn, s_dnstr, packed_guid, removable = a cn_conn2, s_dnstr2, packed_guid2, removable2 = b