ldap_perror(3ldap)


ldap_perror, ldap_result2error, ldap_errlist, ldap_err2string -- LDAP protocol error handling routines

Synopsis

#include <lber.h> 
#include <ldap.h> 

struct ldaperror { int e_code; char *e_reason; };

void ldap_perror(LDAP *ld, char *s);

int ldap_result2error(LDAP *ld, LDAPMessage *res, int freeit);

struct ldaperror ldap_errlist[];

char *ldap_err2string(int err);

Description

These routines provide interpretation of the various error codes returned by the LDAP protocol and LDAP library routines, and assigned to the ld_errno field in the ld structure.

The ldap_result2error routine takes res, a result as produced by ldap_result(3ldap) or ldap_search_s(3ldap), and returns the corresponding error code. Possible error codes are listed below. If the freeit parameter is non-zero it indicates that the res parameter should be freed by a call to ldap_msgfree(3ldap) after the error code has been extracted. The ld_errno field in ld is set and returned.

The returned value can be passed to ldap_err2string or looked up in ldap_errlist to get a text description of the message. The string returned from ldap_err2string is a pointer to a static area that should not be modified. The last element in the ldap_errlist array is signaled by an error code of -1.

The ldap_perror routine can be called to print an indication of the error on standard error, similar to the way perror(3C) works.

Return values

The possible values for an LDAP error code are:

See also

Intro(3ldap), perror(3C)
30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.