In the U-M LDAP 3.3 release at least, a single call to ldap_result()
with a zero-ed timeout structure will read at most one entry or result
from the server. This is a feature -- the assumption is that if you are
polling you don't want to stay inside libldap very long. Since you are
passing a non-zero value for "all", it makes sense that you need to call
ldap_result() once for each entry and once to get the search result (at
least).
A better way to go is to pass zero for "all" and keep calling
ldap_result() as long as it returns an entry or result. Another
alternative is to pass a non-zero timeout value (it can be quite small
-- say 1/10th of a second) to give ldap_result() more time to do its
thing.
--
Mark Smith Netscape Communications Corp.
The opinions I express are my own. Directory Server Engineering