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

Re: (ITS#4023) rewrite_session_var_set_f() bugs



I wrote:
> In test039 with bdb, rewrite_session_var_set_f() calls
> rewrite_session_return() which unlocks session->ls_mutex which is not
> locked.  From a brief look at the code, I think it comes from
> rewrite_session_init() when it returns a new session - without locking
> the mutex.

Yes: this patch to rewrite_session_var_set_f() fixes it.
Don't know if it is the right way to fix it.  It passes make test.
(It doesn't fix the session == NULL bug of course.)

--- libraries/librewrite/session.c	18 Jul 2005 04:22:33 -0000	1.13
+++ libraries/librewrite/session.c	13 Sep 2005 00:03:32 -0000
@@ -205,4 +205,8 @@
 	if ( session == NULL ) {
 		session = rewrite_session_init( info, cookie );
+#ifdef USE_REWRITE_LDAP_PVT_THREADS
+		if ( session )
+			ldap_pvt_thread_mutex_lock( &session->ls_mutex );
+#endif /* USE_REWRITE_LDAP_PVT_THREADS */
 	}
 

-- 
Hallvard