From: Luke Howard Date: Thu, 28 Jul 2005 08:52:50 +0000 (+0000) Subject: Add slapi_over_call_plugins() to ensure that global plugins are X-Git-Tag: OPENLDAP_AC_BP~170 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e4ff86c1987817d928a56258541d14b0d9bea211;p=openldap Add slapi_over_call_plugins() to ensure that global plugins are invoked from slap_callbacks --- diff --git a/servers/slapd/slapi/slapi_overlay.c b/servers/slapd/slapi/slapi_overlay.c index c5528a40b1..2a341089e5 100644 --- a/servers/slapd/slapi/slapi_overlay.c +++ b/servers/slapd/slapi/slapi_overlay.c @@ -176,6 +176,29 @@ slapi_over_aux_operational( Operation *op, SlapReply *rs ) return SLAP_CB_CONTINUE; } +/* + * We need this function to call frontendDB (global) plugins before + * database plugins, if we are invoked by a slap_callback. + */ +static int +slapi_over_call_plugins( Slapi_PBlock *pb, int type ) +{ + int rc = 1; /* means no plugins called */ + Operation *op; + + PBLOCK_ASSERT_OP( pb, 0 ); + op = pb->pb_op; + + if ( op->o_bd != frontendDB ) { + rc = slapi_int_call_plugins( frontendDB, type, pb ); + } + if ( rc >= 0 ) { + rc = slapi_int_call_plugins( op->o_bd, type, pb ); + } + + return rc; +} + static int slapi_over_search( Operation *op, SlapReply *rs, int type ) { @@ -187,7 +210,7 @@ slapi_over_search( Operation *op, SlapReply *rs, int type ) /* create a new pblock to not trample on result controls */ pb = slapi_over_pblock_new( op, rs ); - rc = slapi_int_call_plugins( op->o_bd, type, pb ); + rc = slapi_over_call_plugins( pb, type ); if ( rc >= 0 ) /* 1 means no plugins called */ rc = SLAP_CB_CONTINUE; else @@ -208,7 +231,7 @@ slapi_over_result( Operation *op, SlapReply *rs, int type ) assert( rs->sr_type == REP_RESULT ); - slapi_int_call_plugins( op->o_bd, type, pb ); + slapi_over_call_plugins( pb, type ); return SLAP_CB_CONTINUE; } @@ -761,7 +784,7 @@ slapi_over_acl_group( slapi_pblock_set( pb, SLAPI_X_GROUP_ATTRIBUTE, (void *)group_at->ad_cname.bv_val ); slapi_pblock_set( pb, SLAPI_X_GROUP_TARGET_ENTRY, (void *)target ); - rc = slapi_int_call_plugins( op->o_bd, SLAPI_X_PLUGIN_PRE_GROUP_FN, pb ); + rc = slapi_over_call_plugins( pb, SLAPI_X_PLUGIN_PRE_GROUP_FN ); if ( rc >= 0 ) /* 1 means no plugins called */ rc = SLAP_CB_CONTINUE; else