]> granicus.if.org Git - apache/commitdiff
mod_proxy: Fix ProxySourceAddress binding failure with AH00938. PR 56687.
authorYann Ylavic <ylavic@apache.org>
Fri, 18 Sep 2015 16:43:25 +0000 (16:43 +0000)
committerYann Ylavic <ylavic@apache.org>
Fri, 18 Sep 2015 16:43:25 +0000 (16:43 +0000)
Proposed by: Arne de Bruijn <apache arbruijn.dds.nl>
Reviewed by: ylavic

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1703902 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/proxy/proxy_util.c

diff --git a/CHANGES b/CHANGES
index f0f6a0b33cb84e7911ba28d734412cc82263f383..df056b1c0ccc01a7925c1fa114d5831955eae771 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_proxy: Fix ProxySourceAddress binding failure with AH00938.
+     PR 56687.  [Arne de Bruijn <apache arbruijn.dds.nl>
+
   *) mod_proxy: don't recyle backend announced "Connection: close" connections
      to avoid reusing it should the close be effective after some new request
      is ready to be sent.  [Yann Ylavic]
index 1aebd2467a478d3a7a5bb569736a263802481aa9..4f5db685e837c7892b416ea0606ca6c58ab4e024 100644 (file)
@@ -2148,7 +2148,14 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock,
                       proxy_function, backend_addr->family, backend_name);
 
         if (conf->source_address) {
-            rv = apr_socket_bind(*newsock, conf->source_address);
+            apr_sockaddr_t *local_addr;
+            /* Make a copy since apr_socket_bind() could change
+             * conf->source_address, which we don't want.
+             */
+            local_addr = apr_pmemdup(r->pool, conf->source_address,
+                                     sizeof(apr_sockaddr_t));
+            local_addr->pool = r->pool;
+            rv = apr_socket_bind(*newsock, local_addr);
             if (rv != APR_SUCCESS) {
                 ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(00938)
                               "%s: failed to bind socket to local address",