]> git.sur5r.net Git - openldap/commitdiff
import ITS#4828
authorPierangelo Masarati <ando@openldap.org>
Thu, 1 Feb 2007 22:20:21 +0000 (22:20 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 1 Feb 2007 22:20:21 +0000 (22:20 +0000)
CHANGES
servers/slapd/back-ldap/chain.c

diff --git a/CHANGES b/CHANGES
index 18bd0efc0ebb7a3b35445433e15522b72075cb35..cf98c78e61c6fd08f464335628c5ddfa6c3efb77 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -9,6 +9,7 @@ OpenLDAP 2.3.34 Engineering
        Fixed slapd-ldap more response handling bugs (ITS#4782)
        Fixed slapd-ldap C-API code tests (ITS#4808)
        Fixed slapd-monitor NULL printf (ITS#4811)
+       Fixed slapo-chain spurious additional info in response (ITS#4828)
        Fixed slapo-syncprov presence list (ITS#4813)
 
 OpenLDAP 2.3.33 Release (2007/01/17)
index cf3ffa33621e2e4e5459f7d15b8f5f3fdf14770e..08eeeb4f9381dd94cd8d6ccacbfd88b58c4a02d2 100644 (file)
@@ -414,6 +414,7 @@ ldap_chain_op(
        li.li_bvuri = bvuri;
        first_rc = -1;
        for ( ; !BER_BVISNULL( ref ); ref++ ) {
+               SlapReply       rs2 = { 0 };
                LDAPURLDesc     *srv = NULL;
                struct berval   save_req_dn = op->o_req_dn,
                                save_req_ndn = op->o_req_ndn,
@@ -523,7 +524,7 @@ Document: RFC 4511
                lb->lb_op_f = op_f;
                lb->lb_depth = depth + 1;
 
-               rc = op_f( op, rs );
+               rc = op_f( op, &rs2 );
 
                /* note the first error */
                if ( first_rc == -1 ) {
@@ -552,9 +553,12 @@ further_cleanup:;
                }
                op->o_req_ndn = save_req_ndn;
                
-               if ( rc == LDAP_SUCCESS && rs->sr_err == LDAP_SUCCESS ) {
+               if ( rc == LDAP_SUCCESS && rs2.sr_err == LDAP_SUCCESS ) {
+                       *rs = rs2;
                        break;
                }
+
+               rc = rs2.sr_err;
        }
 
 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
@@ -606,6 +610,7 @@ ldap_chain_search(
         * to be set once for all (correct?) */
        li.li_bvuri = bvuri;
        for ( ; !BER_BVISNULL( &ref[0] ); ref++ ) {
+               SlapReply       rs2 = { 0 };
                LDAPURLDesc     *srv;
                struct berval   save_req_dn = op->o_req_dn,
                                save_req_ndn = op->o_req_ndn,
@@ -702,7 +707,7 @@ ldap_chain_search(
 
                /* FIXME: should we also copy filter and scope?
                 * according to RFC3296, no */
-               rc = lback->bi_op_search( op, rs );
+               rc = lback->bi_op_search( op, &rs2 );
                if ( first_rc == -1 ) {
                        first_rc = rc;
                }
@@ -732,11 +737,12 @@ further_cleanup:;
                }
                op->o_req_ndn = save_req_ndn;
                
-               if ( rc == LDAP_SUCCESS && rs->sr_err == LDAP_SUCCESS ) {
+               if ( rc == LDAP_SUCCESS && rs2.sr_err == LDAP_SUCCESS ) {
+                       *rs = rs2;
                        break;
                }
 
-               rc = rs->sr_err;
+               rc = rs2.sr_err;
        }
 
 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
@@ -772,6 +778,7 @@ ldap_chain_response( Operation *op, SlapReply *rs )
        slap_callback   *sc = op->o_callback,
                        sc2 = { 0 };
        int             rc = 0;
+       char            *text = NULL;
        const char      *matched;
        BerVarray       ref;
        struct berval   ndn = op->o_ndn;
@@ -826,6 +833,8 @@ ldap_chain_response( Operation *op, SlapReply *rs )
        db = *op->o_bd;
        op->o_bd = &db;
 
+       text = rs->sr_text;
+       rs->sr_text = NULL;
        matched = rs->sr_matched;
        rs->sr_matched = NULL;
        ref = rs->sr_ref;
@@ -959,6 +968,7 @@ cannot_chain:;
                                rc = SLAP_CB_CONTINUE;
                                rs->sr_err = sr_err;
                                rs->sr_type = sr_type;
+                               rs->sr_text = text;
                                rs->sr_matched = matched;
                                rs->sr_ref = ref;
                        }
@@ -977,6 +987,7 @@ cannot_chain:;
 dont_chain:;
        rs->sr_err = sr_err;
        rs->sr_type = sr_type;
+       rs->sr_text = text;
        rs->sr_matched = matched;
        rs->sr_ref = ref;
        op->o_bd = bd;