]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_proxy_connect: avoid segfault on DNS lookup failure.
authorRoy T. Fielding <fielding@apache.org>
Sat, 1 Sep 2007 23:46:55 +0000 (23:46 +0000)
committerRoy T. Fielding <fielding@apache.org>
Sat, 1 Sep 2007 23:46:55 +0000 (23:46 +0000)
PR: 40756
Submitted by: Trevin Beattie <tbeattie boingo.com>

Reviewed by: Nick Kew, Ruediger Pluem, Jim Jagielski, Roy Fielding

Please don't dick with the whitespace while holding up a segfault fix.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@571899 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/proxy/mod_proxy_connect.c

diff --git a/CHANGES b/CHANGES
index 6b48ea8910e2f5eeff743db54bcf335483e3c75c..b3519fd7eeac290d52488960538e6416e1d88938 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                         -*- coding: utf-8 -*-
 Changes with Apache 2.2.6
 
+  *) mod_proxy_connect: avoid segfault on DNS lookup failure.
+     PR 40756 [Trevin Beattie <tbeattie boingo.com>]
+
   *) mod_proxy: enable Ignore Errors option on ProxyPass Status.
      PR 43167 [Francisco Gimeno <kikov kikov.org>
 
diff --git a/STATUS b/STATUS
index 8f3b1855194a13826b15ead1d1b5a2bec9bb66ad..563fc27428863469fd1e9efea6870d9b132f5898 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -175,14 +175,6 @@ PATCHES PROPOSED TO BACKPORT FROM TRUNK:
       trawick says: The new directives should be documented in trunk,
           so that docs are available for backport at the same time.
 
-   * mod_proxy_connect: Fix potential proxy segfault
-     PR 40756
-     http://svn.apache.org/viewvc?view=rev&revision=571414
-     http://svn.apache.org/viewvc?view=rev&revision=571863
-     http://svn.apache.org/viewvc?view=rev&revision=571869
-     http://svn.apache.org/viewvc?view=rev&revision=571879
-     +1: jim
-
    * mod_include: Add an "if" directive syntax to test whether an URL
      is accessible, and if so, conditionally display content. This
      allows a webmaster to hide a link to a private page when the user
index eb9b7de77a5b6994bc629bedb17586f1872f5246..f50b4cb264fe90cfad18000f6d289be0485fe55b 100644 (file)
@@ -122,21 +122,26 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
 
     /* do a DNS lookup for the destination host */
     err = apr_sockaddr_info_get(&uri_addr, uri.hostname, APR_UNSPEC, uri.port, 0, p);
+    if (APR_SUCCESS != err) {
+       return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_pstrcat(p,
+                            "DNS lookup failure for: ",
+                            uri.hostname, NULL));
+    }
 
     /* are we connecting directly, or via a proxy? */
     if (proxyname) {
-    connectname = proxyname;
-    connectport = proxyport;
+        connectname = proxyname;
+        connectport = proxyport;
         err = apr_sockaddr_info_get(&connect_addr, proxyname, APR_UNSPEC, proxyport, 0, p);
     }
     else {
-    connectname = uri.hostname;
-    connectport = uri.port;
-    connect_addr = uri_addr;
+        connectname = uri.hostname;
+        connectport = uri.port;
+        connect_addr = uri_addr;
     }
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
          "proxy: CONNECT: connecting to remote proxy %s on port %d", connectname, connectport);
-
     /* check if ProxyBlock directive on this host */
     if (OK != ap_proxy_checkproxyblock(r, conf, uri_addr)) {
     return ap_proxyerror(r, HTTP_FORBIDDEN,