Skip to content

Commit

Permalink
fix ldap search when filtering with empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
byewokko committed Sep 13, 2024
1 parent 00019ca commit b2bcf34
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion seacatauth/credentials/providers/ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,12 @@ async def iterate(self, offset: int = 0, limit: int = -1, filtr: str = None):
yield i

def _build_search_filter(self, filtr=None):
if filtr is None:
if not filtr:
filterstr = self.Config["filter"]
else:
# The query filter is the intersection of the filter from config
# and the filter defined by the search request
# The username must START WITH the given filter string
filter_template = "(&{}({}=*%s*))".format(self.Config["filter"], self.Config["attrusername"])
assertion_values = ["{}".format(filtr.lower())]
filterstr = ldap.filter.filter_format(
Expand Down

0 comments on commit b2bcf34

Please sign in to comment.