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

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

Paul Jarc writes:
>Hallvard B Furuseth <h.b.furuseth@usit.uio.no> wrote:
>>Paul Jarc writes:
>>> LDAPMessage* bar=ldap_first_entry(ld, foo);
> Is there any good/harm in calling ldap_msgfree(bar) before
> ldap_msgfree(foo)?  Or should ldap_msgfree only be used for
> "top-level" messages?

The latter.  ldap_msgfree(bar) breaks ldap_msgfree(foo).
You will often have bar == foo after the above call.

> Ok, so:
> errcode=LDAP_SUCCESS;
> ldap_set_option(ld, LDAP_OPT_ERROR_NUMBER, &errcode);
> entry=ldap_first_entry(ld, res);
> if (entry==NULL) {
>   ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &errcode);
>   if (errcode!=LDAP_SUCCESS) { /* throw error */ }
> }
> return entry;


>> Most code simply ignores any errors, though.
> I'll be throwing exceptions.  So my Scheme code will also ignore
> errors, but it'll be safe to do that. :)
>> These calls cannot fail in OpenLDAP.
> The man pages should probably be fixed, then.

I'll post an ITS about it.  Not sure if it is the manpages or the code
which should be fixed.  Maybe the code should set the error number.