From 21bac1cbeda54fcff41c128cc07775a63692b64a Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Tue, 29 Jun 2010 16:23:31 +0000 Subject: [PATCH] Disallow removing global and cn=config overlays for now. Those require some special handling. --- servers/slapd/backover.c | 1 - servers/slapd/bconfig.c | 14 +++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/servers/slapd/backover.c b/servers/slapd/backover.c index cef32866c1..8fff96cbe9 100644 --- a/servers/slapd/backover.c +++ b/servers/slapd/backover.c @@ -1140,7 +1140,6 @@ overlay_remove( BackendDB *be, slap_overinst *on ) if ( ! oi->oi_list ) { /* reset db flags and bd_info to orig */ - SLAP_DBFLAGS( be ) &= ~SLAP_DBFLAG_GLOBAL_OVERLAY; be->bd_info = oi->oi_orig; ch_free(oi); } diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 1db63ea574..59236f5a70 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -6120,7 +6120,19 @@ config_back_delete( Operation *op, SlapReply *rs ) ldap_pvt_thread_pool_pause( &connection_pool ); if ( ce->ce_type == Cft_Overlay ){ - overlay_remove( ce->ce_be, (slap_overinst *)ce->ce_bi ); + if ( SLAP_ISGLOBALOVERLAY(ce->ce_be ) ) { + rs->sr_err = LDAP_UNWILLING_TO_PERFORM; + rs->sr_text = "Cannot delete global overlays"; + ldap_pvt_thread_pool_resume( &connection_pool ); + goto out; + } else if ( ce->ce_be == op->o_bd->bd_self ) { + rs->sr_err = LDAP_UNWILLING_TO_PERFORM; + rs->sr_text = "Cannot delete cn=config overlays"; + ldap_pvt_thread_pool_resume( &connection_pool ); + goto out; + } else { + 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; -- 2.39.5