From: Kurt Zeilenga Date: Sat, 31 Jul 1999 03:44:05 +0000 (+0000) Subject: Fix the ITS#179 fix. X-Git-Tag: OPENLDAP_REL_ENG_1_2_6~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1f409edd36472e87ef18ec989d8a07f9eb217f8;p=thirdparty%2Fopenldap.git Fix the ITS#179 fix. --- 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 ) {