Tweaks to callback processing; callbacks can return SLAP_CB_CONTINUE to

fall into the regular send_ldap_* functionality instead of calling into
those functions explicitly. Nested callbacks still aren't handled as
cleanly as they might be.
This commit is contained in:
Howard Chu 2003-08-19 03:22:07 +00:00
parent f1b8808010
commit 2ff82a82c5
3 changed files with 13 additions and 14 deletions

View File

@ -187,11 +187,7 @@ glue_back_response ( Operation *op, SlapReply *rs )
op->o_callback = gs->prevcb;
if (op->o_callback && op->o_callback->sc_response) {
rs->sr_err = op->o_callback->sc_response( op, rs );
} else if (rs->sr_type == REP_SEARCH) {
rs->sr_err = send_search_entry( op, rs );
} else {
rs->sr_err = send_search_reference( op, rs );
}
} else rs->sr_err = SLAP_CB_CONTINUE;
op->o_callback = tmp;
return rs->sr_err;

View File

@ -130,21 +130,22 @@ over_back_response ( Operation *op, SlapReply *rs )
int rc = SLAP_CB_CONTINUE;
BackendDB *be = op->o_bd, db = *op->o_bd;
slap_callback *sc = op->o_callback->sc_private;
slap_callback *s0 = op->o_callback;
op->o_bd = &db;
op->o_callback = sc;
for (; on; on=on->on_next ) {
if ( on->on_response ) {
db.bd_info = (BackendInfo *)on;
rc = on->on_response( op, rs );
if ( ! (rc & SLAP_CB_CONTINUE) ) break;
if ( rc != SLAP_CB_CONTINUE ) break;
}
}
op->o_callback = sc;
if ( sc && (rc & SLAP_CB_CONTINUE) ) {
if ( sc && (rc == SLAP_CB_CONTINUE) ) {
rc = sc->sc_response( op, rs );
}
op->o_bd = be;
rc &= ~SLAP_CB_CONTINUE;
op->o_callback = s0;
return rc;
}

View File

@ -218,7 +218,7 @@ send_ldap_controls( BerElement *ber, LDAPControl **c )
return rc;
}
static void
void
send_ldap_response(
Operation *op,
SlapReply *rs )
@ -229,8 +229,8 @@ send_ldap_response(
long bytes;
if (op->o_callback && op->o_callback->sc_response) {
op->o_callback->sc_response( op, rs );
return;
rc = op->o_callback->sc_response( op, rs );
if ( rc != SLAP_CB_CONTINUE ) return;
}
#ifdef LDAP_CONNECTIONLESS
@ -608,7 +608,8 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
rs->sr_type = REP_SEARCH;
if (op->o_callback && op->o_callback->sc_response) {
return op->o_callback->sc_response( op, rs );
rc = op->o_callback->sc_response( op, rs );
if ( rc != SLAP_CB_CONTINUE ) return rc;
}
#ifdef NEW_LOGGING
@ -1225,7 +1226,8 @@ slap_send_search_reference( Operation *op, SlapReply *rs )
rs->sr_type = REP_SEARCHREF;
if (op->o_callback && op->o_callback->sc_response) {
return op->o_callback->sc_response( op, rs );
rc = op->o_callback->sc_response( op, rs );
if ( rc != SLAP_CB_CONTINUE ) return rc;
}
mark = sl_mark( op->o_tmpmemctx );