1 /* compare.c - ldap backend compare function */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2003-2006 The OpenLDAP Foundation.
6 * Portions Copyright 1999-2003 Howard Chu.
7 * Portions Copyright 2000-2003 Pierangelo Masarati.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted only as authorized by the OpenLDAP
14 * A copy of this license is available in the file LICENSE in the
15 * top-level directory of the distribution or, alternatively, at
16 * <http://www.OpenLDAP.org/license.html>.
19 * This work was initially developed by the Howard Chu for inclusion
20 * in OpenLDAP Software and subsequently enhanced by Pierangelo
28 #include <ac/string.h>
29 #include <ac/socket.h>
32 #include "back-ldap.h"
39 ldapinfo_t *li = (ldapinfo_t *)op->o_bd->be_private;
43 ldap_back_send_t retrying = LDAP_BACK_RETRYING;
44 LDAPControl **ctrls = NULL;
45 int rc = LDAP_SUCCESS;
47 lc = ldap_back_getconn( op, rs, LDAP_BACK_SENDERR );
48 if ( !lc || !ldap_back_dobind( lc, op, rs, LDAP_BACK_SENDERR ) ) {
54 rc = ldap_back_proxy_authz_ctrl( &lc->lc_bound_ndn,
55 li->li_version, &li->li_idassert, op, rs, &ctrls );
56 if ( rc != LDAP_SUCCESS ) {
57 send_ldap_result( op, rs );
62 rs->sr_err = ldap_compare_ext( lc->lc_ld, op->o_req_dn.bv_val,
63 op->orc_ava->aa_desc->ad_cname.bv_val,
64 &op->orc_ava->aa_value,
65 ctrls, NULL, &msgid );
66 rc = ldap_back_op_result( lc, op, rs, msgid, 0,
67 ( LDAP_BACK_SENDRESULT | retrying ) );
68 if ( rc == LDAP_UNAVAILABLE && retrying ) {
69 retrying &= ~LDAP_BACK_RETRYING;
70 if ( ldap_back_retry( &lc, op, rs, LDAP_BACK_SENDERR ) ) {
76 (void)ldap_back_proxy_authz_ctrl_free( op, &ctrls );
79 ldap_back_release_conn( op, rs, lc );