ldap_result2error

Converts the result message into a numeric LDAP error code. This function has been deprecated. Use the ldap_parse_result function.

LDAP Version:v2 or higher
Library:*ldapsdk.*
NDS Version:7.xx or higher
Platform:NLM, Windows (NT, 95, 98, 2000, XP, Vista 32-bit and 64-bit ), Linux (32-bit and 64-bit), Solaris, AIX, and HP-UX

Syntax

  #include <ldap.h>
  
  int ldap_result2error (
     LDAP          *ld,
     LDAPMessage   *res,
     int            freeit);
  
  

Parameters

ld

(IN) Points to the handle for the LDAP session.

res

(IN) Points to an LDAPMessage containing the results of an ldap_result or ldap_search_s operation.

freeit

(IN) Specifies whether the resources allocated by the res parameter are freed.

  • Zero indicates that the resources used by the res parameter are not freed automatically. When you are done with the res parameter, you need to call the ldap_msgfree function to free the memory.

  • Non-zero indicates that memory is freed after the function extracts the information

Return Values

>0

LDAP error code. See LDAP Return Codes.

Remarks

The ldap_result2error function does the following:

  • Converts the result message into a numeric LDAP error code.

  • Parses the result message and puts the matched distinguished name in the LDAP_OPT_MATCHED_DN option of the LDAP session handle.

  • Parses the result message and puts the error code in the LDAP_OPT_ERROR_STRING option of the LDAP session handle.

All synchronous operation routines call the ldap_result2error function before returning, ensuring that the options are set correctly.

See Also

ldap_parse_result, ldap_parse_extended_result, ldap_perror