/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2000-2007 The OpenLDAP Foundation.
+ * Copyright 2000-2008 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
/* start with deleting the old index entries */
for ( ap = save_attrs; ap != NULL; ap = ap->a_next ) {
if ( ap->a_flags & SLAP_ATTR_IXDEL ) {
- struct berval tmp, *vals;
+ struct berval *vals;
Attribute *a2;
ap->a_flags &= ~SLAP_ATTR_IXDEL;
a2 = attr_find( e->e_attrs, ap->a_desc );
/* attribute was completely deleted */
vals = ap->a_nvals;
}
- if ( !BER_BVISEMPTY( vals )) {
+ if ( !BER_BVISNULL( vals )) {
rc = bdb_index_values( op, tid, ap->a_desc,
vals, e->e_id, SLAP_INDEX_DELETE_OP );
if ( rc != LDAP_SUCCESS ) {
Entry dummy = {0};
int fakeroot = 0;
- BDB_LOCKER locker = 0;
DB_LOCK lock;
int num_retries = 0;
rs->sr_err = TXN_ABORT( ltid );
ltid = NULL;
- op->o_private = NULL;
+ LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.boi_oe, OpExtra, oe_next );
+ opinfo.boi_oe.oe_key = NULL;
op->o_do_not_cache = opinfo.boi_acl_cache;
if( rs->sr_err != 0 ) {
rs->sr_err = LDAP_OTHER;
goto return_results;
}
- locker = TXN_ID ( ltid );
-
- opinfo.boi_bdb = op->o_bd;
+ opinfo.boi_oe.oe_key = bdb;
opinfo.boi_txn = ltid;
- opinfo.boi_locker = locker;
opinfo.boi_err = 0;
opinfo.boi_acl_cache = op->o_do_not_cache;
- op->o_private = &opinfo;
+ LDAP_SLIST_INSERT_HEAD( &op->o_extra, &opinfo.boi_oe, oe_next );
/* get entry or ancestor */
rs->sr_err = bdb_dn2entry( op, ltid, &op->o_req_ndn, &ei, 1,
- locker, &lock );
+ &lock );
if ( rs->sr_err != 0 ) {
Debug( LDAP_DEBUG_TRACE,
attrs_free( dummy.e_attrs );
} else {
- rc = bdb_cache_modify( bdb, e, dummy.e_attrs, locker, &lock );
+ rc = bdb_cache_modify( bdb, e, dummy.e_attrs, ltid, &lock );
switch( rc ) {
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
rs->sr_err = TXN_COMMIT( ltid, 0 );
}
ltid = NULL;
- op->o_private = NULL;
+ LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.boi_oe, OpExtra, oe_next );
+ opinfo.boi_oe.oe_key = NULL;
if( rs->sr_err != 0 ) {
Debug( LDAP_DEBUG_TRACE,
if( ltid != NULL ) {
TXN_ABORT( ltid );
}
- op->o_private = NULL;
+ if ( opinfo.boi_oe.oe_key ) {
+ LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.boi_oe, OpExtra, oe_next );
+ }
if( e != NULL ) {
bdb_unlocked_cache_return_entry_w (&bdb->bi_cache, e);
slap_sl_free( (*postread_ctrl)->ldctl_value.bv_val, op->o_tmpmemctx );
slap_sl_free( *postread_ctrl, op->o_tmpmemctx );
}
+
+ rs->sr_text = NULL;
+
return rs->sr_err;
}