[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: library questions: LDAPMessage, msgid, ...
Hallvard B Furuseth <h.b.furuseth@usit.uio.no> wrote:
> 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?
>
> Right.
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?
>> 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.
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.
paul
- References:
- library questions: LDAPMessage, msgid, ...
- From: prj@po.cwru.edu (Paul Jarc)
- Re: library questions: LDAPMessage, msgid, ...
- From: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
- Re: library questions: LDAPMessage, msgid, ...
- From: prj@po.cwru.edu (Paul Jarc)
- Re: library questions: LDAPMessage, msgid, ...
- From: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
- Re: library questions: LDAPMessage, msgid, ...
- From: prj@po.cwru.edu (Paul Jarc)
- Re: library questions: LDAPMessage, msgid, ...
- From: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>