Bug 25779 - Numeric IP address in ProxyPass directive
Summary: Numeric IP address in ProxyPass directive
Status: RESOLVED WONTFIX
Alias: None
Product: Apache httpd-1.3
Classification: Unclassified
Component: mod_proxy (show other bugs)
Version: 1.3.29
Hardware: Sun other
: P3 minor (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
: 22586 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-12-28 05:39 UTC by Scott L. Burson
Modified: 2007-08-02 12:22 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Scott L. Burson 2003-12-28 05:39:13 UTC
I ran into this under OpenBSD 3.4 on a Sun Ultra I; however, it appears to
affect other configurations including x86.

The code within `mod_proxy' that parses numeric IP addresses is nonportable; by
my reading, it works only on 32-bit, big-endian systems.  It definitely doesn't
work on the 64-bit big-endian system I am using.  Here is a patch that fixes the
problem for me:

<pre>
*** mod_proxy.h.orig	2003-08-21 06:11:36.000000000 -0700
--- mod_proxy.h	2003-12-27 20:30:29.000000000 -0800
***************
*** 256,262 ****
  
  struct per_thread_data {
      struct hostent hpbuf;
!     u_long ipaddr;
      char *charpbuf[2];
  };
  /* Function prototypes */
--- 256,262 ----
  
  struct per_thread_data {
      struct hostent hpbuf;
!     struct in_addr ipaddr;
      char *charpbuf[2];
  };
  /* Function prototypes */
*** proxy_util.c.orig	2003-08-21 06:11:36.000000000 -0700
--- proxy_util.c	2003-12-27 20:30:30.000000000 -0800
***************
*** 999,1005 ****
              return "Host not found";
      }
      else {
!         ptd->ipaddr = ap_inet_addr(host);
          hp = gethostbyaddr((char *)&ptd->ipaddr, sizeof(ptd->ipaddr), AF_INET);
          if (hp == NULL) {
              memset(&ptd->hpbuf, 0, sizeof(ptd->hpbuf));
--- 999,1005 ----
              return "Host not found";
      }
      else {
! 	if (inet_aton(host, &ptd->ipaddr) == 0) return "Invalid numeric address";
          hp = gethostbyaddr((char *)&ptd->ipaddr, sizeof(ptd->ipaddr), AF_INET);
          if (hp == NULL) {
              memset(&ptd->hpbuf, 0, sizeof(ptd->hpbuf));
</pre>
Comment 1 Mads Toftum 2003-12-28 11:56:21 UTC
http://httpd.apache.org/dev/patches.html - diff -u 
Comment 2 Joe Orton 2004-10-23 12:05:51 UTC
*** Bug 22586 has been marked as a duplicate of this bug. ***