From a1f409edd36472e87ef18ec989d8a07f9eb217f8 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sat, 31 Jul 1999 03:44:05 +0000 Subject: [PATCH] Fix the ITS#179 fix. --- servers/slapd/back-ldbm/modify.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index af91677b7b..2f0ea3673b 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -196,14 +196,7 @@ int ldbm_internal_modify( } ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex ); - /* modify indexes */ - if ( index_add_mods( be, mods, e->e_id ) != 0 ) { - attrs_free( e->e_attrs ); - e->e_attrs = save_attrs; - send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL, NULL ); - return -1; - } - + /* remove old indices */ if( save_attrs != NULL ) { for ( mod = mods; mod != NULL; mod = mod->mod_next ) { if( ( mod->mod_op & ~LDAP_MOD_BVALUES ) @@ -225,6 +218,14 @@ int ldbm_internal_modify( attrs_free( save_attrs ); } + /* modify indexes */ + if ( index_add_mods( be, mods, e->e_id ) != 0 ) { + /* our indices are likely hosed */ + send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, + NULL, NULL ); + return -1; + } + /* check for abandon */ ldap_pvt_thread_mutex_lock( &op->o_abandonmutex ); if ( op->o_abandon ) { -- 2.47.2