Skip to content

Commit

Permalink
Merge pull request kubesphere#667 from wansir/fix-ldap-conn-pool
Browse files Browse the repository at this point in the history
fix: recycle ldap connections in pool
  • Loading branch information
ks-ci-bot authored Aug 27, 2019
2 parents defaa63 + abc7423 commit c6440ec
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/models/iam/im.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,8 @@ func GetUserInfo(username string) (*models.User, error) {
return nil, err
}

defer conn.Close()

userSearchRequest := ldap.NewSearchRequest(
ldapclient.UserSearchBase,
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
Expand Down Expand Up @@ -1162,6 +1164,8 @@ func DescribeGroup(path string) (*models.Group, error) {
return nil, err
}

defer conn.Close()

groupSearchRequest := ldap.NewSearchRequest(searchBase,
ldap.ScopeSingleLevel, ldap.NeverDerefAliases, 0, 0, false,
fmt.Sprintf("(&(objectClass=posixGroup)(cn=%s))", cn),
Expand Down

0 comments on commit c6440ec

Please sign in to comment.