Skip to content

Commit 4814984

Browse files
authored
Merge pull request #83 from dhirschfeld/escape-fail-take2
Fix comma escape in resolved_username
2 parents 89e64ca + 6b0c3eb commit 4814984

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ldapauthenticator/ldapauthenticator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,10 @@ def getConnection(userdn, username, password):
302302
if resolved_username is None:
303303
return None
304304

305-
resolved_username = re.subn(r"([^\\]),", r"\1\,", resolved_username)[0]
305+
if self.lookup_dn:
306+
if str(self.lookup_dn_user_dn_attribute).upper() == 'CN':
307+
# Only escape commas if the lookup attribute is CN
308+
resolved_username = re.subn(r"([^\\]),", r"\1\,", resolved_username)[0]
306309

307310
bind_dn_template = self.bind_dn_template
308311
if isinstance(bind_dn_template, str):

0 commit comments

Comments
 (0)