[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: library questions: LDAPMessage, msgid, ...

Paul Jarc writes:
> LDAPMessage* foo;
> ldap_search_s(ld, ..., &foo);
> LDAPMessage* bar=ldap_first_entry(ld, foo);
> ldap_msgfree(foo);
> This destroys bar as well, right?


> How do I distinguish error from end-of-list with
> ldap_{first,next}_entry?  Do I just check errcode after
> ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &errcode)?

Officially, yes.  Provided you set the error number to LDAP_SUCCESS
before calling ldap_{first,next}_entry.  Most code simply ignores any
errors, though.

These calls cannot fail in OpenLDAP.  My guess is that this is common,
otherwise someone would have spotted the inconvenience of having to set
LDAP_OPT_ERROR_NUMBER before calling them.

> Also, judging by draft-ietf-ldapext-ldap-c-api-xx.txt, it seems this
> is missing from ldap.h (in 2.1.22):

Thanks.  Fixed in CVS.