/* $OpenLDAP$ */
/*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/* Portions
* attr and value) are supplied. The msgid of the response is returned.
*
* Example:
- * struct berval bvalue = { "secret", strlen("secret") };
+ * struct berval bvalue = { "secret", sizeof("secret")-1 };
* rc = ldap_compare( ld, "c=us@cn=bob",
* "userPassword", &bvalue,
* sctrl, cctrl, &msgid )
LDAPControl **cctrls,
int *msgidp )
{
+ int rc;
BerElement *ber;
Debug( LDAP_DEBUG_TRACE, "ldap_compare\n", 0, 0, 0 );
assert( attr != NULL );
assert( msgidp != NULL );
+ /* check client controls */
+ rc = ldap_int_client_controls( ld, cctrls );
+ if( rc != LDAP_SUCCESS ) return rc;
+
/* create a message to send */
if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
return( LDAP_NO_MEMORY );
}
- if ( ber_printf( ber, "{it{s{sO}}", /* '}' */
+ if ( ber_printf( ber, "{it{s{sON}N}", /* '}' */
++ld->ld_msgid,
- LDAP_REQ_COMPARE, dn, attr, &bvalue ) == -1 )
+ LDAP_REQ_COMPARE, dn, attr, bvalue ) == -1 )
{
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );
return ld->ld_errno;
}
- if( ber_printf( ber, /*{*/ "}" ) == -1 ) {
+ if( ber_printf( ber, /*{*/ "N}" ) == -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );
return( ld->ld_errno );