Fix issue with LDAP search filter. It is necessary to bracket the expression with additional filter conditions

This commit is contained in:
Vadim Aleksandrov 2018-02-09 15:32:50 +03:00
parent b6ed658cbd
commit 6f4cc42805

View File

@ -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)