[Date Prev][Date Next] [Chronological] [Thread] [Top]

back-ldbm logs garbage, potentially crashing the server (ITS#2736)



Full_Name: Oliver Eikemeier
Version: 2.2.1beta
OS: FreeBSD 5.1-CURRENT
URL: 
Submission from: (NULL) (80.128.184.67)


How-To-Repeat:

  cd tests; make test-ldbm

do

  grep '^send_ldap_result: err' test-db/master.log

while test002-populate is running. lt-slapd
reproducibly  cored on my machine.

Fix:

--- back-ldbm.patch begins here ---
--- servers/slapd/back-ldbm/add.c.orig	Wed Sep 24 03:04:57 2003
+++ servers/slapd/back-ldbm/add.c	Wed Sep 24 03:25:24 2003
@@ -134,7 +134,8 @@
 
 			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 @@
 
 			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 @@
 	}
 
 	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;
--- servers/slapd/back-ldbm/bind.c.orig	Wed Sep 24 03:42:14 2003
+++ servers/slapd/back-ldbm/bind.c	Wed Sep 24 03:47:49 2003
@@ -81,6 +81,8 @@
 
 		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 @@
 		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;
 	}
--- servers/slapd/back-ldbm/compare.c.orig	Wed Sep 24 03:46:04 2003
+++ servers/slapd/back-ldbm/compare.c	Wed Sep 24 03:47:10 2003
@@ -50,7 +50,8 @@
 
 		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 @@
 		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;
 	}
--- servers/slapd/back-ldbm/delete.c.orig	Wed Sep 24 03:48:25 2003
+++ servers/slapd/back-ldbm/delete.c	Wed Sep 24 03:49:30 2003
@@ -72,7 +72,8 @@
 
 		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 @@
 		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;
 	}
--- servers/slapd/back-ldbm/modify.c.orig	Wed Sep 24 03:49:57 2003
+++ servers/slapd/back-ldbm/modify.c	Wed Sep 24 04:44:23 2003
@@ -335,6 +335,8 @@
 		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 @@
 		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 @@
 		goto error_return;
 	}
 
+	rs->sr_text = NULL;
 	send_ldap_error( op, rs, LDAP_SUCCESS,
 		NULL );
 
@@ -392,5 +396,6 @@
 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;
 }
--- servers/slapd/back-ldbm/modrdn.c.orig	Wed Sep 24 03:51:35 2003
+++ servers/slapd/back-ldbm/modrdn.c	Wed Sep 24 05:01:46 2003
@@ -104,7 +104,8 @@
 
 		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 @@
 		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 @@
 	}
 
 	rs->sr_err = LDAP_SUCCESS;
+	rs->sr_text = NULL;
 	send_ldap_result( op, rs );
 	rc = 0;
 	cache_entry_commit( e );
@@ -677,5 +681,6 @@
 		entry_free( e );
 	}
 	ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
+	rs->sr_text = NULL;
 	return( rc );
 }
--- servers/slapd/back-ldbm/referral.c.orig	Wed Sep 24 03:54:08 2003
+++ servers/slapd/back-ldbm/referral.c	Wed Sep 24 03:55:24 2003
@@ -79,6 +79,8 @@
 		}
 
 		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 @@
 		}
 
 		if( refs != NULL ) ber_bvarray_free( refs );
+		rs->sr_ref = NULL;
+		rs->sr_matched = NULL;
 	}
 
 	cache_return_entry_r( &li->li_cache, e );
--- servers/slapd/back-ldbm/search.c.orig	Wed Sep 24 03:55:44 2003
+++ servers/slapd/back-ldbm/search.c	Wed Sep 24 03:56:46 2003
@@ -111,6 +111,8 @@
 
 		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 @@
 		}
 
 		ber_memfree( matched_dn.bv_val );
+		rs->sr_ref = NULL;
+		rs->sr_matched = NULL;
 		return LDAP_OTHER;
 	}
 
--- back-ldbm.patch ends here ---