]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/backglue.c
further clarify size limit related issues in sync replication (ITS#5243)
[openldap] / servers / slapd / backglue.c
index c44f6fbd30d65b29e0ea0af72adb569642ee3a02..f4f8529e3525e442ee9a420b37d7ffe890a4851f 100644 (file)
@@ -87,6 +87,15 @@ typedef struct glue_state {
        int nctrls;
 } glue_state;
 
+static int
+glue_op_cleanup( Operation *op, SlapReply *rs )
+{
+       /* This is not a final result */
+       if (rs->sr_type == REP_RESULT )
+               rs->sr_type = REP_GLUE_RESULT;
+       return SLAP_CB_CONTINUE;
+}
+
 static int
 glue_op_response ( Operation *op, SlapReply *rs )
 {
@@ -192,6 +201,7 @@ glue_op_func ( Operation *op, SlapReply *rs )
        case LDAP_REQ_DELETE: which = op_delete; break;
        case LDAP_REQ_MODIFY: which = op_modify; break;
        case LDAP_REQ_MODRDN: which = op_modrdn; break;
+       case LDAP_REQ_EXTENDED: which = op_extended; break;
        default: assert( 0 ); break;
        }
 
@@ -316,7 +326,7 @@ glue_op_search ( Operation *op, SlapReply *rs )
        int i;
        long stoptime = 0, starttime;
        glue_state gs = {NULL, NULL, NULL, 0, 0, 0, 0};
-       slap_callback cb = { NULL, glue_op_response, NULL, NULL };
+       slap_callback cb = { NULL, glue_op_response, glue_op_cleanup, NULL };
        int scope0, tlimit0;
        struct berval dn, ndn, *pdn;
 
@@ -600,6 +610,29 @@ glue_close (
        return rc;
 }
 
+static int
+glue_entry_get_rw (
+       Operation               *op,
+       struct berval   *dn,
+       ObjectClass             *oc,
+       AttributeDescription    *ad,
+       int     rw,
+       Entry   **e )
+{
+       BackendDB *b0 = op->o_bd;
+       int rc;
+
+       op->o_bd = glue_back_select( b0, dn );
+
+       if ( op->o_bd->be_fetch ) {
+               rc = op->o_bd->be_fetch( op, dn, oc, ad, rw, e );
+       } else {
+               rc = LDAP_UNWILLING_TO_PERFORM;
+       }
+       op->o_bd =b0;
+       return rc;
+}
+
 static int
 glue_entry_release_rw (
        Operation *op,
@@ -607,13 +640,10 @@ glue_entry_release_rw (
        int rw
 )
 {
-       BackendDB *b0, b2;
+       BackendDB *b0 = op->o_bd;
        int rc = -1;
 
-       b0 = op->o_bd;
-       b2 = *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);
+       op->o_bd = glue_back_select (b0, &e->e_nname);
 
        if ( op->o_bd->be_release ) {
                rc = op->o_bd->be_release( op, e, rw );
@@ -809,8 +839,6 @@ 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;
-
        /* Only advertise these if the root DB supports them */
        if ( bi->bi_tool_entry_open )
                oi->oi_bi.bi_tool_entry_open = glue_tool_entry_open;
@@ -1019,9 +1047,13 @@ glue_sub_init()
        glue.on_bi.bi_op_modrdn = glue_op_func;
        glue.on_bi.bi_op_add = glue_op_func;
        glue.on_bi.bi_op_delete = glue_op_func;
+       glue.on_bi.bi_extended = glue_op_func;
 
        glue.on_bi.bi_chk_referrals = glue_chk_referrals;
        glue.on_bi.bi_chk_controls = glue_chk_controls;
+       glue.on_bi.bi_entry_get_rw = glue_entry_get_rw;
+       glue.on_bi.bi_entry_release_rw = glue_entry_release_rw;
+
        glue.on_response = glue_response;
 
        return overlay_register( &glue );