chuck       97/04/11 23:17:46

  Modified:    src/modules/proxy  proxy_util.c
  Log:
  Fix IP address handling of proxy_host2addr().
  
  Revision  Changes    Path
  1.13      +9 -10     apache/src/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_util.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -C3 -r1.12 -r1.13
  *** proxy_util.c      1997/04/11 05:10:52     1.12
  --- proxy_util.c      1997/04/12 06:17:45     1.13
  ***************
  *** 693,700 ****
    proxy_host2addr(const char *host, struct hostent *reqhp)
    {
        int i;
  !     struct in_addr ipaddr;
  !     char *addr_str;
    
        for (i=0; host[i] != '\0'; i++)
        if (!isdigit(host[i]) && host[i] != '.')
  --- 693,700 ----
    proxy_host2addr(const char *host, struct hostent *reqhp)
    {
        int i;
  !     struct hostent *hp;
  !     u_long ipaddr;
    
        for (i=0; host[i] != '\0'; i++)
        if (!isdigit(host[i]) && host[i] != '.')
  ***************
  *** 702,719 ****
    
        if (host[i] != '\0')
        {
  -     struct hostent *hp;
  - 
        hp = gethostbyname(host);
  !     if (hp == NULL) return "Host not found";
  !     memcpy(reqhp, hp, sizeof(struct hostent));
        } else
        {
  !     if ((ipaddr.s_addr = inet_addr(host)) == -1)
  !         return "Bad IP address";
  !     Explain1("Address is %s", addr_str);
  !     memcpy(reqhp->h_addr, &ipaddr, sizeof(struct in_addr));
        }
        return NULL;
    }
    
  --- 702,718 ----
    
        if (host[i] != '\0')
        {
        hp = gethostbyname(host);
  !     if (hp == NULL)
  !         return "Host not found";
        } else
        {
  !     ipaddr = inet_addr(host);
  !     hp = gethostbyaddr((char *)&ipaddr, sizeof(u_long), AF_INET);
  !     if (hp == NULL)
  !         return "Address not found";
        }
  +     memcpy(reqhp, hp, sizeof(struct hostent));
        return NULL;
    }
    
  
  
  

Reply via email to