httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r630168 - in /httpd/httpd/trunk/modules/ssl: ssl_private.h ssl_scache.c ssl_scache_dbm.c ssl_scache_dc.c ssl_scache_memcache.c ssl_scache_shmcb.c
Date Fri, 22 Feb 2008 12:01:05 GMT
Author: jorton
Date: Fri Feb 22 04:00:49 2008
New Revision: 630168

URL: http://svn.apache.org/viewvc?rev=630168&view=rev
Log:
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.

Modified:
    httpd/httpd/trunk/modules/ssl/ssl_private.h
    httpd/httpd/trunk/modules/ssl/ssl_scache.c
    httpd/httpd/trunk/modules/ssl/ssl_scache_dbm.c
    httpd/httpd/trunk/modules/ssl/ssl_scache_dc.c
    httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c
    httpd/httpd/trunk/modules/ssl/ssl_scache_shmcb.c

Modified: httpd/httpd/trunk/modules/ssl/ssl_private.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_private.h?rev=630168&r1=630167&r2=630168&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_private.h (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_private.h Fri Feb 22 04:00:49 2008
@@ -369,7 +369,8 @@
     void (*init)(server_rec *s, apr_pool_t *pool);
     void (*destroy)(server_rec *s);
     BOOL (*store)(server_rec *s, UCHAR *id, int idlen,
-                  time_t expiry, SSL_SESSION *session);
+                  time_t expiry, 
+                  unsigned char *data, unsigned int datalen);
     SSL_SESSION *(*retrieve)(server_rec *s, UCHAR *id, int idlen,
                              apr_pool_t *pool);
     void (*delete)(server_rec *s, UCHAR *id, int idlen, apr_pool_t *pool);

Modified: httpd/httpd/trunk/modules/ssl/ssl_scache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_scache.c?rev=630168&r1=630167&r2=630168&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_scache.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_scache.c Fri Feb 22 04:00:49 2008
@@ -67,8 +67,21 @@
                       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,

Modified: httpd/httpd/trunk/modules/ssl/ssl_scache_dbm.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_scache_dbm.c?rev=630168&r1=630167&r2=630168&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_scache_dbm.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_scache_dbm.c Fri Feb 22 04:00:49 2008
@@ -106,32 +106,19 @@
 }
 
 static BOOL ssl_scache_dbm_store(server_rec *s, UCHAR *id, int idlen,
-                                 time_t expiry, SSL_SESSION *sess)
+                                 time_t expiry, 
+                                 unsigned char *ucaData, unsigned int nData)
 {
     SSLModConfigRec *mc = myModConfig(s);
     apr_dbm_t *dbm;
     apr_datum_t dbmkey;
     apr_datum_t dbmval;
-    UCHAR ucaData[SSL_SESSION_MAX_DER];
-    int nData;
-    UCHAR *ucp;
     apr_status_t rv;
     apr_pool_t *p;
 
     /* ### This is not in any way sane, a persistent pool which gets
      * cleared each time is needed. */
     apr_pool_create(&p, s->process->pool);
-
-    /* streamline session data */
-    if ((nData = i2d_SSL_SESSION(sess, NULL)) > sizeof(ucaData)) {
-        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
-                     "streamline session data size too large: %d > "
-                     "%" APR_SIZE_T_FMT,
-                     nData, sizeof(ucaData));
-        return FALSE;
-    }
-    ucp = ucaData;
-    i2d_SSL_SESSION(sess, &ucp);
 
     /* be careful: do not try to store too much bytes in a DBM file! */
 #ifdef PAIRMAX

Modified: httpd/httpd/trunk/modules/ssl/ssl_scache_dc.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_scache_dc.c?rev=630168&r1=630167&r2=630168&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_scache_dc.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_scache_dc.c Fri Feb 22 04:00:49 2008
@@ -98,18 +98,12 @@
 }
 
 static BOOL ssl_scache_dc_store(server_rec *s, UCHAR *id, int idlen,
-                                time_t timeout, SSL_SESSION * pSession)
+                                time_t timeout,
+                                unsigned char *der, unsigned int der_len)
 {
-    unsigned char der[SSL_SESSION_MAX_DER];
-    int der_len;
-    unsigned char *pder = der;
     SSLModConfigRec *mc = myModConfig(s);
     DC_CTX *ctx = mc->tSessionCacheDataTable;
 
-    /* Serialise the SSL_SESSION object */
-    if ((der_len = i2d_SSL_SESSION(pSession, NULL)) > SSL_SESSION_MAX_DER)
-        return FALSE;
-    i2d_SSL_SESSION(pSession, &pder);
     /* !@#$%^ - why do we deal with *absolute* time anyway??? */
     timeout -= time(NULL);
     /* Send the serialised session to the distributed cache context */

Modified: httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c?rev=630168&r1=630167&r2=630168&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_scache_memcache.c Fri Feb 22 04:00:49 2008
@@ -182,26 +182,12 @@
 }
 
 static BOOL ssl_scache_mc_store(server_rec *s, UCHAR *id, int idlen,
-                                time_t timeout, SSL_SESSION *pSession)
+                                time_t timeout,
+                                unsigned char *ucaData, unsigned int nData)
 {
     char buf[MC_KEY_LEN];
     char *strkey = NULL;
-    UCHAR ucaData[SSL_SESSION_MAX_DER];
-    UCHAR *ucp;
-    int nData;
     apr_status_t rv;
-
-    /* streamline session data */
-    if ((nData = i2d_SSL_SESSION(pSession, NULL)) > sizeof(ucaData)) {
-        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
-                     "scache_mc: streamline session data size too large: %d > "
-                     "%" APR_SIZE_T_FMT,
-                     nData, sizeof(ucaData));
-        return FALSE;
-    }
-
-    ucp = ucaData;
-    i2d_SSL_SESSION(pSession, &ucp);
 
     strkey = mc_session_id2sz(id, idlen, buf, sizeof(buf));
     if(!strkey) {

Modified: httpd/httpd/trunk/modules/ssl/ssl_scache_shmcb.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_scache_shmcb.c?rev=630168&r1=630167&r2=630168&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_scache_shmcb.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_scache_shmcb.c Fri Feb 22 04:00:49 2008
@@ -320,13 +320,12 @@
 }
 
 static BOOL ssl_scache_shmcb_store(server_rec *s, UCHAR *id, int idlen,
-                                   time_t timeout, SSL_SESSION * pSession)
+                                   time_t timeout, 
+                                   unsigned char *encoded,
+                                   unsigned int len_encoded)
 {
     SSLModConfigRec *mc = myModConfig(s);
     BOOL to_return = FALSE;
-    unsigned char encoded[SSL_SESSION_MAX_DER];
-    unsigned char *ptr_encoded;
-    unsigned int len_encoded;
     SHMCBHeader *header = mc->tSessionCacheDataTable;
     SHMCBSubcache *subcache = SHMCB_MASK(header, id);
 
@@ -339,15 +338,6 @@
                 "(%u bytes)", idlen);
         goto done;
     }
-    /* Serialise the session. */
-    len_encoded = i2d_SSL_SESSION(pSession, NULL);
-    if (len_encoded > SSL_SESSION_MAX_DER) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
-                     "session is too big (%u bytes)", len_encoded);
-        goto done;
-    }
-    ptr_encoded = encoded;
-    len_encoded = i2d_SSL_SESSION(pSession, &ptr_encoded);
     if (!shmcb_subcache_store(s, header, subcache, encoded,
                               len_encoded, id, timeout)) {
         ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,



Mime
View raw message