diff options
author | Joe Orton <jorton@apache.org> | 2008-02-22 13:00:49 +0100 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2008-02-22 13:00:49 +0100 |
commit | 9662049374050b110deac5cfe0445ac742fa32df (patch) | |
tree | ed5b3eec1740aaa95a3be38c9e989932816fcd78 /modules/ssl/ssl_scache.c | |
parent | Re-implement the SSL session cache abstraction using a vtable; first (diff) | |
download | apache2-9662049374050b110deac5cfe0445ac742fa32df.tar.xz apache2-9662049374050b110deac5cfe0445ac742fa32df.zip |
Move SSL session data serialization up out of the session cache
storage providers:
* modules/ssl/ssl_private.h (modssl_sesscache_provider): Change
'store' interface to take a data/length pair rather than an
SSL_SESSION pointer.
* modules/ssl/ssl_scache.c (ssl_scache_store): Serialize the SSL
session here and pass down the raw DER.
* modules/ssl/ssl_scache_dc.c, modules/ssl_scache_mc.c,
modules/ssl_scache_shmcb.c, modules/ssl_scache_dbm.c: Adjust ->store
implementations accordingly, removing the four sets of identical
code doing the i2d dance.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@630168 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/ssl/ssl_scache.c')
-rw-r--r-- | modules/ssl/ssl_scache.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/modules/ssl/ssl_scache.c b/modules/ssl/ssl_scache.c index efabfe8af6..0bdd025af5 100644 --- a/modules/ssl/ssl_scache.c +++ b/modules/ssl/ssl_scache.c @@ -67,8 +67,21 @@ BOOL ssl_scache_store(server_rec *s, UCHAR *id, int idlen, apr_pool_t *p) { SSLModConfigRec *mc = myModConfig(s); - - return mc->sesscache->store(s, id, idlen, expiry, sess); + unsigned char encoded[SSL_SESSION_MAX_DER], *ptr; + unsigned int len; + + /* Serialise the session. */ + len = i2d_SSL_SESSION(sess, NULL); + if (len > sizeof encoded) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, + "session is too big (%u bytes)", len); + return FALSE; + } + + ptr = encoded; + len = i2d_SSL_SESSION(sess, &ptr); + + return mc->sesscache->store(s, id, idlen, expiry, encoded, len); } SSL_SESSION *ssl_scache_retrieve(server_rec *s, UCHAR *id, int idlen, |