Platform SDK: Active Directory, ADSI, and Directory Services

ldap_compare_ext_s

Use the ldap_compare_ext_s function to determine whether an attribute for a given entry holds a known value.

ULONG ldap_compare_ext_s(
  LDAP* ld,
  PCHAR dn,
  PCHAR Attr,
  PCHAR Value, 
  struct berval* Data,
  PLDAPControl* ServerControls,
  PLDAPControl* ClientControls
);

Parameters

ld
[in] The session handle.
dn
[in] The distinguished name of the entry to compare.
Attr
[in] The attribute to compare.
Value
[in] The string attribute value to be compared to the attribute value. If not null, the data must be null.
Data
[in] The berval attribute value to be compared to the attribute value. If not null, the value must be null.
ServerControls
[in] A list of LDAP server controls.
ClientControls
[in] A list of LDAP client controls.

Return Values

If the function succeeds, and the attribute and known values match, the return value is LDAP_COMPARE_TRUE; if the values do not match, the return value is LDAP_COMPARE_FALSE.

If the function fails, it returns an error code. See Return Values for more information.

Remarks

The ldap_compare_ext_s function initiates a synchronous compare operation, comparing the value of an attribute to a known value. The parameters and effects of ldap_compare_ext_s subsume those of ldap_compare_s. The extended routine includes additional parameters to support client and server controls, and comparison of binary values.

Use the Value parameter for comparing string values or use the Data parameter for comparing raw binary data. Set the unused parameter to NULL. If neither parameter is NULL, the compare operation will use the value in the Data parameter.

Multithreading: Calls to ldap_compare_ext_s are thread-safe.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 SP4 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Winldap.h.
  Library: Use Wldap32.lib.
  Unicode: Declared as Unicode and ANSI prototypes.

See Also

berval, Functions, ldap_compare_s, Return Values