]> granicus.if.org Git - apache/commitdiff
Merge r1827654, r1827671 from trunk:
authorJim Jagielski <jim@apache.org>
Mon, 9 Apr 2018 15:28:53 +0000 (15:28 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 9 Apr 2018 15:28:53 +0000 (15:28 +0000)
copy apr_sockaddr_is_wildcard to maintain 1.4.x support.

CHANGES for r1827654

Submitted by: covener
Reviewed by: covener, ylavic, rpluem, jim

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

CHANGES
STATUS
modules/metadata/mod_remoteip.c

diff --git a/CHANGES b/CHANGES
index f61ede81343a795801964991a385861adbb52194..3927f86c0b54964e26bc068f97ce52bb469f3759 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.34
 
-   *) core: On ECBDIC platforms, some errors related to oversized headers
+  *) mod_remoteip: Restore compatibility with APR 1.4 (apr_sockaddr_is_wildcard).
+     [Eric Covener]
+
+  *) core: On ECBDIC platforms, some errors related to oversized headers
      may be misreported or be logged as ASCII escapes.  PR 62200
       [Hank Ibell <hwibell gmail.com>]
 
diff --git a/STATUS b/STATUS
index ca1ab15d9134954fbf5a31c2974984eda038159b..ea3c47c230a63322b3170658d3930d3fc37ab200 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -118,13 +118,6 @@ CURRENT RELEASE NOTES:
 
 RELEASE SHOWSTOPPERS:
 
-  *) mod_remoteip: restore apr 1.4.x compat by copying apr_sock_is_wildcard
-     trunk patch: http://svn.apache.org/r1827654
-                  http://svn.apache.org/r1827671
-     2.4.x patch:
-        svn merge -c 1827654,1827671 ^/httpd/httpd/trunk .
-     +1: covener, ylavic, rpluem, jim
-
   *) mod_ssl: Fix merging of proxy SSL context outside <Proxy> sections,
      regression introduced in 2.4.30. PR 62232.
      trunk patch: http://svn.apache.org/r1828390
index d83412f49b5da22f70c336eeee3d197bfd1b8585..4101b4ebdc36a9b21e90eb3970eef9f016f725c8 100644 (file)
@@ -31,6 +31,7 @@
 #define APR_WANT_BYTEFUNC
 #include "apr_want.h"
 #include "apr_network_io.h"
+#include "apr_version.h"
 
 module AP_MODULE_DECLARE_DATA remoteip_module;
 
@@ -314,6 +315,40 @@ static int remoteip_sockaddr_equal(apr_sockaddr_t *addr1, apr_sockaddr_t *addr2)
     return (addr1->port == addr2->port && apr_sockaddr_equal(addr1, addr2));
 }
 
+#if !APR_VERSION_AT_LEAST(1,5,0)
+#define apr_sockaddr_is_wildcard sockaddr_is_wildcard
+/* XXX: temp build fix from apr 1.5.x */
+static int sockaddr_is_wildcard(const apr_sockaddr_t *addr)
+{
+    static const char inaddr_any[
+#if APR_HAVE_IPV6
+        sizeof(struct in6_addr)
+#else
+        sizeof(struct in_addr)
+#endif
+    ] = {0};
+
+    if (addr->ipaddr_ptr /* IP address initialized */
+        && addr->ipaddr_len <= sizeof inaddr_any) { /* else bug elsewhere? */
+        if (!memcmp(inaddr_any, addr->ipaddr_ptr, addr->ipaddr_len)) {
+            return 1;
+        }
+#if APR_HAVE_IPV6
+    if (addr->family == AF_INET6
+        && IN6_IS_ADDR_V4MAPPED((struct in6_addr *)addr->ipaddr_ptr)) {
+        struct in_addr *v4 = (struct in_addr *)&((apr_uint32_t *)addr->ipaddr_ptr)[3];
+
+        if (!memcmp(inaddr_any, v4, sizeof *v4)) {
+            return 1;
+        }
+    }
+#endif
+    }
+    return 0;
+}
+#endif
+
+
 /** Similar to remoteip_sockaddr_equal, except that it handles wildcard addresses
  *  and ports too.
  */