Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function determines whether an attribute for a given entry holds a known value.

Syntax

ULONG ldap_compare_s(
  LDAP* 
ld,
  UNICODE PTCHAR 
dn,
  UNICODE PTCHAR 
attr,
  UNICODE PTCHAR 
value
);

Parameters

ld

[in] Session handle.

dn

[in] Distinguished name of the entry.

attr

[in] Attribute to compare.

value

[in] String attribute value to compare to the attribute value.

Return Value

If this 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 this function fails, it returns an error code. See the LDAP_RETCODEenumeration for a list of possible return values.

Remarks

This function initiates a synchronous compare operation, comparing the value of an attribute to a known string value. Use the ldap_compare_ext_sfunction if you need to compare binary values. Use ldap_compareor ldap_compare_extto carry out an asynchronous compare operation.

In a multithreading environment, calls to ldap_compare_sare thread-safe.

When connecting to an LDAP 2 server, the application must perform a bind operation, (by calling one of the ldap_bindor ldap_simple_bindroutines) before attempting any other operations.

Requirements

Header winldap.h
Library wldap32.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also