Table of Contents | Previous | Next | Index

Netscape Directory SDK 3.0 for C Programmer’s Guide
     Chapter 18 Functions

ldap_compare()

Asynchronously determines if an attribute of an entry contains a specified value.

Note that this is an older function that is included in the LDAP API for backward-compatibility. If you are writing a new LDAP client, use ldap_compare_ext() instead.

Syntax

#include <ldap.h>
int ldap_compare( LDAP *ld, const char *dn, const char *attr,
   const char *value );

Parameters

This function has the following parameters:

ld

Connection handle, which is a pointer to an LDAP structure containing information about the connection to the LDAP server.

dn

Distinguished name (DN) of the entry used in the comparison.

attr

Attribute type that you want to check the value against.

value

Value that you want to compare against the attribute values.

Returns

Returns the message ID of the ldap_compare() operation. To check the result of this operation, call ldap_result() and ldap_result2error(). For a list of possible return codes for the LDAP compare operation, see the result code documentation for the ldap_compare_ext_s() function.

Description

The ldap_compare() function compares a value with the value of an attribute in an entry.

A newer version of this function, ldap_compare_ext(), is available in this release of the LDAP API. ldap_compare() (the older version of the function) is included only for backward-compatibility. If you are writing a new LDAP client, use ldap_compare_ext() instead of ldap_compare().

If you want more information on ldap_compare(), refer to the LDAP C SDK 1.0 Programmer's Guide.

Example

The following section of code checks to see if Barbara Jensen has the e-mail address "bjensen@airius.com".

#include <stdio.h>
#include <ldap.h>
...
LDAP *ld;
char *dn = "uid=bjensen, ou=People, o=Airius.com";
int msgid;
...
msg_id = ldap_compare( ld, dn, "mail", "bjensen@airius.com" );
...

See Also

ldap_compare_ext().


Table of Contents | Previous | Next | Index

Last Updated: 10/01/98 17:06:23