From 1bb48a06fcf392274a69ced5049b30dcc57c06f9 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 27 Sep 2003 07:36:20 +0000 Subject: [PATCH] ITS#2736 clear result strings --- servers/slapd/back-ldbm/add.c | 6 +++++- servers/slapd/back-ldbm/bind.c | 5 ++++- servers/slapd/back-ldbm/compare.c | 6 ++++-- servers/slapd/back-ldbm/delete.c | 6 ++++-- servers/slapd/back-ldbm/modify.c | 7 ++++++- servers/slapd/back-ldbm/modrdn.c | 7 ++++++- servers/slapd/back-ldbm/referral.c | 4 ++++ servers/slapd/back-ldbm/search.c | 4 ++++ 8 files changed, 37 insertions(+), 8 deletions(-) diff --git a/servers/slapd/back-ldbm/add.c b/servers/slapd/back-ldbm/add.c index 7406a93d7e..e4a5130b77 100644 --- a/servers/slapd/back-ldbm/add.c +++ b/servers/slapd/back-ldbm/add.c @@ -134,7 +134,8 @@ ldbm_back_add( ber_bvarray_free( rs->sr_ref ); free( (char *)rs->sr_matched ); - + rs->sr_ref = NULL; + rs->sr_matched = NULL; return rs->sr_err; } @@ -220,6 +221,8 @@ ldbm_back_add( ber_bvarray_free( rs->sr_ref ); free( (char *)rs->sr_matched ); + rs->sr_ref = NULL; + rs->sr_matched = NULL; return rs->sr_err; } @@ -408,6 +411,7 @@ ldbm_back_add( } rs->sr_err = LDAP_SUCCESS; + rs->sr_text = NULL; send_ldap_result( op, rs ); /* marks the entry as committed, so it is added to the cache; diff --git a/servers/slapd/back-ldbm/bind.c b/servers/slapd/back-ldbm/bind.c index 73ab8217d1..e84935af0e 100644 --- a/servers/slapd/back-ldbm/bind.c +++ b/servers/slapd/back-ldbm/bind.c @@ -81,6 +81,8 @@ ldbm_back_bind( if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref ); if ( rs->sr_matched ) free( (char *)rs->sr_matched ); + rs->sr_ref = NULL; + rs->sr_matched = NULL; return rs->sr_err; } @@ -145,7 +147,8 @@ ldbm_back_bind( send_ldap_result( op, rs ); ber_bvarray_free( rs->sr_ref ); - + rs->sr_matched = NULL; + rs->sr_ref = NULL; rc = rs->sr_err; goto return_results; } diff --git a/servers/slapd/back-ldbm/compare.c b/servers/slapd/back-ldbm/compare.c index 0f560e59d1..0c41f24477 100644 --- a/servers/slapd/back-ldbm/compare.c +++ b/servers/slapd/back-ldbm/compare.c @@ -50,7 +50,8 @@ ldbm_back_compare( if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref ); free( (char *)rs->sr_matched ); - + rs->sr_ref = NULL; + rs->sr_matched = NULL; return( 1 ); } @@ -72,7 +73,8 @@ ldbm_back_compare( send_ldap_result( op, rs ); if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref ); - + rs->sr_ref = NULL; + rs->sr_matched = NULL; rs->sr_err = 1; goto return_results; } diff --git a/servers/slapd/back-ldbm/delete.c b/servers/slapd/back-ldbm/delete.c index 73ce466683..edcfbf5be4 100644 --- a/servers/slapd/back-ldbm/delete.c +++ b/servers/slapd/back-ldbm/delete.c @@ -72,7 +72,8 @@ ldbm_back_delete( if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref ); free( (char *)rs->sr_matched ); - + rs->sr_ref = NULL; + rs->sr_matched = NULL; return( -1 ); } @@ -115,7 +116,8 @@ ldbm_back_delete( send_ldap_result( op, rs ); if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref ); - + rs->sr_ref = NULL; + rs->sr_matched = NULL; rc = LDAP_REFERRAL; goto return_results; } diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index 1e78935a79..290f29c02f 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -335,6 +335,8 @@ ldbm_back_modify( if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref ); free( (char *)rs->sr_matched ); + rs->sr_ref = NULL; + rs->sr_matched = NULL; return rs->sr_err; } @@ -357,7 +359,8 @@ ldbm_back_modify( send_ldap_result( op, rs ); if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref ); - + rs->sr_ref = NULL; + rs->sr_matched = NULL; goto error_return; } @@ -381,6 +384,7 @@ ldbm_back_modify( goto error_return; } + rs->sr_text = NULL; send_ldap_error( op, rs, LDAP_SUCCESS, NULL ); @@ -392,5 +396,6 @@ ldbm_back_modify( error_return:; cache_return_entry_w( &li->li_cache, e ); ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock); + rs->sr_text = NULL; return rs->sr_err; } diff --git a/servers/slapd/back-ldbm/modrdn.c b/servers/slapd/back-ldbm/modrdn.c index 6897e34866..4a41506151 100644 --- a/servers/slapd/back-ldbm/modrdn.c +++ b/servers/slapd/back-ldbm/modrdn.c @@ -104,7 +104,8 @@ ldbm_back_modrdn( if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref ); free( (char *)rs->sr_matched ); - + rs->sr_ref = NULL; + rs->sr_matched = NULL; return rs->sr_err; } @@ -146,6 +147,8 @@ ldbm_back_modrdn( send_ldap_result( op, rs ); if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref ); + rs->sr_ref = NULL; + rs->sr_matched = NULL; goto return_results; } @@ -633,6 +636,7 @@ ldbm_back_modrdn( } rs->sr_err = LDAP_SUCCESS; + rs->sr_text = NULL; send_ldap_result( op, rs ); rc = 0; cache_entry_commit( e ); @@ -677,5 +681,6 @@ return_results: entry_free( e ); } ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock); + rs->sr_text = NULL; return( rc ); } diff --git a/servers/slapd/back-ldbm/referral.c b/servers/slapd/back-ldbm/referral.c index 6aedb91e5f..fc14eb993c 100644 --- a/servers/slapd/back-ldbm/referral.c +++ b/servers/slapd/back-ldbm/referral.c @@ -79,6 +79,8 @@ ldbm_back_referrals( } if ( rs->sr_matched ) free( (char *)rs->sr_matched ); + rs->sr_ref = NULL; + rs->sr_matched = NULL; return rs->sr_err; } @@ -111,6 +113,8 @@ ldbm_back_referrals( } if( refs != NULL ) ber_bvarray_free( refs ); + rs->sr_ref = NULL; + rs->sr_matched = NULL; } cache_return_entry_r( &li->li_cache, e ); diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index 4a46352208..8d3949cc67 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -111,6 +111,8 @@ ldbm_back_search( ber_bvarray_free( rs->sr_ref ); ber_memfree( matched_dn.bv_val ); + rs->sr_ref = NULL; + rs->sr_matched = NULL; return LDAP_REFERRAL; } @@ -155,6 +157,8 @@ ldbm_back_search( } ber_memfree( matched_dn.bv_val ); + rs->sr_ref = NULL; + rs->sr_matched = NULL; return LDAP_OTHER; } -- 2.39.5