]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Catch up ssl to socache store expiry change, and clarify what the code is doing
authorWilliam A. Rowe Jr <wrowe@apache.org>
Tue, 9 Feb 2010 03:44:04 +0000 (03:44 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Tue, 9 Feb 2010 03:44:04 +0000 (03:44 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@907918 13f79535-47bb-0310-9956-ffa450edef68

modules/ssl/ssl_engine_kernel.c
modules/ssl/ssl_private.h
modules/ssl/ssl_scache.c
modules/ssl/ssl_util_stapling.c

index 0529ead0e8330544e49425b0215b8958ffa65049..9cee188ebc8d007d55d3ce5d30b82f15a4848645 100644 (file)
@@ -1812,9 +1812,10 @@ int ssl_callback_NewSessionCacheEntry(SSL *ssl, SSL_SESSION *session)
     id = SSL_SESSION_get_session_id(session);
     idlen = SSL_SESSION_get_session_id_length(session);
 
-    timeout += modssl_session_get_time(session);
-
-    rc = ssl_scache_store(s, id, idlen, timeout, session, conn->pool);
+    rc = ssl_scache_store(s, id, idlen,
+                          apr_time_from_sec(modssl_session_get_time(session)
+                                          + timeout),
+                          session, conn->pool);
 
     ssl_session_log(s, "SET", id, idlen,
                     rc == TRUE ? "OK" : "BAD",
index 313ceeb4fd2d97a412a531a7876d09e4aa1dd554..8d1ba8baa82d5f29b586df3552819cdeba9137b7 100644 (file)
@@ -642,7 +642,7 @@ void         ssl_scache_init(server_rec *, apr_pool_t *);
 void         ssl_scache_status_register(apr_pool_t *p);
 void         ssl_scache_kill(server_rec *);
 BOOL         ssl_scache_store(server_rec *, UCHAR *, int,
-                              time_t, SSL_SESSION *, apr_pool_t *);
+                              apr_time_t, SSL_SESSION *, apr_pool_t *);
 SSL_SESSION *ssl_scache_retrieve(server_rec *, UCHAR *, int, apr_pool_t *);
 void         ssl_scache_remove(server_rec *, UCHAR *, int,
                                apr_pool_t *);
index 7f6155a5e200a00f2a538f3c740da0b1a888cda9..afb2f5160793787d30d69a8d2400cc65113b07ab 100644 (file)
@@ -113,7 +113,7 @@ void ssl_scache_kill(server_rec *s)
 }
 
 BOOL ssl_scache_store(server_rec *s, UCHAR *id, int idlen,
-                      time_t expiry, SSL_SESSION *sess,
+                      apr_time_t expiry, SSL_SESSION *sess,
                       apr_pool_t *p)
 {
     SSLModConfigRec *mc = myModConfig(s);
index e069fae848bc7a78c6630db89bebeee850df0085..0f10cec8f31af9b03b6bc32bb220827621f5f418 100644 (file)
@@ -184,7 +184,7 @@ static BOOL stapling_cache_response(server_rec *s, modssl_ctx_t *mctx,
     unsigned char *p;
     int resp_derlen;
     BOOL rv;
-    time_t timeout;
+    apr_time_t expiry;
 
     resp_derlen = i2d_OCSP_RESPONSE(rsp, NULL) + 1;
 
@@ -200,25 +200,25 @@ static BOOL stapling_cache_response(server_rec *s, modssl_ctx_t *mctx,
         return FALSE;
     }
 
-
     p = resp_der;
 
+    /* TODO: potential optimization; _timeout members as apr_interval_time_t */
     if (ok == TRUE) {
         *p++ = 1;
-        timeout = mctx->stapling_cache_timeout;
+        expiry = apr_time_from_sec(mctx->stapling_cache_timeout);
     } 
     else {
         *p++ = 0;
-        timeout = mctx->stapling_errcache_timeout;
+        expiry = apr_time_from_sec(mctx->stapling_errcache_timeout);
     }
 
-    timeout += apr_time_sec(apr_time_now());
+    expiry += apr_time_now();
 
     i2d_OCSP_RESPONSE(rsp, &p);
 
     rv = mc->stapling_cache->store(mc->stapling_cache_context, s,
                                    cinf->idx, sizeof(cinf->idx),
-                                   timeout, resp_der, resp_derlen, pool);
+                                   expiry, resp_der, resp_derlen, pool);
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
                      "stapling_cache_response: OCSP response session store error!");