(had to forward by hand coz it triggered a majordomo admin check - ugh!) --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-- [EMAIL PROTECTED] http://www.apache.org http://www.organic.com/jobs
---------- Forwarded message ---------- Date: Tue, 27 May 1997 01:01:14 -0700 (PDT) From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: BOUNCE [EMAIL PROTECTED]: Admin request of type /\bchange\b.*\badress\b/ at line 7 >From [EMAIL PROTECTED] Tue May 27 01:01:12 1997 Received: (from [EMAIL PROTECTED]) by hyperreal.com (8.8.5/8.8.5) id BAA09870 for apache-cvs; Tue, 27 May 1997 01:01:12 -0700 (PDT) Date: Tue, 27 May 1997 01:01:12 -0700 (PDT) From: Chuck Murcko <[EMAIL PROTECTED]> Message-Id: <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: cvs commit: apache/src CHANGES chuck 97/05/27 01:01:11 Modified: src/modules/proxy proxy_util.c src CHANGES Log: Obtained from:Jozsef Hollosi <[EMAIL PROTECTED]> change proxy_host2addr() to return the original IP adress when gethostbyaddr() fails due to reverse DNS lookup problems. Also make sure we don't leak memory, slowly. Revision Changes Path 1.14 +14 -3 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.13 retrieving revision 1.14 diff -C3 -r1.13 -r1.14 *** proxy_util.c 1997/04/12 06:17:45 1.13 --- proxy_util.c 1997/05/27 08:00:48 1.14 *************** *** 694,700 **** { int i; struct hostent *hp; ! u_long ipaddr; for (i=0; host[i] != '\0'; i++) if (!isdigit(host[i]) && host[i] != '.') --- 694,701 ---- { int i; struct hostent *hp; ! static struct hostent hpbuf; ! static u_long ipaddr; for (i=0; host[i] != '\0'; i++) if (!isdigit(host[i]) && host[i] != '.') *************** *** 709,718 **** { 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; } --- 710,729 ---- { ipaddr = inet_addr(host); hp = gethostbyaddr((char *)&ipaddr, sizeof(u_long), AF_INET); ! if (hp == NULL) { ! memchr(&hpbuf, 0, sizeof(hpbuf)); ! hpbuf.h_name = 0; ! hpbuf.h_addrtype = AF_INET; ! hpbuf.h_length = sizeof(u_long); ! hpbuf.h_addr_list = malloc(2 * sizeof(char*)); ! hpbuf.h_addr_list[0] = (char*)&ipaddr; ! hpbuf.h_addr_list[1] = 0; ! hp = &hpbuf; ! } } memcpy(reqhp, hp, sizeof(struct hostent)); + if (hpbuf.h_addr_list != NULL) + free(hpbuf.h_addr_list); return NULL; } 1.280 +5 -0 apache/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache/src/CHANGES,v retrieving revision 1.279 retrieving revision 1.280 diff -C3 -r1.279 -r1.280 *** CHANGES 1997/05/27 04:41:48 1.279 --- CHANGES 1997/05/27 08:01:10 1.280 *************** *** 1,5 **** --- 1,10 ---- Changes with Apache 1.2 + *) Added code to return the requested IP address from proxy_host2addr() + if gethostbyaddr() fails due to reverse DNS lookup problems. Original + change submitted by Jozsef Hollosi <[EMAIL PROTECTED]>. + [Chuck Murcko] PR#614 + *) If multiple requests on a single connection are used to retrieve data from different virtual hosts, the virtual host list would be scanned starting with the most recently used VH instead of the first,