From: Howard Chu Date: Sat, 4 Dec 2004 19:26:22 +0000 (+0000) Subject: Always exclude subordinates from top-level ops so glue overlay can X-Git-Tag: OPENLDAP_REL_ENG_2_3_0ALPHA~140 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=916e931065b53404eace714c12565c3e9983b5c3;p=openldap Always exclude subordinates from top-level ops so glue overlay can intercept. Now a single syncprov works over the entire glued context. --- diff --git a/servers/slapd/add.c b/servers/slapd/add.c index a1e9992870..958e929105 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -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 ); diff --git a/servers/slapd/backover.c b/servers/slapd/backover.c index 4ddb208a0e..c3fe17e601 100644 --- a/servers/slapd/backover.c +++ b/servers/slapd/backover.c @@ -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; diff --git a/servers/slapd/delete.c b/servers/slapd/delete.c index 8dbe493281..61375da9ec 100644 --- a/servers/slapd/delete.c +++ b/servers/slapd/delete.c @@ -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 ); diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index 9158546c1a..f57f6cbb62 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -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 ); diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c index de26c6c7a0..ee08166ea5 100644 --- a/servers/slapd/modrdn.c +++ b/servers/slapd/modrdn.c @@ -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 ); diff --git a/servers/slapd/overlays/glue.c b/servers/slapd/overlays/glue.c index 6c64d6cfdd..f7d2ddbe0f 100644 --- a/servers/slapd/overlays/glue.c +++ b/servers/slapd/overlays/glue.c @@ -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 ); } diff --git a/servers/slapd/passwd.c b/servers/slapd/passwd.c index d848e7a6cc..51b4241171 100644 --- a/servers/slapd/passwd.c +++ b/servers/slapd/passwd.c @@ -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 ); diff --git a/servers/slapd/slapi/slapi_ops.c b/servers/slapd/slapi/slapi_ops.c index 9ba378febb..4b7b02ae79 100644 --- a/servers/slapd/slapi/slapi_ops.c +++ b/servers/slapd/slapi/slapi_ops.c @@ -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;