From 0254a4ec34a3641cb2bdf4961046da9a40fef16f Mon Sep 17 00:00:00 2001 From: 710leo <710leo@gmail.com> Date: Thu, 11 Nov 2021 15:16:26 +0800 Subject: [PATCH] refactor: ldap search request --- models/ldap.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/ldap.go b/models/ldap.go index 0e22afef..a5c83f2a 100644 --- a/models/ldap.go +++ b/models/ldap.go @@ -87,8 +87,8 @@ func ldapReq(user, pass string) (*ldap.SearchResult, error) { searchRequest := ldap.NewSearchRequest( lc.BaseDn, // The base dn to search ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, - fmt.Sprintf(lc.AuthFilter, user), // The filter to apply - genLdapAttributeSearchList(), // A list attributes to retrieve + fmt.Sprintf(lc.AuthFilter, ldap.EscapeFilter(user)), // The filter to apply + genLdapAttributeSearchList(), // A list attributes to retrieve nil, )