Export (0) Print
Expand All
Expand Minimize

ldap_compare function

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

Syntax


ULONG ldap_compare(
  _In_  LDAP *ld,
  _In_  PCHAR dn,
  _In_  PCHAR attr,
  _In_  PCHAR value
);

Parameters

ld [in]

The session handle.

dn [in]

A pointer to a null-terminated string that contains the distinguished name of the entry.

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 compare to the attribute value.

Return value

If the function succeeds, the message ID of the compare operation is returned.

If the function fails, it returns –1 and sets the session error parameters in the LDAP structure. This error can then be retrieved using LdapGetLastError.

Remarks

The ldap_compare function initiates an asynchronous compare operation, comparing the value of an attribute to a known string value. Use ldap_compare_ext or ldap_compare_ext_s to compare binary values. Use ldap_compare_s or ldap_compare_ext_s to perform a synchronous compare operation.

As an asynchronous function, ldap_compare returns a message ID for the operation. Call ldap_result with the message ID to get the result of the operation. To cancel an asynchronous operation before it has been completed, call ldap_abandon.

To have the function return the results directly, use the synchronous routine ldap_compare_s. Use ldap_compare_ext or ldap_compare_ext_s to enable support for LDAP 3 server and client controls.

Multithreading: Calls to ldap_compare are thread-safe, provided that LdapGetLastError is used to get the actual session error code when the function call returns the -1 failure code.

Note  When connecting to an LDAP 2 server, the application must perform a bind operation, by calling one of the ldap_bind or ldap_simple_bind routines, before attempting other operations.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winldap.h

Library

Wldap32.lib

DLL

Wldap32.dll

Unicode and ANSI names

ldap_compareW (Unicode) and ldap_compareA (ANSI)

See also

Functions
ldap_abandon
ldap_bind
ldap_compare_ext
ldap_compare_ext_s
ldap_compare_s
ldap_result
ldap_simple_bind

 

 

Show:
© 2014 Microsoft