1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

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>
This commit is contained in:
Joe Guo
2018-10-29 10:16:02 +13:00
committed by Andrew Bartlett
parent e71d0d7120
commit 86882bd12e

View File

@ -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