]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Fix the ITS#179 fix.
authorKurt Zeilenga <kurt@openldap.org>
Sat, 31 Jul 1999 03:44:05 +0000 (03:44 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 31 Jul 1999 03:44:05 +0000 (03:44 +0000)
servers/slapd/back-ldbm/modify.c

index af91677b7be7fe2b8f341237a099b38c467ea6b0..2f0ea3673b36e5aaf92ab166684416c0704c3654 100644 (file)
@@ -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 ) {