mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
For the DBM SSL Session Cache, propogate down pools to use for allocations. In most cases, we can use the conn_rec::pool, but for ssl_callback_DelSessionCacheEntry, we still use the long lived configuration pool, but this change at least makes it easier to fix in the future.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@545610 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1638,7 +1638,7 @@ int ssl_callback_NewSessionCacheEntry(SSL *ssl, SSL_SESSION *session)
|
|||||||
|
|
||||||
timeout += modssl_session_get_time(session);
|
timeout += modssl_session_get_time(session);
|
||||||
|
|
||||||
rc = ssl_scache_store(s, id, idlen, timeout, session);
|
rc = ssl_scache_store(s, id, idlen, timeout, session, conn->pool);
|
||||||
|
|
||||||
ssl_session_log(s, "SET", id, idlen,
|
ssl_session_log(s, "SET", id, idlen,
|
||||||
rc == TRUE ? "OK" : "BAD",
|
rc == TRUE ? "OK" : "BAD",
|
||||||
@@ -1716,7 +1716,8 @@ void ssl_callback_DelSessionCacheEntry(SSL_CTX *ctx,
|
|||||||
id = SSL_SESSION_get_session_id(session);
|
id = SSL_SESSION_get_session_id(session);
|
||||||
idlen = SSL_SESSION_get_session_id_length(session);
|
idlen = SSL_SESSION_get_session_id_length(session);
|
||||||
|
|
||||||
ssl_scache_remove(s, id, idlen);
|
/* TODO: Do we need a temp pool here, or are we always shutting down? */
|
||||||
|
ssl_scache_remove(s, id, idlen, sc->mc->pPool);
|
||||||
|
|
||||||
ssl_session_log(s, "REM", id, idlen,
|
ssl_session_log(s, "REM", id, idlen,
|
||||||
"OK", "dead", 0);
|
"OK", "dead", 0);
|
||||||
|
@@ -575,17 +575,22 @@ void ssl_callback_LogTracingState(MODSSL_INFO_CB_ARG_TYPE, int, int);
|
|||||||
void ssl_scache_init(server_rec *, apr_pool_t *);
|
void ssl_scache_init(server_rec *, apr_pool_t *);
|
||||||
void ssl_scache_status_register(apr_pool_t *p);
|
void ssl_scache_status_register(apr_pool_t *p);
|
||||||
void ssl_scache_kill(server_rec *);
|
void ssl_scache_kill(server_rec *);
|
||||||
BOOL ssl_scache_store(server_rec *, UCHAR *, int, time_t, SSL_SESSION *);
|
BOOL ssl_scache_store(server_rec *, UCHAR *, int,
|
||||||
|
time_t, SSL_SESSION *, apr_pool_t *);
|
||||||
SSL_SESSION *ssl_scache_retrieve(server_rec *, UCHAR *, int, apr_pool_t *);
|
SSL_SESSION *ssl_scache_retrieve(server_rec *, UCHAR *, int, apr_pool_t *);
|
||||||
void ssl_scache_remove(server_rec *, UCHAR *, int);
|
void ssl_scache_remove(server_rec *, UCHAR *, int,
|
||||||
|
apr_pool_t *);
|
||||||
|
|
||||||
char *ssl_scache_id2sz(UCHAR *, int);
|
char *ssl_scache_id2sz(UCHAR *, int);
|
||||||
void ssl_scache_dbm_init(server_rec *, apr_pool_t *);
|
void ssl_scache_dbm_init(server_rec *, apr_pool_t *);
|
||||||
void ssl_scache_dbm_kill(server_rec *);
|
void ssl_scache_dbm_kill(server_rec *);
|
||||||
BOOL ssl_scache_dbm_store(server_rec *, UCHAR *, int, time_t, SSL_SESSION *);
|
BOOL ssl_scache_dbm_store(server_rec *, UCHAR *, int,
|
||||||
SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *, UCHAR *, int);
|
time_t, SSL_SESSION *, apr_pool_t *);
|
||||||
void ssl_scache_dbm_remove(server_rec *, UCHAR *, int);
|
SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *, UCHAR *, int,
|
||||||
void ssl_scache_dbm_status(request_rec *r, int flags, apr_pool_t *pool);
|
apr_pool_t *);
|
||||||
|
void ssl_scache_dbm_remove(server_rec *, UCHAR *, int,
|
||||||
|
apr_pool_t *);
|
||||||
|
void ssl_scache_dbm_status(request_rec *r, int flags, apr_pool_t *);
|
||||||
|
|
||||||
void ssl_scache_shmcb_init(server_rec *, apr_pool_t *);
|
void ssl_scache_shmcb_init(server_rec *, apr_pool_t *);
|
||||||
void ssl_scache_shmcb_kill(server_rec *);
|
void ssl_scache_shmcb_kill(server_rec *);
|
||||||
|
@@ -96,13 +96,15 @@ void ssl_scache_kill(server_rec *s)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ssl_scache_store(server_rec *s, UCHAR *id, int idlen, time_t expiry, SSL_SESSION *sess)
|
BOOL ssl_scache_store(server_rec *s, UCHAR *id, int idlen,
|
||||||
|
time_t expiry, SSL_SESSION *sess,
|
||||||
|
apr_pool_t *p)
|
||||||
{
|
{
|
||||||
SSLModConfigRec *mc = myModConfig(s);
|
SSLModConfigRec *mc = myModConfig(s);
|
||||||
BOOL rv = FALSE;
|
BOOL rv = FALSE;
|
||||||
|
|
||||||
if (mc->nSessionCacheMode == SSL_SCMODE_DBM)
|
if (mc->nSessionCacheMode == SSL_SCMODE_DBM)
|
||||||
rv = ssl_scache_dbm_store(s, id, idlen, expiry, sess);
|
rv = ssl_scache_dbm_store(s, id, idlen, expiry, sess, p);
|
||||||
else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB)
|
else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB)
|
||||||
rv = ssl_scache_shmcb_store(s, id, idlen, expiry, sess);
|
rv = ssl_scache_shmcb_store(s, id, idlen, expiry, sess);
|
||||||
#ifdef HAVE_DISTCACHE
|
#ifdef HAVE_DISTCACHE
|
||||||
@@ -123,7 +125,7 @@ SSL_SESSION *ssl_scache_retrieve(server_rec *s, UCHAR *id, int idlen,
|
|||||||
SSL_SESSION *sess = NULL;
|
SSL_SESSION *sess = NULL;
|
||||||
|
|
||||||
if (mc->nSessionCacheMode == SSL_SCMODE_DBM)
|
if (mc->nSessionCacheMode == SSL_SCMODE_DBM)
|
||||||
sess = ssl_scache_dbm_retrieve(s, id, idlen);
|
sess = ssl_scache_dbm_retrieve(s, id, idlen, p);
|
||||||
else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB)
|
else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB)
|
||||||
sess = ssl_scache_shmcb_retrieve(s, id, idlen);
|
sess = ssl_scache_shmcb_retrieve(s, id, idlen);
|
||||||
#ifdef HAVE_DISTCACHE
|
#ifdef HAVE_DISTCACHE
|
||||||
@@ -137,12 +139,13 @@ SSL_SESSION *ssl_scache_retrieve(server_rec *s, UCHAR *id, int idlen,
|
|||||||
return sess;
|
return sess;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ssl_scache_remove(server_rec *s, UCHAR *id, int idlen)
|
void ssl_scache_remove(server_rec *s, UCHAR *id, int idlen,
|
||||||
|
apr_pool_t *p)
|
||||||
{
|
{
|
||||||
SSLModConfigRec *mc = myModConfig(s);
|
SSLModConfigRec *mc = myModConfig(s);
|
||||||
|
|
||||||
if (mc->nSessionCacheMode == SSL_SCMODE_DBM)
|
if (mc->nSessionCacheMode == SSL_SCMODE_DBM)
|
||||||
ssl_scache_dbm_remove(s, id, idlen);
|
ssl_scache_dbm_remove(s, id, idlen, p);
|
||||||
else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB)
|
else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB)
|
||||||
ssl_scache_shmcb_remove(s, id, idlen);
|
ssl_scache_shmcb_remove(s, id, idlen);
|
||||||
#ifdef HAVE_DISTCACHE
|
#ifdef HAVE_DISTCACHE
|
||||||
|
@@ -102,7 +102,9 @@ void ssl_scache_dbm_kill(server_rec *s)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ssl_scache_dbm_store(server_rec *s, UCHAR *id, int idlen, time_t expiry, SSL_SESSION *sess)
|
BOOL ssl_scache_dbm_store(server_rec *s, UCHAR *id, int idlen,
|
||||||
|
time_t expiry, SSL_SESSION *sess,
|
||||||
|
apr_pool_t *p)
|
||||||
{
|
{
|
||||||
SSLModConfigRec *mc = myModConfig(s);
|
SSLModConfigRec *mc = myModConfig(s);
|
||||||
apr_dbm_t *dbm;
|
apr_dbm_t *dbm;
|
||||||
@@ -159,7 +161,7 @@ BOOL ssl_scache_dbm_store(server_rec *s, UCHAR *id, int idlen, time_t expiry, SS
|
|||||||
/* and store it to the DBM file */
|
/* and store it to the DBM file */
|
||||||
ssl_mutex_on(s);
|
ssl_mutex_on(s);
|
||||||
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, p)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||||
"Cannot open SSLSessionCache DBM file `%s' for writing "
|
"Cannot open SSLSessionCache DBM file `%s' for writing "
|
||||||
"(store)",
|
"(store)",
|
||||||
@@ -189,7 +191,8 @@ BOOL ssl_scache_dbm_store(server_rec *s, UCHAR *id, int idlen, time_t expiry, SS
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *s, UCHAR *id, int idlen)
|
SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *s, UCHAR *id, int idlen,
|
||||||
|
apr_pool_t *p)
|
||||||
{
|
{
|
||||||
SSLModConfigRec *mc = myModConfig(s);
|
SSLModConfigRec *mc = myModConfig(s);
|
||||||
apr_dbm_t *dbm;
|
apr_dbm_t *dbm;
|
||||||
@@ -215,7 +218,7 @@ SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *s, UCHAR *id, int idlen)
|
|||||||
*/
|
*/
|
||||||
ssl_mutex_on(s);
|
ssl_mutex_on(s);
|
||||||
if ((rc = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
if ((rc = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, p)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rc, s,
|
ap_log_error(APLOG_MARK, APLOG_ERR, rc, s,
|
||||||
"Cannot open SSLSessionCache DBM file `%s' for reading "
|
"Cannot open SSLSessionCache DBM file `%s' for reading "
|
||||||
"(fetch)",
|
"(fetch)",
|
||||||
@@ -254,7 +257,7 @@ SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *s, UCHAR *id, int idlen)
|
|||||||
/* make sure the stuff is still not expired */
|
/* make sure the stuff is still not expired */
|
||||||
now = time(NULL);
|
now = time(NULL);
|
||||||
if (expiry <= now) {
|
if (expiry <= now) {
|
||||||
ssl_scache_dbm_remove(s, id, idlen);
|
ssl_scache_dbm_remove(s, id, idlen, p);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,7 +267,8 @@ SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *s, UCHAR *id, int idlen)
|
|||||||
return sess;
|
return sess;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ssl_scache_dbm_remove(server_rec *s, UCHAR *id, int idlen)
|
void ssl_scache_dbm_remove(server_rec *s, UCHAR *id, int idlen,
|
||||||
|
apr_pool_t *p)
|
||||||
{
|
{
|
||||||
SSLModConfigRec *mc = myModConfig(s);
|
SSLModConfigRec *mc = myModConfig(s);
|
||||||
apr_dbm_t *dbm;
|
apr_dbm_t *dbm;
|
||||||
@@ -278,7 +282,7 @@ void ssl_scache_dbm_remove(server_rec *s, UCHAR *id, int idlen)
|
|||||||
/* and delete it from the DBM file */
|
/* and delete it from the DBM file */
|
||||||
ssl_mutex_on(s);
|
ssl_mutex_on(s);
|
||||||
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, p)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||||
"Cannot open SSLSessionCache DBM file `%s' for writing "
|
"Cannot open SSLSessionCache DBM file `%s' for writing "
|
||||||
"(delete)",
|
"(delete)",
|
||||||
|
Reference in New Issue
Block a user