arrfab / rpms / httpd

Forked from rpms/httpd 5 years ago
Clone

Blame SOURCES/httpd-2.4.3-sslsninotreq.patch

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