Skip to content

Commit

Permalink
Merge pull request #32 from cviecco/fix-getgroupusers-add-pagination
Browse files Browse the repository at this point in the history
adding pagination
  • Loading branch information
rgooch committed Oct 12, 2020
2 parents f86a642 + 5ab90fb commit 4cf44f0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/auth/ldaputil/impl.go
Expand Up @@ -215,6 +215,10 @@ func getGroupDNAndSimpleUsers(conn *ldap.Conn, GroupSearchBaseDNs []string,
return "", nil, nil
}

// 389DS page size default is 1024
// AD implementations that cviecco has seen have 2000
const groupUsersSearchPageSize = 1000

func getGroupUsersRFC2307bis(conn *ldap.Conn, UserSearchBaseDNs []string,
GroupSearchBaseDNs []string,
//groupSearchFilter string,
Expand All @@ -234,7 +238,7 @@ func getGroupUsersRFC2307bis(conn *ldap.Conn, UserSearchBaseDNs []string,
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
fmt.Sprintf("(memberOf=%s)", groupDN),
[]string{"cn", userAttribute}, nil)
sr, err := conn.Search(searchRequest)
sr, err := conn.SearchWithPaging(searchRequest, groupUsersSearchPageSize)
if err != nil {
return nil, fmt.Errorf("error on search request: %s", err)
}
Expand Down

0 comments on commit 4cf44f0

Please sign in to comment.