]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-sql/compare.c
Merge remote branch 'origin/mdb.master' into OPENLDAP_REL_ENG_2_4
[openldap] / servers / slapd / back-sql / compare.c
index bc5d166c3dcba7fc01c1ed005551a0d3e096ec93..7d9a55bc7883869c3a5e1846c9e7b0300f2ae56e 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1999-2005 The OpenLDAP Foundation.
+ * Copyright 1999-2012 The OpenLDAP Foundation.
  * Portions Copyright 1999 Dmitry Kovalev.
  * Portions Copyright 2002 Pierangelo Masarati.
  * All rights reserved.
@@ -42,7 +42,7 @@ backsql_compare( Operation *op, SlapReply *rs )
        Debug( LDAP_DEBUG_TRACE, "==>backsql_compare()\n", 0, 0, 0 );
 
        rs->sr_err = backsql_get_db_conn( op, &dbh );
-       if ( !dbh ) {
+       if ( rs->sr_err != LDAP_SUCCESS ) {
                Debug( LDAP_DEBUG_TRACE, "backsql_compare(): "
                        "could not get connection handle - exiting\n",
                        0, 0, 0 );
@@ -98,7 +98,7 @@ backsql_compare( Operation *op, SlapReply *rs )
        }
 
        if ( is_at_operational( op->oq_compare.rs_ava->aa_desc->ad_type ) ) {
-               SlapReply       nrs = { 0 };
+               SlapReply       nrs = { REP_SEARCH };
                Attribute       **ap;
 
                for ( ap = &e.e_attrs; *ap; ap = &(*ap)->a_next )
@@ -131,11 +131,10 @@ backsql_compare( Operation *op, SlapReply *rs )
                        a = attrs_find( a->a_next, op->oq_compare.rs_ava->aa_desc ) )
        {
                rs->sr_err = LDAP_COMPARE_FALSE;
-               if ( value_find_ex( op->oq_compare.rs_ava->aa_desc,
+               if ( attr_valfind( a,
                                        SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
                                        SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
-                                       a->a_nvals,
-                                       &op->oq_compare.rs_ava->aa_value,
+                                       &op->oq_compare.rs_ava->aa_value, NULL,
                                        op->o_tmpmemctx ) == 0 )
                {
                        rs->sr_err = LDAP_COMPARE_TRUE;
@@ -150,7 +149,6 @@ return_results:;
                break;
 
        default:
-#ifdef SLAP_ACL_HONOR_DISCLOSE
                if ( !BER_BVISNULL( &e.e_nname ) &&
                                ! access_allowed( op, &e,
                                        slap_schema.si_ad_entry, NULL,
@@ -159,7 +157,6 @@ return_results:;
                        rs->sr_err = LDAP_NO_SUCH_OBJECT;
                        rs->sr_text = NULL;
                }
-#endif /* SLAP_ACL_HONOR_DISCLOSE */
                break;
        }
 
@@ -175,7 +172,7 @@ return_results:;
        }
 
        if ( !BER_BVISNULL( &bsi.bsi_base_id.eid_ndn ) ) {
-               (void)backsql_free_entryID( op, &bsi.bsi_base_id, 0 );
+               (void)backsql_free_entryID( &bsi.bsi_base_id, 0, op->o_tmpmemctx );
        }
 
        if ( !BER_BVISNULL( &e.e_nname ) ) {