Move backend_operational() implementation into frontend so global

overlays can be called
This commit is contained in:
Luke Howard 2005-07-22 03:40:06 +00:00
parent a253fbdab4
commit 27adb43cbf
3 changed files with 58 additions and 46 deletions

View File

@ -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;
int rc;
BackendDB *be_orig;
for ( ap = &rs->sr_operational_attrs; *ap; ap = &(*ap)->a_next )
/* just count them */ ;
/* Moved this into the frontend so global overlays are called */
/*
* 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;
}
be_orig = op->o_bd;
op->o_bd = frontendDB;
rc = frontendDB->be_operational( op, rs );
op->o_bd = be_orig;
return rc;
}

View File

@ -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? */

View File

@ -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);