The following calls are used to extract information from results and handle errors returned by other LDAP API routines.
int ldap_parse_result(
LDAP *ld,
LDAPMessage *res,
int *errcodep,
char **matcheddnp,
char **errmsgp,
char ***referralsp,
LDAPControl ***serverctrlsp,
int freeit
);
int ldap_parse_sasl_bind_result(
LDAP *ld,
LDAPMessage *res,
struct berval **servercredp,
int freeit
);
int ldap_parse_extended_result(
LDAP *ld,
LDAPMessage *res,
char **resultoidp,
struct berval **resultdata,
int freeit
);
char *ldap_err2string( int err );
The use of the following routines is deprecated.
int ldap_result2error(
LDAP *ld,
LDAPMessage *res,
int freeit
);
void ldap_perror( LDAP *ld, char *msg );
Parameters are:
Additional parameters for the deprecated routines are not described. Interested readers are referred to RFC 1823.
All of the ldap_parse_*_result() routines skip over messages of type LDAP_RES_SEARCH_ENTRY and LDAP_RES_SEARCH_REFERENCE when looking for a result message to parse. They return the constant LDAP_SUCCESS if the result was successfully parsed and another LDAP error code if not. Note that the LDAP error code that indicates the outcome of the operation performed by the server is placed in the errcodep ldap_parse_result() parameter.
ldap_err2string() is used to convert a numeric LDAP error code, as returned by one of the ldap_parse_*_result() routines, or one of the synchronous API operation calls, into an informative NULL-terminated character string message describing the error. It returns a pointer to static data.