From 27adb43cbf1e151816440e75d17befb7bf05fe93 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Fri, 22 Jul 2005 03:40:06 +0000 Subject: [PATCH] Move backend_operational() implementation into frontend so global overlays can be called --- servers/slapd/backend.c | 49 +++++----------------------- servers/slapd/frontend.c | 50 +++++++++++++++++++++++++++++ servers/slapd/slapi/slapi_overlay.c | 5 --- 3 files changed, 58 insertions(+), 46 deletions(-) diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 3840ea02e9..0fded3e421 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -1558,50 +1558,17 @@ freeit: if ( e != target ) { return rc; } -int backend_operational( - Operation *op, - SlapReply *rs ) +int backend_operational( Operation *op, SlapReply *rs ) { - Attribute **ap; - int rc = 0; - BackendDB *be_orig; - - for ( ap = &rs->sr_operational_attrs; *ap; ap = &(*ap)->a_next ) - /* just count them */ ; - - /* - * If operational attributes (allegedly) are required, - * and the backend supports specific operational attributes, - * add them to the attribute list - */ - if ( SLAP_OPATTRS( rs->sr_attr_flags ) || ( rs->sr_attrs && - ad_inlist( slap_schema.si_ad_entryDN, rs->sr_attrs ) ) ) - { - *ap = slap_operational_entryDN( rs->sr_entry ); - ap = &(*ap)->a_next; - } - - if ( SLAP_OPATTRS( rs->sr_attr_flags ) || ( rs->sr_attrs && - ad_inlist( slap_schema.si_ad_subschemaSubentry, rs->sr_attrs ) ) ) - { - *ap = slap_operational_subschemaSubentry( op->o_bd ); - ap = &(*ap)->a_next; - } + int rc; + BackendDB *be_orig; - if ( op->o_bd != NULL ) - { - /* Let the overlays have a chance at this */ - be_orig = op->o_bd; - if ( SLAP_ISOVERLAY( be_orig ) ) - op->o_bd = select_backend( be_orig->be_nsuffix, 0, 0 ); + /* Moved this into the frontend so global overlays are called */ - if ( ( SLAP_OPATTRS( rs->sr_attr_flags ) || rs->sr_attrs ) && - op->o_bd && op->o_bd->be_operational != NULL ) - { - rc = op->o_bd->be_operational( op, rs ); - } - op->o_bd = be_orig; - } + be_orig = op->o_bd; + op->o_bd = frontendDB; + rc = frontendDB->be_operational( op, rs ); + op->o_bd = be_orig; return rc; } diff --git a/servers/slapd/frontend.c b/servers/slapd/frontend.c index 510645f901..1ae0233f2d 100644 --- a/servers/slapd/frontend.c +++ b/servers/slapd/frontend.c @@ -42,6 +42,55 @@ static BackendInfo slap_frontendInfo; static BackendDB slap_frontendDB; BackendDB *frontendDB; +static int +fe_aux_operational( + Operation *op, + SlapReply *rs ) +{ + Attribute **ap; + int rc = 0; + BackendDB *be_orig; + + for ( ap = &rs->sr_operational_attrs; *ap; ap = &(*ap)->a_next ) + /* just count them */ ; + + /* + * If operational attributes (allegedly) are required, + * and the backend supports specific operational attributes, + * add them to the attribute list + */ + if ( SLAP_OPATTRS( rs->sr_attr_flags ) || ( rs->sr_attrs && + ad_inlist( slap_schema.si_ad_entryDN, rs->sr_attrs ) ) ) + { + *ap = slap_operational_entryDN( rs->sr_entry ); + ap = &(*ap)->a_next; + } + + if ( SLAP_OPATTRS( rs->sr_attr_flags ) || ( rs->sr_attrs && + ad_inlist( slap_schema.si_ad_subschemaSubentry, rs->sr_attrs ) ) ) + { + *ap = slap_operational_subschemaSubentry( op->o_bd ); + ap = &(*ap)->a_next; + } + + if ( op->o_bd != NULL ) + { + /* Let the overlays have a chance at this */ + be_orig = op->o_bd; + if ( SLAP_ISOVERLAY( be_orig ) ) + op->o_bd = select_backend( be_orig->be_nsuffix, 0, 0 ); + + if ( ( SLAP_OPATTRS( rs->sr_attr_flags ) || rs->sr_attrs ) && + op->o_bd && op->o_bd->be_operational != NULL ) + { + rc = op->o_bd->be_operational( op, rs ); + } + op->o_bd = be_orig; + } + + return rc; +} + int frontend_init( void ) { @@ -114,6 +163,7 @@ frontend_init( void ) frontendDB->bd_info->bi_op_modrdn = fe_op_modrdn; frontendDB->bd_info->bi_op_search = fe_op_search; frontendDB->bd_info->bi_extended = fe_extended; + frontendDB->bd_info->bi_operational = fe_aux_operational; #if 0 /* FIXME: is this too early? */ diff --git a/servers/slapd/slapi/slapi_overlay.c b/servers/slapd/slapi/slapi_overlay.c index 764a03e7aa..227131ec13 100644 --- a/servers/slapd/slapi/slapi_overlay.c +++ b/servers/slapd/slapi/slapi_overlay.c @@ -145,11 +145,6 @@ slapi_over_search( Operation *op, SlapReply *rs, int type ) else rc = LDAP_SUCCESS; /* confusing: don't abort, but don't send */ - if ( rc == SLAP_CB_CONTINUE && rs->sr_type == REP_SEARCH ) { - /* XXX we shouldn't need this here */ - slapi_over_aux_operational( op, rs ); - } - slapi_pblock_set( pb, SLAPI_RESCONTROLS, NULL ); /* don't free */ slapi_pblock_destroy(pb); -- 2.39.5