/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2001-2010 The OpenLDAP Foundation.
+ * Copyright 2001-2012 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
return rc;
}
+static int
+glue_op_abandon( 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;
+ int i;
+
+ b0->bd_info = on->on_info->oi_orig;
+
+ for (i = gi->gi_nodes-1; i >= 0; i--) {
+ assert( gi->gi_n[i].gn_be->be_nsuffix != NULL );
+ op->o_bd = gi->gi_n[i].gn_be;
+ if ( op->o_bd == b0 )
+ continue;
+ if ( op->o_bd->bd_info->bi_op_abandon )
+ op->o_bd->bd_info->bi_op_abandon( op, rs );
+ }
+ op->o_bd = b0;
+ op->o_bd->bd_info = bi0;
+ return SLAP_CB_CONTINUE;
+}
+
static int
glue_response ( Operation *op, SlapReply *rs )
{
if ( op->o_bd == b0 )
return SLAP_CB_CONTINUE;
- rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
if (op->o_bd && op->o_bd->be_search) {
rs->sr_err = op->o_bd->be_search( op, rs );
+ } else {
+ rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
}
return rs->sr_err;
return rc;
}
+static int
+glue_access_allowed(
+ Operation *op,
+ Entry *e,
+ AttributeDescription *desc,
+ struct berval *val,
+ slap_access_t access,
+ AccessControlState *state,
+ slap_mask_t *maskp )
+{
+ BackendDB *b0, *be = glue_back_select( op->o_bd, &e->e_nname );
+ int rc;
+
+ if ( be == NULL || be == op->o_bd || be->bd_info->bi_access_allowed == NULL )
+ return SLAP_CB_CONTINUE;
+
+ b0 = op->o_bd;
+ op->o_bd = be;
+ rc = be->bd_info->bi_access_allowed ( op, e, desc, val, access, state, maskp );
+ op->o_bd = b0;
+ return rc;
+}
+
int
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_op_abandon = glue_op_abandon;
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_bi.bi_access_allowed = glue_access_allowed;
glue.on_response = glue_response;