static int glueMode;
static BackendDB *glueBack;
+static BackendDB glueBackDone;
+#define GLUEBACK_DONE (&glueBackDone)
static slap_response glue_op_response;
{
int rc = 0;
- if (glueBack) {
+ if (glueBack && glueBack != GLUEBACK_DONE) {
if (!glueBack->be_entry_close)
return 0;
rc = glueBack->be_entry_close (glueBack);
slap_overinst *on = glue_tool_inst( b0->bd_info );
glueinfo *gi = on->on_bi.bi_private;
int i;
+ ID rc;
/* If we're starting from scratch, start at the most general */
if (!glueBack) {
glueBack->be_entry_open (glueBack, glueMode) != 0)
return NOID;
- return glueBack->be_entry_first (glueBack);
+ rc = glueBack->be_entry_first (glueBack);
+ while ( rc == NOID ) {
+ if ( glueBack && glueBack->be_entry_close )
+ glueBack->be_entry_close (glueBack);
+ for (i=0; i<gi->gi_nodes; i++) {
+ if (gi->gi_n[i].gn_be == glueBack)
+ break;
+ }
+ if (i == 0) {
+ glueBack = GLUEBACK_DONE;
+ break;
+ } else {
+ glueBack = gi->gi_n[i-1].gn_be;
+ rc = glue_tool_entry_first (b0);
+ if ( glueBack == GLUEBACK_DONE ) {
+ break;
+ }
+ }
+ }
+ return rc;
}
static ID
break;
}
if (i == 0) {
- glueBack = NULL;
+ glueBack = GLUEBACK_DONE;
break;
} else {
glueBack = gi->gi_n[i-1].gn_be;
rc = glue_tool_entry_first (b0);
+ if ( glueBack == GLUEBACK_DONE ) {
+ break;
+ }
}
}
return rc;