go-ldap / ldap

Basic LDAP v3 functionality for the GO programming language.
Other
2.25k stars 355 forks source link

SearchWithPaging doesn't return all results if size limit or time limit exeeded #411

Closed tomqwpl closed 1 year ago

tomqwpl commented 1 year ago

The Search method will return partial results if the size limit or time limit parameters are used and the limit is exceeded.

In the case of SearchWithPaging, the results are only appended if there is no error:

        result, err := l.Search(searchRequest)
        if err != nil {
            return searchResult, err
        }
        searchResult.Entries = append(searchResult.Entries, result.Entries...)

If you therefore use SearchWithPaging with a limit of, say, 5, and there are more results, you're not going to get any results.

I think the appends need to happen regardless of the error (assuming searchResult is non-nil)

ksankeerth commented 1 year ago

Hi @cpuschma, Can I take this issue? Will you be able to review PR if i send? Thanks

cpuschma commented 1 year ago

Sure, I would be very happy about a PR, @ksankeerth ^^