+ send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
+ "operation not supported within namingContext" );
+ }
+
+#if defined( LDAP_SLAPI )
+ if ( pb && doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_COMPARE_FN, pb ) < 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO, "do_compare: compare postoperation plugins "
+ "failed\n", 0, 0, 0 );
+#else
+ Debug(LDAP_DEBUG_TRACE, "do_compare: compare postoperation plugins "
+ "failed.\n", 0, 0, 0);
+#endif
+ }
+#endif /* defined( LDAP_SLAPI ) */
+
+cleanup:
+ op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
+ op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
+ if ( ava.aa_value.bv_val ) op->o_tmpfree( ava.aa_value.bv_val, op->o_tmpmemctx );
+
+ return rs->sr_err;
+}
+
+static int compare_entry(
+ Operation *op,
+ Entry *e,
+ AttributeAssertion *ava )
+{
+ int rc = LDAP_NO_SUCH_ATTRIBUTE;
+ Attribute *a;
+
+ if ( ! access_allowed( op, e,
+ ava->aa_desc, &ava->aa_value, ACL_COMPARE, NULL ) )
+ {
+ return LDAP_INSUFFICIENT_ACCESS;
+ }
+
+ for(a = attrs_find( e->e_attrs, ava->aa_desc );
+ a != NULL;
+ a = attrs_find( a->a_next, ava->aa_desc ))
+ {
+ rc = LDAP_COMPARE_FALSE;
+
+ if ( value_find_ex( ava->aa_desc,
+ SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
+ SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
+ a->a_nvals,
+ &ava->aa_value, op->o_tmpmemctx ) == 0 )
+ {
+ rc = LDAP_COMPARE_TRUE;
+ break;
+ }