summaryrefslogtreecommitdiffstats
path: root/modules/ssl/ssl_scache.c
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2008-02-22 22:09:40 +0100
committerJoe Orton <jorton@apache.org>2008-02-22 22:09:40 +0100
commit33c310cec6c277ae2e545bfc3ecf1f801ba98696 (patch)
tree5beb3705e0ea26cadb0741917a529e111d35b54a /modules/ssl/ssl_scache.c
parentMove SSL session data deserialization up out of the session cache (diff)
downloadapache2-33c310cec6c277ae2e545bfc3ecf1f801ba98696.tar.xz
apache2-33c310cec6c277ae2e545bfc3ecf1f801ba98696.zip
Session cache interface redesign, Part 3:
Move provider-private context out of SSLModConfigRec and into an opaque context pointer. Use real error propagation in the ->init functions rather than ssl_die(). * modules/ssl/ssl_private.h (modssl_sesscache_provider): Take a context out-parameter from ->init, and return an apr_status_t. Add context pointer as first arg for the other function types. (SSLModConfigRec): Remove tSessionCacheData* fields; add sesscache_context field. * modules/ssl/ssl_scache.c (ssl_scache_init): Move once-per-process invocation check back into here. (ssl_scache_*): Adjust to use context pointer. * modules/ssl/ssl_scache_shmcb.c, modules/ssl/ssl_scache_dc.c, modules/ssl/ssl_scache_dbm.c: Adjust all implementations to use opaque context pointer. * modules/ssl/ssl_scache_memcache.c: Move memcache context into the context structure rather than using global state. * modules/ssl/ssl_engine_config.c: Remove handling of pSessionCacheData* fields in SSLModConfigRec. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@630323 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/ssl/ssl_scache.c')
-rw-r--r--modules/ssl/ssl_scache.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/modules/ssl/ssl_scache.c b/modules/ssl/ssl_scache.c
index 11c5f3defe..3d231cfd89 100644
--- a/modules/ssl/ssl_scache.c
+++ b/modules/ssl/ssl_scache.c
@@ -40,6 +40,20 @@
void ssl_scache_init(server_rec *s, apr_pool_t *p)
{
SSLModConfigRec *mc = myModConfig(s);
+ apr_status_t rv;
+
+ /* ### push this up into scache_init??? */
+ {
+ void *data;
+ const char *userdata_key = "ssl_scache_init";
+
+ apr_pool_userdata_get(&data, userdata_key, s->process->pool);
+ if (!data) {
+ apr_pool_userdata_set((const void *)1, userdata_key,
+ apr_pool_cleanup_null, s->process->pool);
+ return;
+ }
+ }
/*
* Warn the user that he should use the session cache.
@@ -52,14 +66,20 @@ void ssl_scache_init(server_rec *s, apr_pool_t *p)
return;
}
- mc->sesscache->init(s, p);
+ rv = mc->sesscache->init(s, &mc->sesscache_context, p);
+ if (rv) {
+ /* ABORT ABORT etc. */
+ ssl_die();
+ }
}
void ssl_scache_kill(server_rec *s)
{
SSLModConfigRec *mc = myModConfig(s);
-
- mc->sesscache->destroy(s);
+
+ if (mc->sesscache) {
+ mc->sesscache->destroy(mc->sesscache_context, s);
+ }
}
BOOL ssl_scache_store(server_rec *s, UCHAR *id, int idlen,
@@ -81,7 +101,8 @@ BOOL ssl_scache_store(server_rec *s, UCHAR *id, int idlen,
ptr = encoded;
len = i2d_SSL_SESSION(sess, &ptr);
- return mc->sesscache->store(s, id, idlen, expiry, encoded, len);
+ return mc->sesscache->store(mc->sesscache_context, s, id, idlen,
+ expiry, encoded, len);
}
SSL_SESSION *ssl_scache_retrieve(server_rec *s, UCHAR *id, int idlen,
@@ -92,7 +113,8 @@ SSL_SESSION *ssl_scache_retrieve(server_rec *s, UCHAR *id, int idlen,
unsigned int destlen = SSL_SESSION_MAX_DER;
MODSSL_D2I_SSL_SESSION_CONST unsigned char *ptr;
- if (mc->sesscache->retrieve(s, id, idlen, dest, &destlen, p) == FALSE) {
+ if (mc->sesscache->retrieve(mc->sesscache_context, s, id, idlen,
+ dest, &destlen, p) == FALSE) {
return NULL;
}
@@ -106,7 +128,7 @@ void ssl_scache_remove(server_rec *s, UCHAR *id, int idlen,
{
SSLModConfigRec *mc = myModConfig(s);
- mc->sesscache->delete(s, id, idlen, p);
+ mc->sesscache->delete(mc->sesscache_context, s, id, idlen, p);
return;
}
@@ -130,7 +152,7 @@ static int ssl_ext_status_hook(request_rec *r, int flags)
ap_rputs("</td></tr>\n", r);
ap_rputs("<tr><td bgcolor=\"#ffffff\">\n", r);
- mc->sesscache->status(r, flags, r->pool);
+ mc->sesscache->status(mc->sesscache_context, r, flags, r->pool);
ap_rputs("</td></tr>\n", r);
ap_rputs("</table>\n", r);