]> git.sur5r.net Git - openldap/commitdiff
Experimental fix to ITS#179 fix.
authorKurt Zeilenga <kurt@openldap.org>
Sat, 31 Jul 1999 03:37:40 +0000 (03:37 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 31 Jul 1999 03:37:40 +0000 (03:37 +0000)
servers/slapd/back-ldbm/modify.c

index 75154c3cf9f1ff5c274bad3fe1e2112257f9067b..1fe1a19ac349bd8a48123b6ed0b1f5f46201fb92 100644 (file)
@@ -115,15 +115,7 @@ int ldbm_modify_internal(
        }
        ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
 
-       /* modify indexes */
-       if ( index_add_mods( be, modlist, e->e_id ) != 0 ) {
-               attrs_free( e->e_attrs );
-               e->e_attrs = save_attrs;
-               send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
-                       NULL, NULL, NULL, NULL );
-               return -1;
-       }
-
+       /* remove old indices */
        if( save_attrs != NULL ) {
                for ( ml = modlist; ml != NULL; ml = ml->ml_next ) {
                        mod = &ml->ml_mod;
@@ -145,6 +137,14 @@ int ldbm_modify_internal(
                attrs_free( save_attrs );
        }
 
+       /* modify indexes */
+       if ( index_add_mods( be, modlist, e->e_id ) != 0 ) {
+               /* our indices are likely hosed */
+               send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
+                       NULL, NULL, NULL, NULL );
+               return -1;
+       }
+
        /* check for abandon */
        ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
        if ( op->o_abandon ) {