Dmitri Priimak wrote:
I re-read the man page and it is clear to me now, even though it does not feel right. What I mean is that if all = 0 and timeout = NULL then it does not seem possible to now for sure if one retrieved all results of the search.
Well, to me it looks clear (I'm referring to recent OpenLDAP 2.3 man pages, there were some modifications recently): in response to a search operation, the following results are expected:
LDAP_RES_SEARCH_ENTRY (0x64) LDAP_RES_SEARCH_REFERENCE (0x73) LDAP_RES_SEARCH_RESULT (0x65)
The latter indicates that the search is terminated. Whether it terminates successfully or for any other reason, that's contained in the response code in the LDAP_RES_SEARCH_RESULT message (see ldap_parse_result(3) for indications about how to safely parse response messages).
For a detailed description of the exact contents of each message, and of the rationale of their use, refer to RFC 4511 (specifically, Section 4.5.2.).
Exceptionally, other message types could be returned (e.g., LDAP_RES_INTERMEDIATE when the LDAP sync control is used and, in prospective, whenever a search operation is extended by some means allowed by the protocol, but that's another business).
p.
Ing. Pierangelo Masarati OpenLDAP Core Team
SysNet s.r.l. via Dossi, 8 - 27100 Pavia - ITALIA http://www.sys-net.it --------------------------------------- Office: +39 02 23998309 Mobile: +39 333 4963172 Email: pierangelo.masarati@sys-net.it ---------------------------------------