---
name: "ldap_perror"
section: "3"
platform: "linux"
package: "libldap"
version: "2.7.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ldap_error"
---

# ldap\_perror(3)

LDAP protocol error handling routines

Part of [ldap\_error(3)](/ldap_error/3.md).

## NAME

ldap\_perror, ld\_errno, ldap\_result2error, ldap\_errlist, ldap\_err2string - LDAP protocol error handling routines

## LIBRARY

OpenLDAP LDAP (libldap, -lldap)

## SYNOPSIS

```
#include <ldap.h>
```

**char \*ldap\_err2string( int** *err* **);**

## DESCRIPTION

**The** **ldap\_err2string()** **routine provides short description of the various codes returned by** **routines in this library.  The returned string is a pointer to a** **static area that should not be modified.**

**These codes are either negative,** **indicating an API error code; positive, indicating an LDAP resultCode** **other than ´success' (0), or - zero, indicating both successful use** **of the API and the LDAP resultCode ´success' (0).**

**The code associated with an LDAP session is accessible using** [**ldap\_get\_option**(3)](/ldap_get_option/3.md) **and** [**ldap\_set\_option**(3)](/ldap_set_option/3.md) **with the** **LDAP\_OPT\_RESULT\_CODE** **option (previously called** **LDAP\_OPT\_ERROR\_NUMBER**).

## PROTOCOL RESULT CODES

**This section provides a partial list of protocol codes recognized** **by the library.  As LDAP is extensible, additional values may be** **returned.  A complete listing of** *registered* **LDAP result codes** **can be obtained from the** *Internet Assigned Numbers Authority* **\<http://www.iana.org\>.**

- 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

  **Partial results only 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

  **Filter type not supported for the specified attribute.**

- LDAP\_CONSTRAINT\_VIOLATION

  **An attribute value specified violates some constraint (e.g., 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 (e.g., LDAP\_AUTH\_SIMPLE was** **specified and the entry does not have a userPassword attribute).**

- LDAP\_INVALID\_CREDENTIALS

  **Invalid credentials were presented (e.g., 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 (e.g., 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.**

## API ERROR CODES

**This section provides a complete list of API error codes recognized** **by the library.   Note that LDAP\_SUCCESS indicates success of an** **API call in addition to representing the return of the LDAP** **´success' resultCode.**

- LDAP\_SERVER\_DOWN

  **The LDAP library can't contact the LDAP server.**

- LDAP\_LOCAL\_ERROR

  **Some local error occurred.  This is usually a failed dynamic memory allocation.**

- 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 timelimit was exceeded while waiting for a result.**

- LDAP\_AUTH\_UNKNOWN

  **The authentication method specified to ldap\_bind() is not known.**

- LDAP\_FILTER\_ERROR

  **An invalid filter was supplied to ldap\_search() (e.g., unbalanced** **parentheses).**

- LDAP\_PARAM\_ERROR

  **An ldap routine was called with a bad parameter.**

- LDAP\_NO\_MEMORY

  **An memory allocation (e.g., [malloc(3)](/malloc/3.md) or other dynamic memory** **allocator) call failed in an ldap library routine.**

- LDAP\_USER\_CANCELED

  **Indicates the user cancelled the operation.**

- LDAP\_CONNECT\_ERROR

  **Indicates a connection problem.**

- LDAP\_NOT\_SUPPORTED

  **Indicates the routine was called in a manner not supported by the library.**

- LDAP\_CONTROL\_NOT\_FOUND

  **Indicates the control provided is unknown to the client library.**

- LDAP\_NO\_RESULTS\_RETURNED

  **Indicates no results returned.**

- LDAP\_MORE\_RESULTS\_TO\_RETURN

  **Indicates more results could be returned.**

- LDAP\_CLIENT\_LOOP

  **Indicates the library has detected a loop in its processing.**

- LDAP\_REFERRAL\_LIMIT\_EXCEEDED

  **Indicates the referral limit has been exceeded.**

## DEPRECATED

**Deprecated interfaces generally remain in the library.  The macro** **LDAP\_DEPRECATED can be defined to a non-zero value** **(e.g., -DLDAP\_DEPRECATED=1) when compiling program designed to use** **deprecated interfaces.  It is recommended that developers writing new** **programs, or updating old programs, avoid use of deprecated interfaces.** **Over time, it is expected that documentation (and, eventually, support) for** **deprecated interfaces to be eliminated.**

## SEE ALSO

[**ldap**(3)](/ldap/3.md),

## ACKNOWLEDGEMENTS

**OpenLDAP Software** **is developed and maintained by The OpenLDAP Project \<http://www.openldap.org/\>.** **OpenLDAP Software** **is derived from the University of Michigan LDAP 3.3 Release.**
