]> git.sur5r.net Git - openldap/commitdiff
improve previous commit; same fix required by objectClasses (ITS#4185)
authorPierangelo Masarati <ando@openldap.org>
Sat, 19 Nov 2005 00:33:19 +0000 (00:33 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 19 Nov 2005 00:33:19 +0000 (00:33 +0000)
servers/slapd/at.c
servers/slapd/oc.c

index f3a7a25252813768ffadfe5006090c5f7aafe7ef..b9239013fd5872c59c1115e70b118b1e64514a7b 100644 (file)
@@ -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;
index af3913b602fc935c4962e16eafc98ecc57b86d16..acf8a5ff8b8d8c5e6869b47f5cf47b99bacbec74 100644 (file)
@@ -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;
                        }