]> git.sur5r.net Git - openldap/commitdiff
Tweaks to callback processing; callbacks can return SLAP_CB_CONTINUE to
authorHoward Chu <hyc@openldap.org>
Tue, 19 Aug 2003 03:22:07 +0000 (03:22 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 19 Aug 2003 03:22:07 +0000 (03:22 +0000)
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.

servers/slapd/backglue.c
servers/slapd/backover.c
servers/slapd/result.c

index e60be088babe4c7f72370563df1c0937ff2b4da2..a22be0a1c51bc93f3e275cf0e803348e89b28698 100644 (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;
 
index 875c35e722cfe2be0fc5304fed30e17f16d3eba4..29edb8470c3615e61741752376c611ad166d173a 100644 (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;
 }
 
index 37a6f003301cd577448b47983691e0e5330477eb..e59f4a434c53323bbd46eef314f5557e93e75da5 100644 (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 );