ldap_compare_s()--Perform an LDAP Compare Operation (Synchronous)




Syntax

#include <ldap.h>
 

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




Threadsafe: Yes

The ldap_compare_s() function is used to perform an LDAP compare operation. The API uses as input the distinguished name of the entry on which to perform the compare, and uses an attr and value (the attribute type and value to compare to those found in the entry).

Binary values are not supported by this API. ldap_compare_s() is synchronous request.

Authorities and Locks

No OS/400 authority is required. All authority checking is done by the LDAP server.

Parameters

ld
(Input) Specifies the LDAP pointer returned by a previous call to ldap_init(),ldap_ssl_init(), or ldap_open().

dn
(Input) Specifies the DN of the entry upon which to perform the compare.

attrs
(Input) Specifies the attribute type to use in the comparison.

value
(Input) Specifies the string attribute value to compare against the value in the entry.

Return Value

LDAP_COMPARE_TRUE
if the entry contains the attribute value.
LDAP_COMPARE_FALSE
if the entry does not contain the attribute value.
another LDAP error code
if the request was not successful.

Error Conditions

ldap_compare_s() will return LDAP error code if not successful. See LDAP Client API Error Conditions for possible LDAP error code values.

Error Messages

    The following message may be set from this function.
    CPF3CF2 E  Error(s) occurred during running of ldap_compare_s API.

Related Information

    ldap_compare() -- Asynchronous compare to a directory entry.
    ldap_compare_ext() -- Asynchronous compare to a directory entry with controls.
    ldap_compare_ext_s() -- Synchronous compare to a directory entry with controls.


Top | LDAP APIs List
APIs by category

[Information Center Home Page | Feedback ] [Legal | AS/400 Glossary]