]> git.sur5r.net Git - openldap/commitdiff
Move backend_operational() implementation into frontend so global
authorLuke Howard <lukeh@openldap.org>
Fri, 22 Jul 2005 03:40:06 +0000 (03:40 +0000)
committerLuke Howard <lukeh@openldap.org>
Fri, 22 Jul 2005 03:40:06 +0000 (03:40 +0000)
overlays can be called

servers/slapd/backend.c
servers/slapd/frontend.c
servers/slapd/slapi/slapi_overlay.c

index 3840ea02e914d8d2001dca1a3ae1f14b973f3651..0fded3e42177bbbe7b589217816141cf9c961ad6 100644 (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;
-
-       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;
 }
index 510645f901e010efef3daadacf176a5a791a002f..1ae0233f2d732ed5c107a5d93b08d65a020c643b 100644 (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? */
index 764a03e7aac1eb305d3d14cb1c236d89c6233b75..227131ec139c19aa220f5428e4a122777e300c52 100644 (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);