ldap_compare

Asynchronously determines whether a specified entry contains a specified attribute value.

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_compare (
     LDAP         *ld,
     const char   *dn,
     const char   *attr,
     const char   *value);
  
  

Parameters

ld

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

dn

(IN) Points to the distinguished name of the entry whose attribute is being compared.

attr

(IN) Points to the name of the attribute to compare.

value

(IN) Points to a string value of the attribute to compare.

Return Values

>0

Message ID of operation

-1

Failure

Remarks

This function compares the specified value with the values in the entry's attribute. The results specify whether a match is found.

The ldap_compare function is an older function. LDAP v3 clients should use the ldap_compare_ext function.

The ldap_compare function can compare only attributes with string values. Use ldap_compare_ext to compare binary values.

To obtain the results of the operation, call the ldap_result function with the returned message ID.

Compare operations are faster than search operations. Whenever possible in your application, use a compare rather than a search operation.

See Also

ldap_compare_ext