diff options
author | Jeff Trawick <trawick@apache.org> | 2002-10-01 19:54:15 +0200 |
---|---|---|
committer | Jeff Trawick <trawick@apache.org> | 2002-10-01 19:54:15 +0200 |
commit | 71fe98fdcec0a63e5ddd21dbf7a54e2155cf0af4 (patch) | |
tree | 2ab3d10c3a4f687e45168b30009f8c7eefeaeae3 /modules | |
parent | bleeble blooble blam (diff) | |
download | apache2-71fe98fdcec0a63e5ddd21dbf7a54e2155cf0af4.tar.xz apache2-71fe98fdcec0a63e5ddd21dbf7a54e2155cf0af4.zip |
Fix a mutex problem in mod_ssl session cache support which
could lead to an infinite loop.
PR: 12705
Diagnosis submitted by: amund.elstad@ergo.no (Amund Elstad)
Coded by: Jeff Trawick
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97048 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules')
-rw-r--r-- | modules/ssl/ssl_scache_dbm.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/ssl/ssl_scache_dbm.c b/modules/ssl/ssl_scache_dbm.c index 1b0054c3ad..57a88ac15a 100644 --- a/modules/ssl/ssl_scache_dbm.c +++ b/modules/ssl/ssl_scache_dbm.c @@ -228,21 +228,25 @@ SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *s, UCHAR *id, int idlen) * XXX: Should we open the dbm against r->pool so the cleanup will * do the apr_dbm_close? This would make the code a bit cleaner. */ + ssl_mutex_on(s); if ((rc = apr_dbm_open(&dbm, mc->szSessionCacheDataFile, APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rc, s, "Cannot open SSLSessionCache DBM file `%s' for reading " "(fetch)", mc->szSessionCacheDataFile); + ssl_mutex_off(s); return NULL; } rc = apr_dbm_fetch(dbm, dbmkey, &dbmval); if (rc != APR_SUCCESS) { apr_dbm_close(dbm); + ssl_mutex_off(s); return NULL; } if (dbmval.dptr == NULL || dbmval.dsize <= sizeof(time_t)) { apr_dbm_close(dbm); + ssl_mutex_off(s); return NULL; } @@ -251,12 +255,14 @@ SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *s, UCHAR *id, int idlen) ucpData = (UCHAR *)malloc(nData); if (ucpData == NULL) { apr_dbm_close(dbm); + ssl_mutex_off(s); return NULL; } memcpy(ucpData, (char *)dbmval.dptr+sizeof(time_t), nData); memcpy(&expiry, dbmval.dptr, sizeof(time_t)); apr_dbm_close(dbm); + ssl_mutex_off(s); /* make sure the stuff is still not expired */ now = time(NULL); |