From cf09aab18bc5adcf7b5ef68c422e5706ec3971f8 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mon, 23 Mar 2009 15:13:40 -0400 Subject: Allow a search using only the exact search filter --- ipaserver/plugins/b_ldap.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'ipaserver') diff --git a/ipaserver/plugins/b_ldap.py b/ipaserver/plugins/b_ldap.py index 2f3c084e..7c132153 100644 --- a/ipaserver/plugins/b_ldap.py +++ b/ipaserver/plugins/b_ldap.py @@ -371,6 +371,7 @@ class ldap(CrudBackend): attributes = kw.get('attributes') base = kw.get('base') scope = kw.get('scope') + exactonly = kw.get('exactonly', None) if attributes: del kw['attributes'] else: @@ -383,6 +384,8 @@ class ldap(CrudBackend): del kw['filter'] if scope: del kw['scope'] + if exactonly is not None: + del kw['exactonly'] (exact_match_filter, partial_match_filter) = self._generate_search_filters(**kw) if objectclass: exact_match_filter = "(&(objectClass=%s)%s)" % (objectclass, exact_match_filter) @@ -403,10 +406,13 @@ class ldap(CrudBackend): except errors2.NotFound: exact_results = [0] - try: - partial_results = servercore.search(search_base, - partial_match_filter, attributes, scope=search_scope) - except errors2.NotFound: + if not exactonly: + try: + partial_results = servercore.search(search_base, + partial_match_filter, attributes, scope=search_scope) + except errors2.NotFound: + partial_results = [0] + else: partial_results = [0] exact_counter = exact_results[0] -- cgit