From: Howard Chu Date: Sun, 5 Dec 2004 06:44:54 +0000 (+0000) Subject: Go back to original startup/shutdown behavior. Fix entry_release. X-Git-Tag: OPENLDAP_REL_ENG_2_3_0ALPHA~129 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2c25924d28c21da2e89fa3e0d0e285d8cd271608;p=openldap Go back to original startup/shutdown behavior. Fix entry_release. --- diff --git a/servers/slapd/overlays/glue.c b/servers/slapd/overlays/glue.c index f7d2ddbe0f..a2fb18fe14 100644 --- a/servers/slapd/overlays/glue.c +++ b/servers/slapd/overlays/glue.c @@ -419,15 +419,16 @@ glue_open ( { slap_overinst *on = glue_tool_inst( bi ); glueinfo *gi = on->on_bi.bi_private; + static int glueOpened = 0; int i, rc = 0; + if (glueOpened) return 0; + + glueOpened = 1; + /* If we were invoked in tool mode, open all the underlying backends */ if (slapMode & SLAP_TOOL_MODE) { - for ( i=0; igi_nodes; i++ ) { - gi->gi_n[i].gn_be = backendDB + gi->gi_n[i].gn_bx; - rc = backend_startup( gi->gi_n[i].gn_be ); - if ( rc ) break; - } + rc = backend_startup( NULL ); } /* other case is impossible */ return rc; } @@ -440,17 +441,38 @@ glue_close ( { slap_overinst *on = glue_tool_inst( bi ); glueinfo *gi = on->on_bi.bi_private; + static int glueClosed = 0; int i, rc = 0; + if (glueClosed) return 0; + + glueClosed = 1; + if (slapMode & SLAP_TOOL_MODE) { - for ( i=0; igi_nodes; i++ ) { - rc = backend_shutdown( gi->gi_n[i].gn_be ); - if ( rc ) break; - } + rc = backend_shutdown( NULL ); } return rc; } +static int +glue_entry_release_rw ( + Operation *op, + Entry *e, + int rw +) +{ + BackendDB *b0, b2; + int rc; + + b0 = op->o_bd; + b2.bd_info = (BackendInfo *)glue_tool_inst( op->o_bd->bd_info ); + op->o_bd = glue_back_select (&b2, &e->e_nname); + + rc = op->o_bd->be_release( op, e, rw ); + op->o_bd = b0; + return rc; +} + static ID glue_tool_entry_first ( BackendDB *b0 @@ -610,6 +632,8 @@ glue_db_init( oi->oi_bi.bi_open = glue_open; oi->oi_bi.bi_close = glue_close; + oi->oi_bi.bi_entry_release_rw = glue_entry_release_rw; + oi->oi_bi.bi_tool_entry_open = glue_tool_entry_open; oi->oi_bi.bi_tool_entry_close = glue_tool_entry_close; oi->oi_bi.bi_tool_entry_first = glue_tool_entry_first;