Index: servers/slapd/bconfig.c =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/bconfig.c,v retrieving revision 1.342 retrieving revision 1.344 diff -u -r1.342 -r1.344 --- servers/slapd/bconfig.c 4 Sep 2008 11:56:31 -0000 1.342 +++ servers/slapd/bconfig.c 4 Sep 2008 15:12:07 -0000 1.344 @@ -5245,15 +5245,28 @@ if ( last ) rs->sr_matched = last->ce_entry->e_name.bv_val; rs->sr_err = LDAP_NO_SUCH_OBJECT; - } else if ( ce->ce_kids ) { + } else if ( ce->ce_kids ) { rs->sr_err = LDAP_UNWILLING_TO_PERFORM; - } else if ( ce->ce_type == Cft_Overlay ){ + } else if ( ce->ce_type == Cft_Overlay || ce->ce_type == Cft_Database ){ char *iptr; int count, ixold, rc; ldap_pvt_thread_pool_pause( &connection_pool ); - - overlay_remove( ce->ce_be, (slap_overinst *)ce->ce_bi ); + + if ( ce->ce_type == Cft_Overlay ){ + overlay_remove( ce->ce_be, (slap_overinst *)ce->ce_bi ); + } else { /* Cft_Database*/ + if ( ce->ce_be == frontendDB || ce->ce_be == op->o_bd ){ + rs->sr_err = LDAP_UNWILLING_TO_PERFORM; + rs->sr_text = "Cannot delete config or frontend database"; + ldap_pvt_thread_pool_resume( &connection_pool ); + goto out; + } + if ( ce->ce_be->bd_info->bi_db_close ) { + ce->ce_be->bd_info->bi_db_close( ce->ce_be, NULL ); + } + backend_destroy_one( ce->ce_be, 1); + } /* remove CfEntryInfo from the siblings list */ if ( ce->ce_parent->ce_kids == ce ) { @@ -5315,6 +5328,7 @@ #else rs->sr_err = LDAP_UNWILLING_TO_PERFORM; #endif /* SLAP_CONFIG_DELETE */ +out: send_ldap_result( op, rs ); return rs->sr_err; }