Synchronously determines whether a specified entry contains a specified attribute value.
#include <ldap.h>
int ldap_compare_s (
LDAP *ld,
const char *dn,
const char *attr,
const char *value);
(IN) Points to the handle for the LDAP session.
(IN) Points to the distinguished name of the entry whose attribute is being compared.
(IN) Points to the name of the attribute to compare.
(IN) Points to a string value of the attribute to compare.
|
0x05 |
LDAP_COMPARE_FALSE: the entry does not contain the attribute value. |
|
0x06 |
LDAP_COMPARE_TRUE: the entry contains the attribute value |
|
Non-zero value other than 0x05 or 0x06 |
Failure. For a complete list, see |
|
0x53 |
LDAP_ENCODING_ERROR |
|
0x5A |
LDAP_NO_MEMORY |
The ldap_compare_s function takes the attribute and its value and compares them to those found in the specified entry (dn).
The ldap_compare_s function is an older function. LDAP v3 clients should use the ldap_compare_ext_s function.
This function can compare only attributes with string values. Use ldap_compare_ext_s to compare binary values.
Compare operations are faster than search operations. Whenever possible in your application, use a compare rather than a search operation.