Blame SOURCES/httpd-2.4.3-sslsninotreq.patch

af9b8b
diff --git a/modules/ssl/ssl_engine_config.c b/modules/ssl/ssl_engine_config.c
af9b8b
index 15993f1..53ed6f1 100644
af9b8b
--- a/modules/ssl/ssl_engine_config.c
af9b8b
+++ b/modules/ssl/ssl_engine_config.c
af9b8b
@@ -55,6 +55,7 @@ SSLModConfigRec *ssl_config_global_create(server_rec *s)
af9b8b
     mc = (SSLModConfigRec *)apr_palloc(pool, sizeof(*mc));
af9b8b
     mc->pPool = pool;
af9b8b
     mc->bFixed = FALSE;
af9b8b
+    mc->sni_required = FALSE;
af9b8b
 
af9b8b
     /*
af9b8b
      * initialize per-module configuration
af9b8b
diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c
af9b8b
index bf1f0e4..a7523de 100644
af9b8b
--- a/modules/ssl/ssl_engine_init.c
af9b8b
+++ b/modules/ssl/ssl_engine_init.c
af9b8b
@@ -409,7 +409,7 @@ int ssl_init_Module(apr_pool_t *p, apr_pool_t *plog,
af9b8b
     /*
af9b8b
      * Configuration consistency checks
af9b8b
      */
af9b8b
-    ssl_init_CheckServers(base_server, ptemp);
af9b8b
+    ssl_init_CheckServers(mc, base_server, ptemp);
af9b8b
 
af9b8b
     /*
af9b8b
      *  Announce mod_ssl and SSL library in HTTP Server field
af9b8b
@@ -1475,7 +1475,7 @@ void ssl_init_ConfigureServer(server_rec *s,
af9b8b
     }
af9b8b
 }
af9b8b
 
af9b8b
-void ssl_init_CheckServers(server_rec *base_server, apr_pool_t *p)
af9b8b
+void ssl_init_CheckServers(SSLModConfigRec *mc, server_rec *base_server, apr_pool_t *p)
af9b8b
 {
af9b8b
     server_rec *s, *ps;
af9b8b
     SSLSrvConfigRec *sc;
af9b8b
@@ -1557,6 +1557,7 @@ void ssl_init_CheckServers(server_rec *base_server, apr_pool_t *p)
af9b8b
     }
af9b8b
 
af9b8b
     if (conflict) {
af9b8b
+        mc->sni_required = TRUE;
af9b8b
 #ifdef OPENSSL_NO_TLSEXT
af9b8b
         ap_log_error(APLOG_MARK, APLOG_WARNING, 0, base_server, APLOGNO(01917)
af9b8b
                      "Init: You should not use name-based "
af9b8b
diff --git a/modules/ssl/ssl_engine_kernel.c b/modules/ssl/ssl_engine_kernel.c
af9b8b
index bc9e26b..2460f01 100644
af9b8b
--- a/modules/ssl/ssl_engine_kernel.c
af9b8b
+++ b/modules/ssl/ssl_engine_kernel.c
af9b8b
@@ -164,6 +164,7 @@ int ssl_hook_ReadReq(request_rec *r)
af9b8b
         return DECLINED;
af9b8b
     }
af9b8b
 #ifndef OPENSSL_NO_TLSEXT
af9b8b
+    if (myModConfig(r->server)->sni_required) {
af9b8b
     if ((servername = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name))) {
af9b8b
         char *host, *scope_id;
af9b8b
         apr_port_t port;
af9b8b
@@ -206,6 +207,7 @@ int ssl_hook_ReadReq(request_rec *r)
af9b8b
                      " virtual host");
af9b8b
         return HTTP_FORBIDDEN;
af9b8b
     }
af9b8b
+    }
af9b8b
 #endif
af9b8b
     SSL_set_app_data2(ssl, r);
af9b8b
 
af9b8b
diff --git a/modules/ssl/ssl_private.h b/modules/ssl/ssl_private.h
af9b8b
index 75fc0e3..31dbfa9 100644
af9b8b
--- a/modules/ssl/ssl_private.h
af9b8b
+++ b/modules/ssl/ssl_private.h
af9b8b
@@ -554,6 +554,7 @@ typedef struct {
af9b8b
     struct {
af9b8b
         void *pV1, *pV2, *pV3, *pV4, *pV5, *pV6, *pV7, *pV8, *pV9, *pV10;
af9b8b
     } rCtx;
af9b8b
+    BOOL            sni_required;
af9b8b
 } SSLModConfigRec;
af9b8b
 
af9b8b
 /** Structure representing configured filenames for certs and keys for
af9b8b
@@ -786,7 +787,7 @@ const char *ssl_cmd_SSLFIPS(cmd_parms *cmd, void *dcfg, int flag);
af9b8b
 int          ssl_init_Module(apr_pool_t *, apr_pool_t *, apr_pool_t *, server_rec *);
af9b8b
 void         ssl_init_Engine(server_rec *, apr_pool_t *);
af9b8b
 void         ssl_init_ConfigureServer(server_rec *, apr_pool_t *, apr_pool_t *, SSLSrvConfigRec *);
af9b8b
-void         ssl_init_CheckServers(server_rec *, apr_pool_t *);
af9b8b
+void         ssl_init_CheckServers(SSLModConfigRec *mc, server_rec *, apr_pool_t *);
af9b8b
 STACK_OF(X509_NAME)
af9b8b
             *ssl_init_FindCAList(server_rec *, apr_pool_t *, const char *, const char *);
af9b8b
 void         ssl_init_Child(apr_pool_t *, server_rec *);