ITS#6758 Reset some SlapReply flags & data.

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.
This commit is contained in:
Hallvard Furuseth 2010-12-30 23:55:07 +00:00
parent f7a77545ad
commit d2b024be4a
12 changed files with 27 additions and 4 deletions

View 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;

View 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;
}

View 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;
}

View 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;
}
}

View 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;
}

View 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 );

View 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;
}

View 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;

View 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;

View 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 */

View 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 */

View 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 );