]> granicus.if.org Git - apache/commitdiff
tweak handling for default allowed ports
authorTakashi Sato <takashi@apache.org>
Tue, 29 Dec 2009 16:25:31 +0000 (16:25 +0000)
committerTakashi Sato <takashi@apache.org>
Tue, 29 Dec 2009 16:25:31 +0000 (16:25 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@894430 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_connect.c

index 8fa2f756b2c155c5435f4ca9f6e0a7d1682168f4..48d1d5218d3b4098da63b02fad0de839039eddd1 100644 (file)
@@ -95,6 +95,11 @@ static int allowed_port(connect_conf *conf, int port)
 {
     int i;
     int *list = (int *) conf->allowed_connect_ports->elts;
+    
+    if(apr_is_empty_array(conf->allowed_connect_ports)){
+        return port == APR_URI_HTTPS_DEFAULT_PORT
+               || port == APR_URI_SNEWS_DEFAULT_PORT;
+    }
 
     for(i = 0; i < conf->allowed_connect_ports->nelts; i++) {
     if(port == list[i])
@@ -251,17 +256,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
     }
 
     /* Check if it is an allowed port */
-    if (c_conf->allowed_connect_ports->nelts == 0) {
-    /* Default setting if not overridden by AllowCONNECT */
-        switch (uri.port) {
-            case APR_URI_HTTPS_DEFAULT_PORT:
-            case APR_URI_SNEWS_DEFAULT_PORT:
-                break;
-            default:
-                 return ap_proxyerror(r, HTTP_FORBIDDEN,
-                                      "Connect to remote machine blocked");
-        }
-    } else if(!allowed_port(c_conf, uri.port)) {
+    if(!allowed_port(c_conf, uri.port)) {
               return ap_proxyerror(r, HTTP_FORBIDDEN,
                                    "Connect to remote machine blocked");
     }