]> git.sur5r.net Git - openldap/commitdiff
ITS#6758 Reset some SlapReply flags & data.
authorHallvard Furuseth <hallvard@openldap.org>
Thu, 30 Dec 2010 23:55:07 +0000 (23:55 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Thu, 30 Dec 2010 23:55:07 +0000 (23:55 +0000)
Reset data more consistenlty.  When resetting sr_entry after sending
data, reset sr_flag as well.  Reset rs_attrs and Extended Operation
oid/data after setting and sending them.

12 files changed:
servers/slapd/back-bdb/search.c
servers/slapd/back-dnssrv/search.c
servers/slapd/back-ldap/search.c
servers/slapd/back-ldif/ldif.c
servers/slapd/back-ndb/search.cpp
servers/slapd/back-passwd/search.c
servers/slapd/back-perl/search.c
servers/slapd/back-shell/result.c
servers/slapd/back-sock/result.c
servers/slapd/extended.c
servers/slapd/overlays/retcode.c
servers/slapd/overlays/translucent.c

index d25bf0c077da55209b3d5b69c02cb1787d9e143e..9cc950f401c047cedf6ae2a0df76fd50712165f5 100644 (file)
@@ -959,6 +959,7 @@ fetch_entry_retry:
                                rs->sr_flags = REP_ENTRY_MUSTRELEASE;
                                rs->sr_err = LDAP_SUCCESS;
                                rs->sr_err = send_search_entry( op, rs );
+                               rs->sr_attrs = NULL;
 
                                /* send_search_entry will usually free it.
                                 * an overlay might leave its own copy here;
index 83a79cd4171980cb5d3a3b83fc177a4bc52890ba..b39069d8273e59ca9e4b06893aa8a7a7b9fe404c 100644 (file)
@@ -219,6 +219,7 @@ dnssrv_back_search(
                        send_search_entry( op, rs );
                        rs->sr_entry = NULL;
                        rs->sr_attrs = NULL;
+                       rs->sr_flags = 0;
                }
 
                entry_clean( &e );
@@ -237,4 +238,3 @@ done:
        if( urls != NULL ) ber_bvarray_free( urls );
        return 0;
 }
-
index 7bde44d763c58d4abde5ff2062c37f125e7b267c..5c0a1f96ce8e137474d37db2ecc28dbb6bf9ae30 100644 (file)
@@ -371,6 +371,7 @@ retry:
                                        rs->sr_ctrls = NULL;
                                }
                                rs->sr_entry = NULL;
+                               rs->sr_flags = 0;
                                if ( !BER_BVISNULL( &ent.e_name ) ) {
                                        assert( ent.e_name.bv_val != bdn.bv_val );
                                        op->o_tmpfree( ent.e_name.bv_val, op->o_tmpmemctx );
@@ -428,6 +429,7 @@ retry:
                                BER_BVZERO( &rs->sr_ref[ cnt ] );
 
                                /* ignore return value by now */
+                               RS_ASSERT( !(rs->sr_flags & REP_ENTRY_MASK) );
                                rs->sr_entry = NULL;
                                ( void )send_search_reference( op, rs );
 
@@ -1011,4 +1013,3 @@ cleanup:
 
        return rc;
 }
-
index 61f94504f478f3ec51c07a2ee3ac365edff2ae6a..11d2157b0a7b626db76541ffc1d17dbd930accf0 100644 (file)
@@ -660,9 +660,14 @@ ldif_send_entry( Operation *op, SlapReply *rs, Entry *e, int scope )
                else if ( test_filter( op, e, op->ors_filter ) == LDAP_COMPARE_TRUE ) {
                        rs->sr_entry = e;
                        rs->sr_attrs = op->ors_attrs;
+                       /* Could set REP_ENTRY_MUSTBEFREED too for efficiency,
+                        * but refraining lets us test unFREEable MODIFIABLE
+                        * entries.  Like entries built on the stack.
+                        */
                        rs->sr_flags = REP_ENTRY_MODIFIABLE;
                        rc = send_search_entry( op, rs );
                        rs->sr_entry = NULL;
+                       rs->sr_attrs = NULL;
                }
        }
 
index 90e49b9823e29b1f3b2995adc769654c6626990c..a2573c50c6532cdfb970927c1d8ffa7d60ae8c51 100644 (file)
@@ -483,6 +483,7 @@ static int ndb_oc_search( Operation *op, SlapReply *rs, Ndb *ndb, NdbTransaction
                                rs->sr_flags = 0;
                                rc = send_search_entry( op, rs );
                                rs->sr_entry = NULL;
+                               rs->sr_attrs = NULL;
                        } else {
                                rc = 0;
                        }
