Rakesh Yadav wrote:
In case of ldap_search_ext_s:
We can pass,how many entries we want.
In my case i can retrieve only 100 entries at a time due to the size limit
of my buffer.
But the ldap search which i am using will return 1000 entries.
Is there any way through which i can retrieve 1000 entries in chunks of 100.
first time i will fetch 100 entries then
again next 100 entries then
again next 100 entries.....
In this way i will retrieve all the entries.
Please tell me the way of fetching entries from LDAP.
Your problem could be solved in many ways: using a band-aid, or
designing your client to get rid of self-imposed constraints.
Usually there are two cases:
1) entries can be processed one by one, regardless of the order they come in
2) entries need to be processed all at once
There's also an intermediate case
3) entries need to be processed all at once, but pre-processing can
start as soon as data comes in
The latter is a mix of the two, and it is basically a matter of
optimization (Real Programmers (TM) usually use the asynchronous call
anyway, because it allows finer grain control on things like select(2)
timeouts and so).
In case (1) you should use an asynchronous call, like
ldap_search_ext(3), so that you get entries one by one as soon as
they're available, using ldap_result(3), and dispose of them as soon as
In case (2) you can use a synchronous call, like ldap_search_ext_s(3),
which will return all entries in a bunch, malloc'ed and linked list'ed.
In that case, you don't need any fixed size buffer, so if you design
your client with a fixed buffer for search entries while you plan to use
a synchronous call you are definitely trying to figure out the best way
to shoot in your own foot.
For completeness, I have to say that if you're really committed to
pulling the trigger, then you could have a look at paged results control
(RFC 2696). I wouldn't go that way, though.
Examples of using asynchronous search and even paged results control are
available in clients/tools/ldapsearch.c.
Ing. Pierangelo Masarati
OpenLDAP Core Team
via Dossi, 8 - 27100 Pavia - ITALIA
Office: +39 02 23998309
Mobile: +39 333 4963172