mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-02-05 13:40:08 +08:00
Always exclude subordinates from top-level ops so glue overlay can
intercept. Now a single syncprov works over the entire glued context.
This commit is contained in:
parent
36a3a1d62f
commit
916e931065
@ -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 );
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
@ -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 );
|
||||
|
@ -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 );
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user