]> granicus.if.org Git - apache/commitdiff
mod_ssl: when SSLVerify is disabled (NONE), don't force a renegotiation if
authorYann Ylavic <ylavic@apache.org>
Mon, 8 Jun 2015 12:25:22 +0000 (12:25 +0000)
committerYann Ylavic <ylavic@apache.org>
Mon, 8 Jun 2015 12:25:22 +0000 (12:25 +0000)
the SSLVerifyDepth applied with the default/handshaken vhost differs from
the one applicable with the finally selected vhost.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1684171 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/ssl/ssl_engine_kernel.c

diff --git a/CHANGES b/CHANGES
index 95b89f525625ea8c404fbccd4f2c523a1e6b9938..63e7d0fc11071eb1b4d22aa7d19c931e31bfae1d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_ssl: When SSLVerify is disabled (NONE), don't force a renegotiation if
+     the SSLVerifyDepth applied with the default/handshaken vhost differs from
+     the one applicable with the finally selected vhost.  [Yann Ylavic]
+     
   *) core: Avoid a possible truncation of the faulty header included in the
      HTML response when LimitRequestFieldSize is reached.  [Yann Ylavic]
 
index e172e0496abfc1bee0e3e28520051415aad8b069..1df82fbd71cfc65d931cda845c876a4136f74877 100644 (file)
@@ -513,31 +513,6 @@ int ssl_hook_Access(request_rec *r)
         }
     }
 
-    /*
-     * override of SSLVerifyDepth
-     *
-     * The depth checks are handled by us manually inside the verify callback
-     * function and not by OpenSSL internally (and our function is aware of
-     * both the per-server and per-directory contexts). So we cannot ask
-     * OpenSSL about the currently verify depth. Instead we remember it in our
-     * SSLConnRec attached to the SSL* of OpenSSL.  We've to force the
-     * renegotiation if the reconfigured/new verify depth is less than the
-     * currently active/remembered verify depth (because this means more
-     * restriction on the certificate chain).
-     */
-    n = (sslconn->verify_depth != UNSET) ?
-        sslconn->verify_depth :
-        (mySrvConfig(handshakeserver))->server->auth.verify_depth;
-    /* determine the new depth */
-    sslconn->verify_depth = (dc->nVerifyDepth != UNSET) ?
-                            dc->nVerifyDepth : sc->server->auth.verify_depth;
-    if (sslconn->verify_depth < n) {
-        renegotiate = TRUE;
-        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02254)
-                     "Reduced client verification depth will force "
-                     "renegotiation");
-    }
-
     /*
      * override of SSLVerifyClient
      *
@@ -554,6 +529,8 @@ int ssl_hook_Access(request_rec *r)
      */
     if ((dc->nVerifyClient != SSL_CVERIFY_UNSET) ||
         (sc->server->auth.verify_mode != SSL_CVERIFY_UNSET)) {
+        SSLSrvConfigRec *hssc = mySrvConfig(handshakeserver);
+
         /* remember old state */
         verify_old = SSL_get_verify_mode(ssl);
         /* configure new state */
@@ -601,7 +578,36 @@ int ssl_hook_Access(request_rec *r)
                               "Changed client verification type will force "
                               "%srenegotiation",
                               renegotiate_quick ? "quick " : "");
-             }
+            }
+            else if (verify != SSL_VERIFY_NONE) {
+                /*
+                 * override of SSLVerifyDepth
+                 *
+                 * The depth checks are handled by us manually inside the
+                 * verify callback function and not by OpenSSL internally
+                 * (and our function is aware of both the per-server and
+                 * per-directory contexts). So we cannot ask OpenSSL about
+                 * the currently verify depth. Instead we remember it in our
+                 * SSLConnRec attached to the SSL* of OpenSSL.  We've to force
+                 * the renegotiation if the reconfigured/new verify depth is
+                 * less than the currently active/remembered verify depth
+                 * (because this means more restriction on the certificate
+                 * chain).
+                 */
+                n = (sslconn->verify_depth != UNSET)
+                    ? sslconn->verify_depth
+                    : hssc->server->auth.verify_depth;
+                /* determine the new depth */
+                sslconn->verify_depth = (dc->nVerifyDepth != UNSET)
+                                        ? dc->nVerifyDepth
+                                        : sc->server->auth.verify_depth;
+                if (sslconn->verify_depth < n) {
+                    renegotiate = TRUE;
+                    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02254)
+                                  "Reduced client verification depth will "
+                                  "force renegotiation");
+                }
+            }
         }
         /* If we're handling a request for a vhost other than the default one,
          * then we need to make sure that client authentication is properly
@@ -617,8 +623,6 @@ int ssl_hook_Access(request_rec *r)
             && renegotiate
             && ((verify & SSL_VERIFY_PEER) ||
                 (verify & SSL_VERIFY_FAIL_IF_NO_PEER_CERT))) {
-            SSLSrvConfigRec *hssc = mySrvConfig(handshakeserver);
-
 #define MODSSL_CFG_CA_NE(f, sc1, sc2) \
             (sc1->server->auth.f && \
              (!sc2->server->auth.f || \