From a1c2443701d37b63cada9f222645cd8e548b5000 Mon Sep 17 00:00:00 2001 From: jgyates Date: Thu, 28 Sep 2023 19:25:31 -0400 Subject: [PATCH] V1.18.18 --- genserv.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/genserv.py b/genserv.py index 4fb43915..75e3ee9d 100644 --- a/genserv.py +++ b/genserv.py @@ -354,6 +354,8 @@ def doLdapLogin(username, password): return False try: from ldap3 import ALL, NTLM, Connection, Server + from ldap3.utils.dn import escape_rdn + from ldap3.utils.conv import escape_filter_chars except ImportError as importException: LogError( "LDAP3 import not found, run 'sudo pip install ldap3 && sudo pip3 install ldap3'" @@ -382,9 +384,10 @@ def doLdapLogin(username, password): authentication=NTLM, auto_bind=True, ) + loginbasestr = escape_filter_chars("(&(objectclass=user)(sAMAccountName=" + AccountName + "))") conn.search( LdapBase, - "(&(objectclass=user)(sAMAccountName=" + AccountName + "))", + loginbasestr, attributes=["memberOf"], ) for user in sorted(conn.entries):