1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-06-26 16:45:52 +00:00

fix(auth/ldap): Extract user attribute from list in _login3

This commit modifies `_login3` to check if the attribute value is a
list and, if so, extracts the first element (`[0]`) as the login
identifier. If the value is not a list, it's used directly (fallback).
This commit is contained in:
Miles Liu 2025-04-17 13:59:39 +08:00
parent a64a774ef1
commit 24138389ed
No known key found for this signature in database
GPG key ID: 4DB9B32F9B24A7A9

View file

@ -248,7 +248,10 @@ class Auth(auth.BaseAuth):
logger.debug("_login3 LDAP groups of user: %s", ",".join(self._ldap_groups))
if self._ldap_user_attr:
if user_entry['attributes'][self._ldap_user_attr]:
login = user_entry['attributes'][self._ldap_user_attr]
if isinstance(user_entry['attributes'][self._ldap_user_attr], list):
login = user_entry['attributes'][self._ldap_user_attr][0]
else:
login = user_entry['attributes'][self._ldap_user_attr]
logger.debug(f"_login3 user set to: '{login}'")
conn.unbind()
logger.debug(f"_login3 {login} successfully authenticated")