/* index.c - routines for dealing with attribute indexes */
/* $OpenLDAP$ */
-/*
- * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2000-2004 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
*/
#include "portable.h"
return LDAP_INAPPROPRIATE_MATCHING;
}
- rc = bdb_db_cache( be, NULL, prefixp->bv_val, &db );
+ rc = bdb_db_cache( be, prefixp->bv_val, &db );
if( rc != LDAP_SUCCESS ) {
return rc;
break;
case LDAP_FILTER_APPROX:
- if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) ) {
- goto done;
+ if ( desc->ad_type->sat_approx ) {
+ if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) ) {
+ goto done;
+ }
+ break;
}
+
+ /* Use EQUALITY rule and index for approximate match */
/* fall thru */
case LDAP_FILTER_EQUALITY:
const char *text;
DB *db;
struct berval *keys;
- void *mark;
assert( mask );
- rc = bdb_db_cache( op->o_bd, txn, atname->bv_val, &db );
+ rc = bdb_db_cache( op->o_bd, atname->bv_val, &db );
if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
return LDAP_OTHER;
}
- mark = sl_mark(op->o_tmpmemctx);
-
if( IS_SLAP_INDEX( mask, SLAP_INDEX_PRESENT ) ) {
rc = bdb_key_change( op->o_bd, db, txn, &presence_key, id, opid );
if( rc ) {
for( i=0; keys[i].bv_val != NULL; i++ ) {
rc = bdb_key_change( op->o_bd, db, txn, &keys[i], id, opid );
if( rc ) {
- ber_bvarray_free( keys );
+ ber_bvarray_free_x( keys, op->o_tmpmemctx );
goto done;
}
}
for( i=0; keys[i].bv_val != NULL; i++ ) {
rc = bdb_key_change( op->o_bd, db, txn, &keys[i], id, opid );
if( rc ) {
- ber_bvarray_free( keys );
+ ber_bvarray_free_x( keys, op->o_tmpmemctx );
goto done;
}
}
for( i=0; keys[i].bv_val != NULL; i++ ) {
bdb_key_change( op->o_bd, db, txn, &keys[i], id, opid );
if( rc ) {
- ber_bvarray_free( keys );
+ ber_bvarray_free_x( keys, op->o_tmpmemctx );
goto done;
}
}
}
done:
- sl_release( mark, op->o_tmpmemctx );
return rc;
}