altarch-user / rpms / httpd

Forked from rpms/httpd 2 years ago
Clone

Blame SOURCES/httpd-2.4.6-sslmultiproxy.patch

008793
008793
Ugly hack to enable mod_ssl and mod_nss to "share" hooks.
008793
008793
--- httpd-2.4.6/modules/ssl/mod_ssl.c.sslmultiproxy
008793
+++ httpd-2.4.6/modules/ssl/mod_ssl.c
008793
@@ -369,6 +369,9 @@ static SSLConnRec *ssl_init_connection_c
008793
     return sslconn;
008793
 }
008793
 
008793
+static typeof(ssl_proxy_enable) *othermod_proxy_enable;
008793
+static typeof(ssl_engine_disable) *othermod_engine_disable;
008793
+
008793
 int ssl_proxy_enable(conn_rec *c)
008793
 {
008793
     SSLSrvConfigRec *sc;
008793
@@ -377,6 +380,12 @@ int ssl_proxy_enable(conn_rec *c)
008793
     sc = mySrvConfig(sslconn->server);
008793
 
008793
     if (!sc->proxy_enabled) {
008793
+        if (othermod_proxy_enable) {
008793
+            ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c,
008793
+                          "mod_ssl proxy not configured, passing through to other module.");
008793
+            return othermod_proxy_enable(c);
008793
+        }
008793
+
008793
         ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(01961)
008793
                       "SSL Proxy requested for %s but not enabled "
008793
                       "[Hint: SSLProxyEngine]", sc->vhost_id);
008793
@@ -396,6 +405,10 @@ int ssl_engine_disable(conn_rec *c)
008793
 
008793
     SSLConnRec *sslconn = myConnConfig(c);
008793
 
008793
+    if (othermod_engine_disable) {
008793
+        othermod_engine_disable(c);
008793
+    }
008793
+
008793
     if (sslconn) {
008793
         sc = mySrvConfig(sslconn->server);
008793
     }
008793
@@ -612,6 +625,9 @@ static void ssl_register_hooks(apr_pool_
008793
     ap_hook_post_read_request(ssl_hook_ReadReq, pre_prr,NULL, APR_HOOK_MIDDLE);
008793
 
008793
     ssl_var_register(p);
008793
+    
008793
+    othermod_proxy_enable = APR_RETRIEVE_OPTIONAL_FN(ssl_proxy_enable);
008793
+    othermod_engine_disable = APR_RETRIEVE_OPTIONAL_FN(ssl_engine_disable);
008793
 
008793
     APR_REGISTER_OPTIONAL_FN(ssl_proxy_enable);
008793
     APR_REGISTER_OPTIONAL_FN(ssl_engine_disable);
008793
--- httpd-2.4.6/modules/ssl/ssl_engine_vars.c.sslmultiproxy
008793
+++ httpd-2.4.6/modules/ssl/ssl_engine_vars.c
008793
@@ -53,10 +53,15 @@ static void  ssl_var_lookup_ssl_cipher_b
008793
 static char *ssl_var_lookup_ssl_version(apr_pool_t *p, char *var);
008793
 static char *ssl_var_lookup_ssl_compress_meth(SSL *ssl);
008793
 
008793
+static APR_OPTIONAL_FN_TYPE(ssl_is_https) *othermod_is_https;
008793
+static APR_OPTIONAL_FN_TYPE(ssl_var_lookup) *othermod_var_lookup;
008793
+
008793
 static int ssl_is_https(conn_rec *c)
008793
 {
008793
     SSLConnRec *sslconn = myConnConfig(c);
008793
-    return sslconn && sslconn->ssl;
008793
+    
008793
+    return (sslconn && sslconn->ssl)
008793
+        || (othermod_is_https && othermod_is_https(c));
008793
 }
008793
 
008793
 static const char var_interface[] = "mod_ssl/" AP_SERVER_BASEREVISION;
008793
@@ -106,6 +111,9 @@ void ssl_var_register(apr_pool_t *p)
008793
 {
008793
     char *cp, *cp2;
008793
 
008793
+    othermod_is_https = APR_RETRIEVE_OPTIONAL_FN(ssl_is_https);
008793
+    othermod_var_lookup = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup);
008793
+
008793
     APR_REGISTER_OPTIONAL_FN(ssl_is_https);
008793
     APR_REGISTER_OPTIONAL_FN(ssl_var_lookup);
008793
     APR_REGISTER_OPTIONAL_FN(ssl_ext_list);
008793
@@ -241,6 +249,15 @@ char *ssl_var_lookup(apr_pool_t *p, serv
008793
      */
008793
     if (result == NULL && c != NULL) {
008793
         SSLConnRec *sslconn = myConnConfig(c);
008793
+
008793
+        if (strlen(var) > 4 && strcEQn(var, "SSL_", 4)
008793
+            && (!sslconn || !sslconn->ssl) && othermod_var_lookup) {
008793
+            /* For an SSL_* variable, if mod_ssl is not enabled for
008793
+             * this connection and another SSL module is present, pass
008793
+             * through to that module. */
008793
+            return othermod_var_lookup(p, s, c, r, var);
008793
+        }
008793
+
008793
         if (strlen(var) > 4 && strcEQn(var, "SSL_", 4)
008793
             && sslconn && sslconn->ssl)
008793
             result = ssl_var_lookup_ssl(p, c, r, var+4);