Synchronously determines whether a specified entry contains a specified attribute value. LDAP client or server controls can be used with the compare.
#include <ldap.h>
int ldap_compare_ext_s (
LDAP *ld,
const char *dn,
const char *attr,
const struct berval *bvalue,
LDAPControl **serverctrls,
LDAPControl **clientctrls);
(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 berval structure that contains the attribute's value to compare with the entry's attribute value.
(IN) Points to an array of LDAPControl structures that list the server controls to use with the search. Use NULL to specify no server controls.
(IN) Points to an array of LDAPControl structures that list the client controls to use with the search. Use NULL to specify no client controls.
|
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 |
This function compares the specified value with the values in the entry's attribute and returns whether a match is found.
The ldap_compare_ext_s function can be used to compare any type of data. For string data, you can use ldap_compare_s.
Compare operations are faster than search operations. Whenever possible in your application, use a compare rather than a search operation.
eDirectory does not currently support any server controls to use with compare operations.
For sample code, see cpattrs.c.