glueinfo *gi = (glueinfo *)on->on_bi.bi_private;
int i;
- for (i = 0; i<gi->gi_nodes; i++) {
+ for (i = gi->gi_nodes-1; i >= 0; i--) {
assert( gi->gi_n[i].gn_be->be_nsuffix != NULL );
if (dnIsSuffix(dn, &gi->gi_n[i].gn_be->be_nsuffix[0])) {
if ( func[which] )
rc = func[which]( op, rs );
else
- rc = SLAP_CB_CONTINUE;
+ rc = SLAP_CB_BYPASS;
op->o_bd = b0;
op->o_bd->bd_info = bi0;
return rc;
}
+static int
+glue_response ( Operation *op, SlapReply *rs )
+{
+ slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
+ BackendDB *be = op->o_bd;
+ be = glue_back_select (op->o_bd, &op->o_req_ndn);
+
+ /* If we're on the master backend, let overlay framework handle it.
+ * Otherwise, bail out.
+ */
+ return ( op->o_bd == be ) ? SLAP_CB_CONTINUE : SLAP_CB_BYPASS;
+}
+
static int
glue_chk_referrals ( Operation *op, SlapReply *rs )
{
b1 = op->o_bd;
/*
- * Execute in reverse order, most general first
+ * Execute in reverse order, most specific first
*/
for (i = gi->gi_nodes; i >= 0; i--) {
if ( i == gi->gi_nodes ) {
if ( rs->sr_err == LDAP_NO_SUCH_OBJECT ) {
gs.err = LDAP_SUCCESS;
}
+ op->ors_scope = LDAP_SCOPE_ONELEVEL;
+ op->o_req_dn = dn;
+ op->o_req_ndn = ndn;
} else if (scope0 == LDAP_SCOPE_SUBTREE &&
dn_match(&op->o_bd->be_nsuffix[0], &ndn))
glue.on_bi.bi_chk_referrals = glue_chk_referrals;
glue.on_bi.bi_chk_controls = glue_chk_controls;
+ glue.on_response = glue_response;
return overlay_register( &glue );
}
rc = over_db_func( be, db_destroy );
- for (next = on->on_next; on; on=next) {
- next = on->on_next;
- free( on );
+ if ( on ) {
+ for (next = on->on_next; on; on=next) {
+ next = on->on_next;
+ free( on );
+ }
}
free( oi );
return rc;
if ( rc != SLAP_CB_CONTINUE ) break;
}
}
+ /* Bypass the remaining on_response layers, but allow
+ * normal execution to continue.
+ */
+ if ( rc == SLAP_CB_BYPASS )
+ rc = SLAP_CB_CONTINUE;
op->o_bd = be;
return rc;
}
if ( rc != SLAP_CB_CONTINUE ) break;
}
}
+ if ( rc == SLAP_CB_BYPASS )
+ rc = SLAP_CB_CONTINUE;
func = &oi->oi_orig->bi_op_bind;
if ( func[which] && rc == SLAP_CB_CONTINUE ) {