Directory Services

ldap_compare_ext_s

Use the ldap_compare_ext_s function to determine if 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] A pointer to a null-terminated string that contains the distinguished name of the entry to compare.
Attr
[in] A pointer to a null-terminated string that contains the attribute to compare.
Value
[in] A pointer to a null-terminated string that contains the string attribute value to be compared to the attribute value. Set to NULL if not used.
Data
[in] The berval attribute value to be compared to the attribute value. Set to NULL if not used.
ServerControls
[in] Optional. A list of LDAP server controls. Set to NULL if not used.
ClientControls
[in] Optional. A list of LDAP client controls. Set to NULL if not used.

Return Values

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

If the function fails, an error code is returned. For more information, see Return Values.

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

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Unicode: Implemented as Unicode and ANSI versions on all platforms.
Header: Declared in Winldap.h.
Library: Use Wldap32.lib.

See Also

Extended Controls, Using Controls, Functions, berval, ldap_compare_s, Return Values