Skip to content

Commit

Permalink
Fix escaping issue when escape_userdn and allowed_groups are configured
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Sep 15, 2024
1 parent ef65903 commit 3414095
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ldapauthenticator/ldapauthenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,13 @@ async def authenticate(self, handler, data):
is_bound = False
for dn in bind_dn_template:
userdn = dn.format(username=username)
if self.escape_userdn:
userdn = escape_filter_chars(userdn)
self.log.debug(f"Attempting to bind {username} with {userdn}")
msg = "Status of user bind {username} with {userdn} : {is_bound}"
try:
conn = self.get_connection(userdn, password)
if self.escape_userdn:
conn = self.get_connection(escape_filter_chars(userdn), password)
else:
conn = self.get_connection(userdn, password)
except ldap3.core.exceptions.LDAPBindError as exc:
is_bound = False
msg += "\n{exc_type}: {exc_msg}".format(
Expand Down

0 comments on commit 3414095

Please sign in to comment.