summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-03-23 15:13:40 -0400
committerRob Crittenden <rcritten@redhat.com>2009-03-25 11:02:52 -0400
commitcf09aab18bc5adcf7b5ef68c422e5706ec3971f8 (patch)
tree73b786afa31be5aafbb89543384b508ae0c44d39 /ipaserver
parent1b1f9af01cf27d673039bd8166f4d04d2d91e51a (diff)
downloadfreeipa-cf09aab18bc5adcf7b5ef68c422e5706ec3971f8.tar.gz
freeipa-cf09aab18bc5adcf7b5ef68c422e5706ec3971f8.tar.xz
freeipa-cf09aab18bc5adcf7b5ef68c422e5706ec3971f8.zip
Allow a search using only the exact search filter
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/plugins/b_ldap.py14
1 files changed, 10 insertions, 4 deletions
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]