mirror of
https://github.com/h44z/wg-portal.git
synced 2026-11-20 12:43:26 +01:00
fix(ldap): page the user search - Active Directory returns at most 1000 entries per search (#772)
The LDAP user synchronization failed with "Size Limit Exceeded" (result code 4) on directories with more users than the server's MaxPageSize. Signed-off-by: Arcadie Cracan <acracan@gmail.com> Co-authored-by: Arcadie Cracan <acracan@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Arcadie Cracan
Claude Opus 5.5
parent
ef7409d33f
commit
568d7caa76
@@ -22,7 +22,8 @@ func LdapFindAllUsers(conn *ldap.Conn, baseDn, filter string, fields *config.Lda
|
||||
filter, attrs, nil,
|
||||
)
|
||||
|
||||
sr, err := conn.Search(searchRequest)
|
||||
// paged: Active Directory returns at most MaxPageSize (1000) entries per search
|
||||
sr, err := conn.SearchWithPaging(searchRequest, 500)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to search: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user