index b5b3fcd581a56b1c16cfdb0457b1ac240f4ad5eb..47c6260b9cfb1814e1f6c8ae94056d8736204521 100644 (file)
@@ -123,6 +123,8 @@ passwd_back_search(
                                rs->sr_attrs = op->ors_attrs;
                                rs->sr_flags = REP_ENTRY_MODIFIABLE;
                                send_search_entry( op, rs );
+                               rs->sr_flags = 0;
+                               rs->sr_attrs = NULL;
                        }
 
                        entry_clean( &e );
@@ -173,6 +175,8 @@ passwd_back_search(
                                        rs->sr_attrs = op->ors_attrs;
                                        rs->sr_flags = REP_ENTRY_MODIFIABLE;
                                        send_search_entry( op, rs );
+                                       rs->sr_flags = 0;
+                                       rs->sr_entry = NULL;
                                }
 
                                entry_clean( &e );
@@ -238,6 +242,9 @@ passwd_back_search(
                        rs->sr_attrs = op->ors_attrs;
                        rs->sr_flags = REP_ENTRY_MODIFIABLE;
                        send_search_entry( op, rs );
+                       rs->sr_flags = 0;
+                       rs->sr_entry = NULL;
+                       rs->sr_attrs = NULL;
                }
 
                entry_clean( &e );
index 6e852e02c73965086d0fb5b55a9614aa9c0eeb24..ebdef6798901e0b15f72245e664bc5c797b16d22 100644 (file)
@@ -92,8 +92,10 @@ perl_back_search(
                                                rs->sr_flags = REP_ENTRY_MODIFIABLE;
                                                rs->sr_err = LDAP_SUCCESS;
                                                rs->sr_err = send_search_entry( op, rs );
+                                               rs->sr_flags = 0;
+                                               rs->sr_attrs = NULL;
+                                               rs->sr_entry = NULL;
                                                if ( rs->sr_err == LDAP_SIZELIMIT_EXCEEDED ) {
-                                                       rs->sr_entry = NULL;
                                                        goto done;
                                                }
                                        }
@@ -124,4 +126,3 @@ done:;
 
        return 0;
 }
-
index 0862d7d4499e294e582c0fe5bd48e1b851a5783f..bea0cf821d6d93028b00a73ea69d40345c2a7862 100644 (file)
@@ -103,6 +103,7 @@ read_and_send_results(
                                rs->sr_flags = REP_ENTRY_MODIFIABLE;
                                send_search_entry( op, rs );
                                entry_free( rs->sr_entry );
+                               rs->sr_attrs = NULL;
                        }
 
                        bp = buf;
index 3c8b69d207c03cc01511393b3fa68a0a77486266..a5195cac6a1b4c183db9921874aa5f88ea4cd96b 100644 (file)
@@ -100,6 +100,7 @@ sock_read_and_send_results(
                                rs->sr_flags = REP_ENTRY_MODIFIABLE;
                                send_search_entry( op, rs );
                                entry_free( rs->sr_entry );
+                               rs->sr_attrs = NULL;
                        }
 
                        bp = buf;
index a105ddfaa775b036b59cb3822ce927336acaa15d..19feb5404573c06f1ec89c82999ecb35af486562 100644 (file)
@@ -244,10 +244,12 @@ fe_extended( Operation *op, SlapReply *rs )
 
                if ( rs->sr_rspoid != NULL ) {
                        free( (char *)rs->sr_rspoid );
+                       rs->sr_rspoid = NULL;
                }
 
                if ( rs->sr_rspdata != NULL ) {
                        ber_bvfree( rs->sr_rspdata );
+                       rs->sr_rspdata = NULL;
                }
        } /* end of OpenLDAP extended operation */
 
index e77fa6d2fdcb00ea30def05aa00328ac491f81a8..ffa2e61570a82a6e22015bf8a60401bc9fcb10b5 100644 (file)
@@ -165,7 +165,9 @@ retcode_send_onelevel( Operation *op, SlapReply *rs )
                        rs->sr_entry = &rdi->rdi_e;
 
                        rs->sr_err = send_search_entry( op, rs );
+                       rs->sr_flags = 0;
                        rs->sr_entry = NULL;
+                       rs->sr_attrs = NULL;
 
                        switch ( rs->sr_err ) {
                        case LDAP_UNAVAILABLE:  /* connection closed */
index d4d77b2551822c5d9d25ec329ea539fe8d5322c7..2b07607898076403a9ccc49b9a41ba34efbaf617 100644 (file)
@@ -1169,6 +1169,7 @@ static int translucent_search(Operation *op, SlapReply *rs) {
                                av = tavl_next( av, TAVL_DIR_RIGHT );
                        }
                        tavl_free( tc.list, NULL );
+                       rs->sr_flags = 0;
                        rs->sr_entry = NULL;
                }
                send_ldap_result( op, rs );