From e455a7d4866cfae0d22042a0d87b966f6401c058 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 26 Aug 1999 01:33:57 +0000 Subject: [PATCH] Defer updating dn2id until after rdn checks... (test005 still broken) --- servers/slapd/back-ldbm/modrdn.c | 43 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/servers/slapd/back-ldbm/modrdn.c b/servers/slapd/back-ldbm/modrdn.c index 4523ea5111..980498277d 100644 --- a/servers/slapd/back-ldbm/modrdn.c +++ b/servers/slapd/back-ldbm/modrdn.c @@ -279,27 +279,6 @@ ldbm_back_modrdn( } ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex ); - /* delete old one */ - if ( dn2id_delete( be, e->e_ndn, e->e_id ) != 0 ) { - send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, - NULL, NULL, NULL, NULL ); - goto return_results; - } - - (void) cache_delete_entry( &li->li_cache, e ); - free( e->e_dn ); - free( e->e_ndn ); - e->e_dn = new_dn; - e->e_ndn = new_ndn; - - /* add new one */ - if ( dn2id_add( be, e->e_ndn, e->e_id ) != 0 ) { - send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, - NULL, NULL, NULL, NULL ); - goto return_results; - } - - /* Get attribute type and attribute value of our new rdn, we will * need to add that to our new entry */ @@ -437,12 +416,32 @@ ldbm_back_modrdn( } #endif + /* delete old one */ + if ( dn2id_delete( be, e->e_ndn, e->e_id ) != 0 ) { + send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, + NULL, NULL, NULL, NULL ); + goto return_results; + } + + (void) cache_delete_entry( &li->li_cache, e ); + free( e->e_dn ); + free( e->e_ndn ); + e->e_dn = new_dn; + e->e_ndn = new_ndn; + + /* add new one */ + if ( dn2id_add( be, e->e_ndn, e->e_id ) != 0 ) { + send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, + NULL, NULL, NULL, NULL ); + goto return_results; + } + + /* modify memory copy of entry */ if ( ldbm_modify_internal( be, conn, op, dn, &mod[deleteoldrdn ? 0 : 1], e ) != 0 ) { goto return_results; - } (void) cache_update_entry( &li->li_cache, e ); -- 2.39.5