summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJoe Guo <joeg@catalyst.net.nz>2018-10-29 10:16:02 +1300
committerAndrew Bartlett <abartlet@samba.org>2018-11-21 07:46:19 +0100
commit86882bd12e506e3a7ceac4f3e9e282df55398a7f (patch)
treefd907678fc3e203fc25201f93d7e358b0d9b7994 /python
parente71d0d71203474b1b30c8c8250c28ba4889b1f20 (diff)
downloadsamba-86882bd12e506e3a7ceac4f3e9e282df55398a7f.tar.gz
netcmd/ldapcmp: avoid list comprehension in for loop
The list comprehension will repeat for each item. For large database, this make the command freeze. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/netcmd/ldapcmp.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/samba/netcmd/ldapcmp.py b/python/samba/netcmd/ldapcmp.py
index 9bfa8531e81..51f3c7dea54 100644
--- a/python/samba/netcmd/ldapcmp.py
+++ b/python/samba/netcmd/ldapcmp.py
@@ -751,9 +751,13 @@ class LDAPBundle(object):
# It does not matter if they are in the same DC, in two DC in one domain or in two
# different domains.
if self.search_scope != SCOPE_BASE:
+
+ self_dns = [q.upper() for q in self.dn_list]
+ other_dns = [q.upper() for q in other.dn_list]
+
title = "\n* DNs found only in %s:" % self.con.host
for x in self.dn_list:
- if not x.upper() in [q.upper() for q in other.dn_list]:
+ if not x.upper() in other_dns:
if title and not self.skip_missing_dn:
self.log(title)
title = None
@@ -764,7 +768,7 @@ class LDAPBundle(object):
#
title = "\n* DNs found only in %s:" % other.con.host
for x in other.dn_list:
- if not x.upper() in [q.upper() for q in self.dn_list]:
+ if not x.upper() in self_dns:
if title and not self.skip_missing_dn:
self.log(title)
title = None