mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
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:
parent
f1b8808010
commit
2ff82a82c5
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user