typedef struct glue_state {
int err;
- int slimit;
int matchlen;
char *matched;
int nrefs;
switch(rs->sr_type) {
case REP_SEARCH:
- if ( gs->slimit != SLAP_NO_LIMIT
- && rs->sr_nentries >= gs->slimit )
- {
- rs->sr_err = gs->err = LDAP_SIZELIMIT_EXCEEDED;
- return -1;
- }
- /* fallthru */
case REP_SEARCHREF:
return SLAP_CB_CONTINUE;
BackendDB *b0 = op->o_bd;
BackendInfo *bi0 = op->o_bd->bd_info;
BI_op_modify **func;
- slap_operation_t which;
+ slap_operation_t which = op_bind;
int rc;
op->o_bd = glue_back_select (b0, &op->o_req_ndn);
case LDAP_REQ_DELETE: which = op_delete; break;
case LDAP_REQ_MODIFY: which = op_modify; break;
case LDAP_REQ_MODRDN: which = op_modrdn; break;
+ default: assert( 0 ); break;
}
func = &op->o_bd->bd_info->bi_op_bind;
BackendInfo *bi0 = op->o_bd->bd_info;
int i;
long stoptime = 0;
- glue_state gs = {0, 0, 0, NULL, 0, NULL};
+ glue_state gs = {0, 0, NULL, 0, NULL};
slap_callback cb = { NULL, glue_op_response, NULL, NULL };
- int scope0, slimit0, tlimit0;
+ int scope0, tlimit0;
struct berval dn, ndn, *pdn;
cb.sc_private = &gs;
case LDAP_SCOPE_ONELEVEL:
case LDAP_SCOPE_SUBTREE:
-#ifdef LDAP_SCOPE_SUBORDINATE
case LDAP_SCOPE_SUBORDINATE: /* FIXME */
-#endif
#if 0
if ( op->o_sync ) {
op->o_callback = &cb;
rs->sr_err = gs.err = LDAP_UNWILLING_TO_PERFORM;
scope0 = op->ors_scope;
- slimit0 = gs.slimit = op->ors_slimit;
tlimit0 = op->ors_tlimit;
dn = op->o_req_dn;
ndn = op->o_req_ndn;
break;
}
}
- if (slimit0 != SLAP_NO_LIMIT) {
- op->ors_slimit = slimit0 - rs->sr_nentries;
- if (op->ors_slimit < 0) {
- rs->sr_err = gs.err = LDAP_SIZELIMIT_EXCEEDED;
- break;
- }
- }
rs->sr_err = 0;
/*
* check for abandon
op->o_req_dn = op->o_bd->be_suffix[0];
op->o_req_ndn = op->o_bd->be_nsuffix[0];
rs->sr_err = op->o_bd->be_search(op, rs);
+ if ( rs->sr_err == LDAP_NO_SUCH_OBJECT ) {
+ gs.err = LDAP_SUCCESS;
+ }
} else if (scope0 == LDAP_SCOPE_SUBTREE &&
dn_match(&op->o_bd->be_nsuffix[0], &ndn))
if ( rs->sr_err == LDAP_NO_SUCH_OBJECT ) {
gs.err = LDAP_SUCCESS;
}
+ op->o_req_dn = dn;
+ op->o_req_ndn = ndn;
} else if (dnIsSuffix(&ndn, &op->o_bd->be_nsuffix[0])) {
rs->sr_err = op->o_bd->be_search( op, rs );
case LDAP_ADMINLIMIT_EXCEEDED:
case LDAP_NO_SUCH_OBJECT:
#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
- case LDAP_CANNOT_CHAIN:
+ case LDAP_X_CANNOT_CHAIN:
#endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
goto end_of_loop;
}
end_of_loop:;
op->ors_scope = scope0;
- op->ors_slimit = slimit0;
op->ors_tlimit = tlimit0;
op->o_req_dn = dn;
op->o_req_ndn = ndn;
{
slap_overinst *on = (slap_overinst *)be->bd_info;
slap_overinfo *oi = on->on_info;
+ BackendInfo *bi = oi->oi_orig;
glueinfo *gi;
gi = ch_calloc( 1, sizeof(glueinfo));
oi->oi_bi.bi_entry_release_rw = glue_entry_release_rw;
- oi->oi_bi.bi_tool_entry_open = glue_tool_entry_open;
- oi->oi_bi.bi_tool_entry_close = glue_tool_entry_close;
- oi->oi_bi.bi_tool_entry_first = glue_tool_entry_first;
- oi->oi_bi.bi_tool_entry_next = glue_tool_entry_next;
- oi->oi_bi.bi_tool_entry_get = glue_tool_entry_get;
- oi->oi_bi.bi_tool_entry_put = glue_tool_entry_put;
- oi->oi_bi.bi_tool_entry_reindex = glue_tool_entry_reindex;
- oi->oi_bi.bi_tool_sync = glue_tool_sync;
+ /* Only advertise these if the root DB supports them */
+ if ( bi->bi_tool_entry_open )
+ oi->oi_bi.bi_tool_entry_open = glue_tool_entry_open;
+ if ( bi->bi_tool_entry_close )
+ oi->oi_bi.bi_tool_entry_close = glue_tool_entry_close;
+ if ( bi->bi_tool_entry_first )
+ oi->oi_bi.bi_tool_entry_first = glue_tool_entry_first;
+ if ( bi->bi_tool_entry_next )
+ oi->oi_bi.bi_tool_entry_next = glue_tool_entry_next;
+ if ( bi->bi_tool_entry_get )
+ oi->oi_bi.bi_tool_entry_get = glue_tool_entry_get;
+ if ( bi->bi_tool_entry_put )
+ oi->oi_bi.bi_tool_entry_put = glue_tool_entry_put;
+ if ( bi->bi_tool_entry_reindex )
+ oi->oi_bi.bi_tool_entry_reindex = glue_tool_entry_reindex;
+ if ( bi->bi_tool_sync )
+ oi->oi_bi.bi_tool_sync = glue_tool_sync;
/*FIXME : need to add support */
oi->oi_bi.bi_tool_dn2id_get = 0;
static glue_Addrec *ga_list;
/* Attach all the subordinate backends to their superior */
-static int
+int
glue_sub_attach()
{
glue_Addrec *ga, *gnext = NULL;
SLAP_DBFLAGS( be ) |= SLAP_DBFLAG_GLUE_ADVERTISE;
ga = ch_malloc( sizeof( glue_Addrec ));
- ga->ga_next = NULL;
+ ga->ga_next = ga_list;
ga->ga_be = be;
- if ( ga_list ) {
- glue_Addrec *g2 = ga_list;
-
- for ( ; g2 && g2->ga_next; g2=g2->ga_next );
- g2->ga_next = ga;
- } else {
- ga_list = ga;
- }
+ ga_list = ga;
if ( online )
rc = glue_sub_attach();
int
glue_sub_init()
{
- int rc;
-
glue.on_bi.bi_type = "glue";
glue.on_bi.bi_db_init = glue_db_init;
glue.on_bi.bi_chk_referrals = glue_chk_referrals;
glue.on_bi.bi_chk_controls = glue_chk_controls;
- rc = overlay_register( &glue );
- if ( rc ) return rc;
-
- return glue_sub_attach();
+ return overlay_register( &glue );
}