Change ldap.Search to ldap.SearchWithPaging (#17534)

fixes #16390

Signed-off-by: stonezdj <stonezdj@gmail.com>

Signed-off-by: stonezdj <stonezdj@gmail.com>
This commit is contained in:
stonezdj(Daojun Zhang) 2022-09-19 11:04:54 +08:00 committed by GitHub
parent 848167c4e0
commit b6c978c7f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,8 @@ import (
"github.com/goharbor/harbor/src/pkg/ldap/model"
)
const pageSize = 1000
// ErrNotFound ...
var ErrNotFound = errors.New("entity not found")
@ -267,7 +269,7 @@ func (s *Session) SearchLdapAttribute(baseDN, filter string, attributes []string
nil,
)
result, err := s.ldapConn.Search(searchRequest)
result, err := s.ldapConn.SearchWithPaging(searchRequest, pageSize)
if result != nil {
log.Debugf("Found entries:%v\n", len(result.Entries))
} else {