]> git.sur5r.net Git - openldap/commitdiff
Always exclude subordinates from top-level ops so glue overlay can
authorHoward Chu <hyc@openldap.org>
Sat, 4 Dec 2004 19:26:22 +0000 (19:26 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 4 Dec 2004 19:26:22 +0000 (19:26 +0000)
intercept. Now a single syncprov works over the entire glued context.

servers/slapd/add.c
servers/slapd/backover.c
servers/slapd/delete.c
servers/slapd/modify.c
servers/slapd/modrdn.c
servers/slapd/overlays/glue.c
servers/slapd/passwd.c
servers/slapd/slapi/slapi_ops.c

index a1e99928704aeae848f2a9a38d3b6121816fad39..958e929105f93b1343638e3b3b5f238524f90322 100644 (file)
@@ -201,7 +201,7 @@ fe_op_add( Operation *op, SlapReply *rs )
         * appropriate one, or send a referral to our "referral server"
         * if we don't hold it.
         */
-       op->o_bd = select_backend( &e->e_nname, manageDSAit, 0 );
+       op->o_bd = select_backend( &e->e_nname, manageDSAit, 1 );
        if ( op->o_bd == NULL ) {
                rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
index 4ddb208a0e6f35ad4509cf0bce24c75ced9bea92..c3fe17e601a94e1dbc8920e86c40c5fb85a5be3e 100644 (file)
@@ -256,12 +256,15 @@ over_op_func(
        slap_overinfo *oi = op->o_bd->bd_info->bi_private;
        slap_overinst *on = oi->oi_list;
        BI_op_bind **func;
-       BackendDB *be = op->o_bd, db = *op->o_bd;
+       BackendDB *be = op->o_bd, db;
        slap_callback cb = {NULL, over_back_response, NULL, NULL};
        int rc = SLAP_CB_CONTINUE;
 
-       db.be_flags |= SLAP_DBFLAG_OVERLAY;
-       op->o_bd = &db;
+       if ( !SLAP_ISOVERLAY( op->o_bd )) {
+               db = *op->o_bd;
+               db.be_flags |= SLAP_DBFLAG_OVERLAY;
+               op->o_bd = &db;
+       }
        cb.sc_next = op->o_callback;
        cb.sc_private = oi;
        op->o_callback = &cb;
index 8dbe493281972ff01b99ab3ab97374289e500dca..61375da9ec73e3416205100076b341aae2891320 100644 (file)
@@ -115,7 +115,7 @@ fe_op_delete( Operation *op, SlapReply *rs )
         * appropriate one, or send a referral to our "referral server"
         * if we don't hold it.
         */
-       op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 0 );
+       op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 1 );
        if ( op->o_bd == NULL ) {
                rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
index 9158546c1a387b30235cf5c4371ccd0d0c54da6d..f57f6cbb623e1b79b4462e82df1906c0939a973d 100644 (file)
@@ -297,7 +297,7 @@ fe_op_modify( Operation *op, SlapReply *rs )
         * appropriate one, or send a referral to our "referral server"
         * if we don't hold it.
         */
-       op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 0 );
+       op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 1 );
        if ( op->o_bd == NULL ) {
                rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
index de26c6c7a0d5df607ea0b5a747d33022e5f3990b..ee08166ea506cf027ab69f899924353ff6965b5c 100644 (file)
@@ -229,7 +229,7 @@ fe_op_modrdn( Operation *op, SlapReply *rs )
         * appropriate one, or send a referral to our "referral server"
         * if we don't hold it.
         */
-       op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 0 );
+       op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 1 );
        if ( op->o_bd == NULL ) {
                rs->sr_ref = referral_rewrite( default_referral,
                        NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
index 6c64d6cfddec4d794818bd16ee8b8e8d2f0f11f9..f7d2ddbe0f7c0bbbc5c6721f0b761bc07f918fbc 100644 (file)
@@ -154,6 +154,45 @@ glue_op_response ( Operation *op, SlapReply *rs )
        return 0;
 }
 
+enum glue_which {
+       op_modify = 0,
+       op_modrdn,
+       op_add,
+       op_delete
+};
+
+static int
+glue_op_func ( Operation *op, SlapReply *rs )
+{
+       slap_overinst   *on = (slap_overinst *)op->o_bd->bd_info;
+       glueinfo                *gi = (glueinfo *)on->on_bi.bi_private;
+       BackendDB *b0 = op->o_bd;
+       BackendInfo *bi0 = op->o_bd->bd_info;
+       BI_op_modify **func;
+       enum glue_which which;
+       int rc;
+
+       op->o_bd = glue_back_select (b0, &op->o_req_ndn);
+       b0->bd_info = on->on_info->oi_orig;
+
+       switch(op->o_tag) {
+       case LDAP_REQ_ADD: which = op_add; break;
+       case LDAP_REQ_DELETE: which = op_delete; break;
+       case LDAP_REQ_MODIFY: which = op_modify; break;
+       case LDAP_REQ_MODRDN: which = op_modrdn; break;
+       }
+
+       func = &op->o_bd->bd_info->bi_op_modify;
+       if ( func[which] )
+               rc = func[which]( op, rs );
+       else
+               rc = SLAP_CB_CONTINUE;
+
+       op->o_bd = b0;
+       op->o_bd->bd_info = bi0;
+       return rc;
+}
+
 static int
 glue_op_search ( Operation *op, SlapReply *rs )
 {
@@ -188,6 +227,7 @@ glue_op_search ( Operation *op, SlapReply *rs )
        case LDAP_SCOPE_SUBORDINATE: /* FIXME */
 #endif
 
+#if 0
                if ( op->o_sync ) {
                        if (op->o_bd && op->o_bd->be_search) {
                                rs->sr_err = op->o_bd->be_search( op, rs );
@@ -197,6 +237,7 @@ glue_op_search ( Operation *op, SlapReply *rs )
                        }
                        return rs->sr_err;
                }
+#endif
 
                op->o_callback = &cb;
                rs->sr_err = gs.err = LDAP_UNWILLING_TO_PERFORM;
@@ -679,6 +720,10 @@ glue_init()
        glue.on_bi.bi_db_destroy = glue_db_destroy;
 
        glue.on_bi.bi_op_search = glue_op_search;
+       glue.on_bi.bi_op_modify = glue_op_func;
+       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;
 
        return overlay_register( &glue );
 }
index d848e7a6cc2e4f7491bea1daf914d253899cc744..51b42411711abf833bbd44501d51ee76520e1717 100644 (file)
@@ -81,7 +81,7 @@ int passwd_extop(
                        rc = rs->sr_err;
                        goto error_return;
                }
-               op->o_bd = select_backend( &op->o_req_ndn, 0, 0 );
+               op->o_bd = select_backend( &op->o_req_ndn, 0, 1 );
 
        } else {
                ber_dupbv_x( &op->o_req_dn, &op->o_dn, op->o_tmpmemctx );
index 9ba378febbda97563ccbaa2ef6877c66c5e00b35..4b7b02ae794062f38ff52befd7fb55285d8b8226 100644 (file)
@@ -548,7 +548,7 @@ slapi_delete_internal(
                manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL; 
        }
 
-       op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 0 );
+       op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 1 );
        if ( op->o_bd == NULL ) {
                rs.sr_err = LDAP_PARTIAL_RESULTS;
                goto cleanup;
@@ -617,7 +617,7 @@ slapi_int_add_entry_locked(
        pPB = (Slapi_PBlock *)op->o_pb;
        op->o_ctrls = controls;
 
-       op->o_bd = select_backend( &((*e)->e_nname), manageDsaIt, 0 );
+       op->o_bd = select_backend( &((*e)->e_nname), manageDsaIt, 1 );
        if ( op->o_bd == NULL ) {
                rs.sr_err = LDAP_PARTIAL_RESULTS;
                goto cleanup;
@@ -787,7 +787,7 @@ slapi_modrdn_internal(
                manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
        }
 
-       op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 0 );
+       op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 1 );
        if ( op->o_bd == NULL ) {
                rs.sr_err =  LDAP_PARTIAL_RESULTS;
                goto cleanup;
@@ -927,7 +927,7 @@ slapi_modify_internal(
                manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
        }
 
-       op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 0 );
+       op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 1 );
        if ( op->o_bd == NULL ) {
                rs.sr_err = LDAP_PARTIAL_RESULTS;
                goto cleanup;
@@ -1193,7 +1193,7 @@ slapi_search_internal(
                manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
        }
 
-       op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 0 );
+       op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 1 );
        if ( op->o_bd == NULL ) {
                if ( manageDsaIt > SLAP_CONTROL_NONE  ) {
                        rs.sr_err = LDAP_NO_SUCH_OBJECT;