LDAP_COMPARE(3)

NAME
ldap_compare, ldap_compare_s, ldap_compare_ext, ldap_compare_ext_s - Perform an LDAP compare operation.

LIBRARY
OpenLDAP LDAP (libldap, -lldap)

SYNOPSIS
#include <ldap.h>

int ldap_compare_s(ld, dn, attr, value)
LDAP *ld;
char *dn, *attr, *value;

int ldap_compare(ld, dn, attr, value)
LDAP *ld;
char *dn, *attr, *value;

int ldap_compare_ext(ld, dn, attr, bvalue, serverctrls, clientctrls, msgidp)
LDAP *ld;
char *dn, *attr;
const struct berval *bvalue;
LDAPControl **serverctrls, **clientctrls;
int *msgidp;

int ldap_compare_ext_s(ld, dn, attr, bvalue, serverctrls, clientctrls)
LDAP *ld;
char *dn, *attr;
const struct berval *bvalue;
LDAPControl **serverctrls, **clientctrls;

DESCRIPTION
The ldap_compare_s() routine is used to perform an LDAP compare operation synchronously. It takes dn, the DN of the entry upon which to perform the compare, and attr and value, the attribute type and value to compare to those found in the entry. It returns an LDAP error code, which will be LDAP_COMPARE_TRUE if the entry contains the attribute value and LDAP_COMPARE_FALSE if it does not. Otherwise, some error code is returned.

The ldap_compare() routine is used to perform an LDAP compare operation asynchronously. It takes the same parameters as ldap_compare_s(), but returns the message id of the request it initiated. The result of the compare can be obtained by a subsequent call to ldap_result(3).

The ldap_compare_ext() routine allows server and client controls to be specified to extend the compare request. This routine is asynchronous like ldap_compare(), but its return value is an LDAP error code. It stores the message id of the request in the integer pointed to by msgidp.

The ldap_compare_ext_s() routine is the synchronous version of ldap_compare_ext(). It also returns an LDAP error code indicating success or failure of the operation.

ERRORS
ldap_compare_s() returns an LDAP error code which can be interpreted by calling one of ldap_perror(3) and friends. ldap_compare() returns -1 if something went wrong initiating the request. It returns the non-negative message id of the request if things went ok.

ldap_compare_ext_s() and ldap_compare_ext() return some Non-zero value other than 0x05 or 0x06 in case of failure. 0x05 corresponds to LDAP_COMPARE_FALSE and 0x06 corresponds to LDAP_COMPARE_TRUE.

BUGS
There is no way to compare binary values, but there should be.

SEE ALSO
ldap(3), ldap_error(3)

ACKNOWLEDGEMENTS
OpenLDAP is developed and maintained by The OpenLDAP Project (http://www.openldap.org/). OpenLDAP is derived from University of Michigan LDAP 3.3 Release.