Bug 34416 - Increase performance of ldap_verify_object()
Increase performance of ldap_verify_object()
Status: NEW
Product: UCS Test
Classification: Unclassified
Component: UDM
unspecified
Other Linux
: P5 normal (vote)
: ---
Assigned To: Julian Hupertz
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-28 15:43 CET by Sönke Schwardt-Krummrich
Modified: 2016-10-05 20:20 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Cleanup, UCS Performance
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Schwardt-Krummrich univentionstaff 2014-03-28 15:43:15 CET
verify_ldap_object currently does a lo.search() with base=$DN and scope='sub' which may return more than the desired single object (e.g. if a container or the ldap base is checked). For performance reasons scope='base' should be passed to search() or instead lo.get() should be used.

@@ -99,11 +99,11 @@ def get_ldap_connection(pwdfile = False, start_tls = 2, decode_ignorelist = []):
 	raise ldap.SERVER_DOWN()
 
 
 def verify_ldap_object(baseDn, expected_attr = {}, strict = True, should_exist = True):
 	try:
-		dn, attr = get_ldap_connection().search(filter = '(objectClass=*)', base = baseDn, attr = expected_attr.keys())[0]
+		dn, attr = get_ldap_connection().search(filter = '(objectClass=*)', base = baseDn, scope='base', attr = expected_attr.keys())[0]
 	except (ldap.NO_SUCH_OBJECT, IndexError):
 		if should_exist:
 			raise LDAPObjectNotFound('DN: %s' % baseDn)
 		return
Comment 1 Arvid Requate univentionstaff 2016-09-06 15:23:26 CEST
That is test/ucs-test/univention/testing/utils.py