LDAP_OPT_ERROR_STRING

Use the LDAP_OPT_ERROR_STRING setting to return a text message that is associated with the most recent LDAP error.

This setting is a read-only option. It returns the text message that is associated with the most recent LDAP error that occurred for the specified LDAP connection. For example:
char *error_string;
ldap_get_option( ld, LDAP_OPT_ERROR_STRING, &error_string);
Use ldap_memfree() to free the memory that is returned by the call to ldap_get_option().