diff options
author | Pavel Zuna <pzuna@redhat.com> | 2009-04-21 15:25:48 +0200 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-04-23 10:23:28 -0400 |
commit | 5fa7c76f729bfebf8bcc271a7601da75d6e196fd (patch) | |
tree | 5f74f9b7a9fe3e487aa377215b467f61025a50da | |
parent | 32ad0ab01174a200d05f2fe2ddeba79f7c1781f4 (diff) | |
download | freeipa-5fa7c76f729bfebf8bcc271a7601da75d6e196fd.tar.gz freeipa-5fa7c76f729bfebf8bcc271a7601da75d6e196fd.tar.xz freeipa-5fa7c76f729bfebf8bcc271a7601da75d6e196fd.zip |
Fix filter generator in ldapapi. Shouldn't produce invalid filters anymore.
-rw-r--r-- | ipaserver/plugins/ldapapi.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/ipaserver/plugins/ldapapi.py b/ipaserver/plugins/ldapapi.py index 7c132153..9eea3eaa 100644 --- a/ipaserver/plugins/ldapapi.py +++ b/ipaserver/plugins/ldapapi.py @@ -386,20 +386,26 @@ class ldap(CrudBackend): del kw['scope'] if exactonly is not None: del kw['exactonly'] - (exact_match_filter, partial_match_filter) = self._generate_search_filters(**kw) + if kw: + (exact_match_filter, partial_match_filter) = self._generate_search_filters(**kw) + else: + (exact_match_filter, partial_match_filter) = ('', '') if objectclass: - exact_match_filter = "(&(objectClass=%s)%s)" % (objectclass, exact_match_filter) - partial_match_filter = "(&(objectClass=%s)%s)" % (objectclass, partial_match_filter) + exact_match_filter = '(&(objectClass=%s)%s)' % (objectclass, exact_match_filter) + partial_match_filter = '(&(objectClass=%s)%s)' % (objectclass, partial_match_filter) + else: + exact_match_filter = '(&(objectClass=*)%s)' % exact_match_filter + partial_match_filter = '(&(objectClass=*)%s)' % partial_match_filter if sfilter: - exact_match_filter = "(%s%s)" % (sfilter, exact_match_filter) - partial_match_filter = "(%s%s)" % (sfilter, partial_match_filter) + exact_match_filter = '(%s%s)' % (sfilter, exact_match_filter) + partial_match_filter = '(%s%s)' % (sfilter, partial_match_filter) search_scope = self._get_scope(scope) if not base: base = self.api.env.container_accounts - search_base = "%s, %s" % (base, self.api.env.basedn) + search_base = '%s,%s' % (base, self.api.env.basedn) try: exact_results = servercore.search(search_base, exact_match_filter, attributes, scope=search_scope) |