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

Re: LDAP C API: ber_* error handling



I agree with Kurt that ber_scanf() is deficient and needs to return specific
errors.  Otherwise the Mozilla LDAP library cannot be fixed to recover from
transient out-of-memory errors.  I think that the spec should either let it
return additional error codes, or add an extended version that does.

Within the current API design, there is room for additional error codes in
the form of bogus tag values such that:

(( tag & 0x00000080 ) != 0 ) && (( tag & 0xFFFFFF00 ) != 0 )

For example:

#define LBER_DECODE_ERR    0xFFFFFFFF   /* same as current LBER_ERROR */
#define LBER_NO_MEMORY    0xFFFFFFFE

I don't think that this change would break the Mozilla library, but how
about other software that uses liblber?

Or, how about a version of ber_scanf() that returns an error separately than
the tag:

int ber_scanf_v2(BerElement *ber, unsigned long *tagpt, char *fmt, ... )


----- Original Message -----
From: Kurt D. Zeilenga <Kurt@OpenLDAP.Org>
To: <ietf-ldapext@netscape.com>
Sent: Monday, June 14, 1999 2:03 PM
Subject: LDAP C API: ber_* error handling


> How does an application determine the type of error resulting
> from a failed ber_ API call?
>
> In particular, how does the application determine if a ber_scanf
> call failed due to no available memory versus a decoding error?
>
> Can an application use ldap_get_option(NULL,LDAP_OPT_ERROR_NUMBER,&err)
> to get BER errors?
>
> I believe some clarification in this area would be wise
> (even if that clarification was "obtaining the cause of failed
> ber_* calls is implementation specific").
>
> Kurt
>
>