]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/oc.c
ITS#5376,ITS#5378
[openldap] / servers / slapd / oc.c
index af3913b602fc935c4962e16eafc98ecc57b86d16..7e2a66872dcc50de19adf8d76c0fcc2432305d06 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2008 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -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;
                        }