From 6f4cc4280534f0e4c857e6aab5325cb981dcc2a1 Mon Sep 17 00:00:00 2001 From: Vadim Aleksandrov Date: Fri, 9 Feb 2018 15:32:50 +0300 Subject: [PATCH] Fix issue with LDAP search filter. It is necessary to bracket the expression with additional filter conditions --- app/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models.py b/app/models.py index 9aee967..5908603 100644 --- a/app/models.py +++ b/app/models.py @@ -188,7 +188,7 @@ class User(db.Model): searchFilter = "(&(objectcategory=person)(samaccountname=%s))" % self.username if LDAP_TYPE == 'ldap': - searchFilter = "(&(%s=%s)%s)" % (LDAP_USERNAMEFIELD, self.username, LDAP_FILTER) + searchFilter = "(&(%s=%s)(%s))" % (LDAP_USERNAMEFIELD, self.username, LDAP_FILTER) logging.info('Ldap searchFilter "%s"' % searchFilter) result = self.ldap_search(searchFilter, LDAP_SEARCH_BASE)