From 769ec0635ad57fb264cea24951b047463fe2d797 Mon Sep 17 00:00:00 2001 From: kat witch Date: Tue, 21 Sep 2021 01:12:05 +0100 Subject: [PATCH] services/murmur-ldap: Device system --- config/services/murmur-ldap/LDAPauth.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/services/murmur-ldap/LDAPauth.py b/config/services/murmur-ldap/LDAPauth.py index 2da0e06c..90d2879a 100644 --- a/config/services/murmur-ldap/LDAPauth.py +++ b/config/services/murmur-ldap/LDAPauth.py @@ -510,7 +510,9 @@ def do_main_program(): return (AUTH_REFUSED, None, None) # Search for the user. - username_to_try = name.split(".")[0] if "." in name else name + name_split = name.split(".") + username_to_try = name_split[0] if "." in name else name + device = name_split[1] if "." in name else "" res = ldap_conn.search_s(cfg.ldap.users_dn, ldap.SCOPE_SUBTREE, '(%s=%s)' % (cfg.ldap.username_attr, username_to_try), [cfg.ldap.number_attr, cfg.ldap.display_attr]) if len(res) == 0: warning("User " + username_to_try + " not found, input was " + name) @@ -561,6 +563,8 @@ def do_main_program(): # Add the user/id combo to cache, then accept: self.name_uid_cache[displayName] = uid debug("Login accepted for " + name) + if device != "": + displayName = f"{displayName} ({device})" return (uid + cfg.user.id_offset, displayName, []) @fortifyIceFu((False, None))