From dab5803a5912ce97ddd107e443d8a7b749b6d380 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Tue, 14 Feb 2006 09:20:50 +0000 Subject: [PATCH] Use bi_db_{open,close} to run SLAPI start/close plugins --- servers/slapd/init.c | 25 ++-------------------- servers/slapd/slapi/slapi_overlay.c | 33 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/servers/slapd/init.c b/servers/slapd/init.c index 8cf3c7ae0e..226fda0945 100644 --- a/servers/slapd/init.c +++ b/servers/slapd/init.c @@ -247,20 +247,7 @@ int slap_startup( Backend *be ) slap_name, 0, 0 ); - rc = backend_startup( be ); - -#ifdef LDAP_SLAPI - if( rc == 0 ) { - Slapi_PBlock *pb = slapi_pblock_new(); - - if ( slapi_int_call_plugins( frontendDB, SLAPI_PLUGIN_START_FN, pb ) < 0 ) { - rc = -1; - } - slapi_pblock_destroy( pb ); - } -#endif /* LDAP_SLAPI */ - - return rc; + return backend_startup( be ); } int slap_shutdown( Backend *be ) @@ -275,15 +262,7 @@ int slap_shutdown( Backend *be ) slap_name, 0, 0 ); /* let backends do whatever cleanup they need to do */ - rc = backend_shutdown( be ); - -#ifdef LDAP_SLAPI - pb = slapi_pblock_new(); - (void) slapi_int_call_plugins( frontendDB, SLAPI_PLUGIN_CLOSE_FN, pb ); - slapi_pblock_destroy( pb ); -#endif /* LDAP_SLAPI */ - - return rc; + return backend_shutdown( be ); } int slap_destroy(void) diff --git a/servers/slapd/slapi/slapi_overlay.c b/servers/slapd/slapi/slapi_overlay.c index 1ffe35af6d..424a3d7798 100644 --- a/servers/slapd/slapi/slapi_overlay.c +++ b/servers/slapd/slapi/slapi_overlay.c @@ -840,6 +840,36 @@ done: return rc; } +static int +slapi_over_db_open( BackendDB *be ) +{ + Slapi_PBlock *pb; + int rc; + + pb = slapi_pblock_new(); + + rc = slapi_int_call_plugins( be, SLAPI_PLUGIN_START_FN, pb ); + + slapi_pblock_destroy( pb ); + + return rc; +} + +static int +slapi_over_db_close( BackendDB *be ) +{ + Slapi_PBlock *pb; + int rc; + + pb = slapi_pblock_new(); + + rc = slapi_int_call_plugins( be, SLAPI_PLUGIN_CLOSE_FN, pb ); + + slapi_pblock_destroy( pb ); + + return rc; +} + static int slapi_over_init() { @@ -858,6 +888,9 @@ slapi_over_init() slapi.on_bi.bi_op_abandon = slapi_op_func; slapi.on_bi.bi_op_cancel = slapi_op_func; + slapi.on_bi.bi_db_open = slapi_over_db_open; + slapi.on_bi.bi_db_close = slapi_over_db_close; + slapi.on_bi.bi_extended = slapi_over_extended; slapi.on_bi.bi_access_allowed = slapi_over_access_allowed; slapi.on_bi.bi_operational = slapi_over_aux_operational; -- 2.39.5