[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: Detecting an error from ldap_get_values()
At 11:20 AM 3/21/00 -0800, Kurt D. Zeilenga wrote:
>At 08:07 PM 3/21/00 +0100, Julio Sánchez Fernández wrote:
>>"Kurt D. Zeilenga" wrote:
>>> I'm thinking that the LDAP C API I-D should require the
>>> API to set LDAP_ERROR_NUMBER upon ldap_get_values() error.
>>> This issue should be raised to IETF-LDAPext.
>>>
>>> In the mean time, I would not object to adding code to
>>> OpenLDAP-devel to set LDAP_ERROR_NUMBER.
>>
>>It is not setting, it is clearing a prior error code.
>
>I see. Then the caller (sendmail) should clear the error code
>before making the call. The API is only allowed to set LDAP_ERROR_NUMBER
>with the server provided resultCode or an code reserved for API use.
>It's not allowed set the session LDAP_ERROR_NUMBER to LDAP_SUCCESS.
>
>Sounds more and more like an IETF LDAPext WG issue.
s/LDAP_ERROR_NUMBER/LDAP_OPT_ERROR_NUMBER/
In addition:
We should verify LDAP_OPT_ERROR_NUMBER is set with the resultCode
from a response message OR, upon API error, to a value reserved
for API use. There may be cases in the code where the API
inadvertly clears LDAP_OPT_ERROR_NUMBER.
In particular:
ec = ldap_xxxx();
ldap->ld_errno = ec;
return ec;
constructs are broken. ldap_xxxx should set ld_errno if an error
occurred, so:
ec = ldap_xxxx();
return ec;
should be sufficient. If ldap_xxxx doesn't act upon a session
handle then the code should be:
ec = ldap_xxxx();
if( ec != LDAP_SUCCESS )
ldap->ld_errno = ec;
return ec;
Kurt