From: Noel Power Date: Sat, 25 Aug 2018 10:39:04 +0000 (+0100) Subject: samba_tool: Enclose iterator with list X-Git-Tag: tdb-1.3.17~1238 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=370dcbb791153ff725bd1e254e610ce43dfcd7f1;p=thirdparty%2Fsamba.git samba_tool: Enclose iterator with list Really strange bug caused by map being updated while being iterated. This caused keys to be skipped and inconsistent and incorrect results from ldapcmp. Signed-off-by: Noel Power Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/netcmd/ldapcmp.py b/python/samba/netcmd/ldapcmp.py index 63236a4c761..6508a8fe5db 100644 --- a/python/samba/netcmd/ldapcmp.py +++ b/python/samba/netcmd/ldapcmp.py @@ -211,7 +211,7 @@ class LDAPBase(object): res = dict(res[0]) # 'Dn' element is not iterable and we have it as 'distinguishedName' del res["dn"] - for key in res.keys(): + for key in list(res.keys()): vals = list(res[key]) del res[key] name = self.get_attribute_name(key)