未验证 提交 abc74230 编写于 作者: H hongming

fix: recycle ldap connections in pool

Signed-off-by: Nhongming <talonwan@yunify.com>
上级 defaa63d
...@@ -467,6 +467,8 @@ func GetUserInfo(username string) (*models.User, error) { ...@@ -467,6 +467,8 @@ func GetUserInfo(username string) (*models.User, error) {
return nil, err return nil, err
} }
defer conn.Close()
userSearchRequest := ldap.NewSearchRequest( userSearchRequest := ldap.NewSearchRequest(
ldapclient.UserSearchBase, ldapclient.UserSearchBase,
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
...@@ -1162,6 +1164,8 @@ func DescribeGroup(path string) (*models.Group, error) { ...@@ -1162,6 +1164,8 @@ func DescribeGroup(path string) (*models.Group, error) {
return nil, err return nil, err
} }
defer conn.Close()
groupSearchRequest := ldap.NewSearchRequest(searchBase, groupSearchRequest := ldap.NewSearchRequest(searchBase,
ldap.ScopeSingleLevel, ldap.NeverDerefAliases, 0, 0, false, ldap.ScopeSingleLevel, ldap.NeverDerefAliases, 0, 0, false,
fmt.Sprintf("(&(objectClass=posixGroup)(cn=%s))", cn), fmt.Sprintf("(&(objectClass=posixGroup)(cn=%s))", cn),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册