- for ( i = 0, lsc = lc->conns; !META_LAST(lsc); ++i, ++lsc ) {
- struct berval mdn = BER_BVNULL;
- struct berval mapped_attr = op->oq_compare.rs_ava->aa_desc->ad_cname;
- struct berval mapped_value = op->oq_compare.rs_ava->aa_value;
-
- if ( lsc->candidate != META_CANDIDATE ) {
- msgid[ i ] = -1;
- continue;
- }
-
- /*
- * Rewrite the compare dn, if needed
- */
- dc.rwmap = &li->targets[ i ]->rwmap;
-
- switch ( ldap_back_dn_massage( &dc, &op->o_req_dn, &mdn ) ) {
- case LDAP_UNWILLING_TO_PERFORM:
- rc = 1;
- goto finish;
-
- default:
- break;
- }
-
- /*
- * if attr is objectClass, try to remap the value
- */
- if ( op->oq_compare.rs_ava->aa_desc == slap_schema.si_ad_objectClass ) {
- ldap_back_map( &li->targets[ i ]->rwmap.rwm_oc,
- &op->oq_compare.rs_ava->aa_value,
- &mapped_value, BACKLDAP_MAP );
-
- if ( mapped_value.bv_val == NULL || mapped_value.bv_val[0] == '\0' ) {
- continue;
- }
- /*
- * else try to remap the attribute
- */
- } else {
- ldap_back_map( &li->targets[ i ]->rwmap.rwm_at,
- &op->oq_compare.rs_ava->aa_desc->ad_cname,
- &mapped_attr, BACKLDAP_MAP );
- if ( mapped_attr.bv_val == NULL || mapped_attr.bv_val[0] == '\0' ) {
- continue;
- }
-
- if ( op->oq_compare.rs_ava->aa_desc->ad_type->sat_syntax == slap_schema.si_syn_distinguishedName )
- {
- dc.ctx = "compareAttrDN";
-
- switch ( ldap_back_dn_massage( &dc, &op->oq_compare.rs_ava->aa_value, &mapped_value ) )
- {
- case LDAP_UNWILLING_TO_PERFORM:
- rc = 1;
- goto finish;
-
- default:
- break;
- }
- }
- }
-
- /*
- * the compare op is spawned across the targets and the first
- * that returns determines the result; a constraint on unicity
- * of the result ought to be enforced
- */
- msgid[ i ] = ldap_compare( lc->conns[ i ].ld, mdn.bv_val,
- mapped_attr.bv_val, mapped_value.bv_val );
-
- if ( mdn.bv_val != op->o_req_dn.bv_val ) {
- free( mdn.bv_val );
- mdn.bv_val = NULL;
- }
-
- if ( mapped_attr.bv_val != op->oq_compare.rs_ava->aa_desc->ad_cname.bv_val ) {
- free( mapped_attr.bv_val );
- }