From 5d83746abf677fbbc4bbb25f26ac64d75bec8945 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 19 Nov 2005 00:33:19 +0000 Subject: [PATCH] improve previous commit; same fix required by objectClasses (ITS#4185) --- servers/slapd/at.c | 38 +++++++++++++++++++------------------- servers/slapd/oc.c | 24 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/servers/slapd/at.c b/servers/slapd/at.c index f3a7a25252..b9239013fd 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -394,27 +394,27 @@ at_insert( ldap_memfree(air); - if ( rc ) { + while ( names > sat->sat_names ) { struct aindexrec tmpair; - while ( names > sat->sat_names ) { - names--; - ber_str2bv( *names, 0, 0, &tmpair.air_name ); - tmpair.air_at = sat; - air = avl_delete( &attr_index, - (caddr_t)&tmpair, attr_index_cmp ); - assert( air != NULL ); - ldap_memfree( air ); - } - - if ( sat->sat_oid ) { - ber_str2bv( sat->sat_oid, 0, 0, &tmpair.air_name ); - tmpair.air_at = sat; - air = avl_delete( &attr_index, - (caddr_t)&tmpair, attr_index_cmp ); - assert( air != NULL ); - ldap_memfree( air ); - } + names--; + ber_str2bv( *names, 0, 0, &tmpair.air_name ); + tmpair.air_at = sat; + air = (struct aindexrec *)avl_delete( &attr_index, + (caddr_t)&tmpair, attr_index_cmp ); + assert( air != NULL ); + ldap_memfree( air ); + } + + if ( sat->sat_oid ) { + struct aindexrec tmpair; + + ber_str2bv( sat->sat_oid, 0, 0, &tmpair.air_name ); + tmpair.air_at = sat; + air = (struct aindexrec *)avl_delete( &attr_index, + (caddr_t)&tmpair, attr_index_cmp ); + assert( air != NULL ); + ldap_memfree( air ); } return rc; diff --git a/servers/slapd/oc.c b/servers/slapd/oc.c index af3913b602..acf8a5ff8b 100644 --- a/servers/slapd/oc.c +++ b/servers/slapd/oc.c @@ -524,6 +524,30 @@ oc_insert( rc = oc_check_dup( old_soc, soc ); ldap_memfree( oir ); + + while ( names > soc->soc_names ) { + struct oindexrec tmpoir; + + names--; + ber_str2bv( *names, 0, 0, &tmpoir.oir_name ); + tmpoir.oir_oc = soc; + oir = (struct oindexrec *)avl_delete( &oc_index, + (caddr_t)&tmpoir, oc_index_cmp ); + assert( oir != NULL ); + ldap_memfree( oir ); + } + + if ( soc->soc_oid ) { + struct oindexrec tmpoir; + + ber_str2bv( soc->soc_oid, 0, 0, &tmpoir.oir_name ); + tmpoir.oir_oc = soc; + oir = (struct oindexrec *)avl_delete( &oc_index, + (caddr_t)&tmpoir, oc_index_cmp ); + assert( oir != NULL ); + ldap_memfree( oir ); + } + return rc; } -- 2.39.5