Fix looping over multiple entities or groups

This commit is contained in:
signaryk 2024-07-05 16:16:02 -05:00
parent c2eca7ed43
commit ab4283ceac

View file

@ -80,9 +80,7 @@ func (s *server) handleSearchEntities(w ldap.ResponseWriter, m *ldap.Message) {
if exprAnd {
e, complete, err = s.entitySearchResultWithMatch(ctx, ents[i], r.BaseObject(), r.Attributes(), matchGroup)
if !complete {
res := ldap.NewSearchResultDoneResponse(ldap.LDAPResultSuccess)
w.Write(res)
return
continue
}
} else {
e, err = s.entitySearchResult(ctx, ents[i], r.BaseObject(), r.Attributes())
@ -236,9 +234,7 @@ func (s *server) handleSearchGroups(w ldap.ResponseWriter, m *ldap.Message) {
s.l.Debug("Match UID: ", matchUid)
e, complete, err = s.groupSearchResultWithMatch(ctx, groups[i], r.BaseObject(), r.Attributes(), matchUid)
if !complete {
res := ldap.NewSearchResultDoneResponse(ldap.LDAPResultSuccess)
w.Write(res)
return
continue
}
} else {
e, err = s.groupSearchResult(ctx, groups[i], r.BaseObject(), r.Attributes())