From 303f97034bc4e7b206b1e3a332b38c4ac8023974 Mon Sep 17 00:00:00 2001 From: Giacomo Sanchietti Date: Tue, 10 Dec 2024 09:48:50 +0100 Subject: [PATCH] fix(users): force user name to lower case Users inside a remote LDAP are usually matched in case-insentive mode. Make sure to always force the username to lower case to avoid mismatch when the remote LDAP has names in uppercase (like AD): this change will fix access for OpenVPN users using the external LDAP. Note that such users are already imported in lower case inside the users db. --- src/nethsec/users/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nethsec/users/__init__.py b/src/nethsec/users/__init__.py index 19cabf30..f00acbf1 100644 --- a/src/nethsec/users/__init__.py +++ b/src/nethsec/users/__init__.py @@ -756,7 +756,7 @@ def ldif2users(ldif_data, user_attr="uid", display_attr="cn"): for dn, record in parser.parse(): if user_attr in record: user = {} - user["name"] = record[user_attr][0] + user["name"] = record[user_attr][0].lower() if display_attr in record: user["description"] = record[display_attr][0] else: