From 24138389eda68289fda9695d13fa3f6a3d6fce53 Mon Sep 17 00:00:00 2001 From: Miles Liu Date: Thu, 17 Apr 2025 13:59:39 +0800 Subject: [PATCH] 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). --- radicale/auth/ldap.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/radicale/auth/ldap.py b/radicale/auth/ldap.py index 54ee5b4b..ba991302 100644 --- a/radicale/auth/ldap.py +++ b/radicale/auth/ldap.py @@ -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")