man pages section 3: Networking Library Functions

Exit Print View

Updated: July 2014
 
 

ldap_result2error(3LDAP)

Name

ldap_error, ldap_err2string, ldap_perror, ldap_result2error - LDAP protocol error handling functions

Synopsis

cc[ flag... ] file... -lldap[ library... ]
#include <lber.h>
#include <ldap.h>

char *ldap_err2string(int err);
void ldap_perror(LDAP *ld, const char *s);
int ldap_result2error(LDAP *ld, LDAPMessage *res, int freeit);

Description

These functions interpret the error codes that are returned by the LDAP API routines. The ldap_perror() and ldap_result2error() functions are deprecated for all new development. Use ldap_err2string() instead.

You can also use ldap_parse_sasl_bind_result(3LDAP), ldap_parse_extended_result(3LDAP), and ldap_parse_result(3LDAP) to provide error handling and interpret error codes returned by LDAP API functions.

The ldap_err2string() function takes err, a numeric LDAP error code, returned either by ldap_parse_result(3LDAP) or another LDAP API call. It returns an informative, null-terminated, character string that describes the error.

The ldap_result2error() function takes res, a result produced by ldap_result(3LDAP) or other synchronous LDAP calls, and returns the corresponding error code. If the freeit parameter is non-zero, it indicates that the res parameter should be freed by a call to ldap_result(3LDAP) after the error code has been extracted.

Similar to the way perror(3C) works, the ldap_perror() function can be called to print an indication of the error to standard error.

Errors

The possible values for an LDAP error code are:

LDAP_SUCCESS

The request was successful.

LDAP_OPERATIONS_ERROR

An operations error occurred.

LDAP_PROTOCOL_ERROR

A protocol violation was detected.

LDAP_TIMELIMIT_EXCEEDED

An LDAP time limit was exceeded.

LDAP_SIZELIMIT_EXCEEDED

An LDAP size limit was exceeded.

LDAP_COMPARE_FALSE

A compare operation returned false.

LDAP_COMPARE_TRUE

A compare operation returned true.

LDAP_STRONG_AUTH_NOT_SUPPORTED

The LDAP server does not support strong authentication.

LDAP_STRONG_AUTH_REQUIRED

Strong authentication is required for the operation.

LDAP_PARTIAL_RESULTS

Only partial results are returned.

LDAP_NO_SUCH_ATTRIBUTE

The attribute type specified does not exist in the entry.

LDAP_UNDEFINED_TYPE

The attribute type specified is invalid.

LDAP_INAPPROPRIATE_MATCHING

The filter type is not supported for the specified attribute.

LDAP_CONSTRAINT_VIOLATION

An attribute value specified violates some constraint. For example, a postalAddress has too many lines, or a line that is too long.

LDAP_TYPE_OR_VALUE_EXISTS

An attribute type or attribute value specified already exists in the entry.

LDAP_INVALID_SYNTAX

An invalid attribute value was specified.

LDAP_NO_SUCH_OBJECT

The specified object does not exist in the directory.

LDAP_ALIAS_PROBLEM

An alias in the directory points to a nonexistent entry.

LDAP_INVALID_DN_SYNTAX

A syntactically invalid DN was specified.

LDAP_IS_LEAF

The object specified is a leaf.

LDAP_ALIAS_DEREF_PROBLEM

A problem was encountered when dereferencing an alias.

LDAP_INAPPROPRIATE_AUTH

Inappropriate authentication was specified. For example, LDAP_AUTH_SIMPLE was specified and the entry does not have a userPassword attribute.

LDAP_INVALID_CREDENTIALS

Invalid credentials were presented, for example, the wrong password.

LDAP_INSUFFICIENT_ACCESS

The user has insufficient access to perform the operation.

LDAP_BUSY

The DSA is busy.

LDAP_UNAVAILABLE

The DSA is unavailable.

LDAP_UNWILLING_TO_PERFORM

The DSA is unwilling to perform the operation.

LDAP_LOOP_DETECT

A loop was detected.

LDAP_NAMING_VIOLATION

A naming violation occurred.

LDAP_OBJECT_CLASS_VIOLATION

An object class violation occurred. For example, a must attribute was missing from the entry.

LDAP_NOT_ALLOWED_ON_NONLEAF

The operation is not allowed on a nonleaf object.

LDAP_NOT_ALLOWED_ON_RDN

The operation is not allowed on an RDN.

LDAP_ALREADY_EXISTS

The entry already exists.

LDAP_NO_OBJECT_CLASS_MODS

Object class modifications are not allowed.

LDAP_OTHER

An unknown error occurred.

LDAP_SERVER_DOWN

The LDAP library cannot contact the LDAP server.

LDAP_LOCAL_ERROR

Some local error occurred. This is usually the result of a failed malloc(3C) call or a failure to fflush(3C) the stdio stream to files, even when the LDAP requests were processed successfully by the remote server.

LDAP_ENCODING_ERROR

An error was encountered encoding parameters to send to the LDAP server.

LDAP_DECODING_ERROR

An error was encountered decoding a result from the LDAP server.

LDAP_TIMEOUT

A time limit was exceeded while waiting for a result.

LDAP_AUTH_UNKNOWN

The authentication method specified to ldap_bind(3LDAP) is not known.

LDAP_FILTER_ERROR

An invalid filter was supplied to ldap_search(3LDAP), for example, unbalanced parentheses.

LDAP_PARAM_ERROR

An LDAP function was called with a bad parameter, for example, a NULL ld pointer, and the like.

LDAP_NO_MEMORY

A memory allocation call failed in an LDAP library function, for example, malloc(3C).

LDAP_CONNECT_ERROR

The LDAP client has either lost its connetion to an LDAP server or it cannot establish a connection.

LDAP_NOT_SUPPORTED

The requested functionality is not supported., for example, when an LDAPv2 client requests some LDAPv3 functionality.

LDAP_CONTROL_NOT_FOUND

An LDAP client requested a control not found in the list of supported controls sent by the server.

LDAP_NO_RESULTS_RETURNED

The LDAP server sent no results.

LDAP_MORE_RESULTS_TO_RETURN

More results are chained in the message chain.

LDAP_CLIENT_LOOP

A loop has been detected, for example, when following referrals.

LDAP_REFERRAL_LIMIT_EXCEEDED

The referral exceeds the hop limit. The hop limit determines the number of servers that the client can hop through to retrieve data.

Attributes

See attributes(5) for a description of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
system/library
Interface Stability
Committed

See also

fflush(3C), ldap(3LDAP), ldap_bind(3LDAP), ldap_result(3LDAP), ldap_parse_extended_result(3LDAP), ldap_parse_result(3LDAP), ldap_parse_sasl_bind_result(3LDAP), ldap_search(3LDAP), malloc(3C), perror(3C) , attributes(5)