cvs commit: apache/src/modules/proxy proxy_util.c
marc98/01/05 13:02:57 Modified:src/modules/proxy Tag: APACHE_1_2_X proxy_util.c Log: Fix an improper length in an ap_snprintf call in proxy_date_canon(). Reviewed by: Martin Kraemer, Mark J Cox, Dean Gaudet, Randy Terbush Revision ChangesPath No revision No revision 1.17.2.1 +5 -2 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.17 retrieving revision 1.17.2.1 diff -u -r1.17 -r1.17.2.1 --- proxy_util.c 1997/06/04 21:20:27 1.17 +++ proxy_util.c 1998/01/05 21:02:56 1.17.2.1 @@ -296,8 +296,11 @@ for (mon=0; mon 12; mon++) if (strcmp(month, months[mon]) == 0) break; if (mon == 12) return x; -if (strlen(x) 31) x = palloc(p, 31); -ap_snprintf(x, strlen(x)+1, %s, %.2d %s %d %.2d:%.2d:%.2d GMT, wday[wk], mday, +if (strlen(x)+1 30) { +x = palloc(p, 30); +} +/* format: Wed, 17 Dec 1997 00:53:40 GMT (29 chars data) */ +ap_snprintf(x, 30, %s, %.2d %s %d %.2d:%.2d:%.2d GMT, wday[wk], mday, months[mon], year, hour, min, sec); return x; }
cvs commit: apache/src/modules/proxy proxy_util.c
chuck 97/06/04 14:20:28 Modified:src/modules/proxy proxy_util.c Log: Final proxy cleanups for release. Change errant memchr call to memset. Check for NULL read fd in proxy_send_fb() so we minimize risk of a coredump after a timeout on the origin host connection. Revision ChangesPath 1.17 +2 -2 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.16 retrieving revision 1.17 diff -C3 -r1.16 -r1.17 *** proxy_util.c 1997/05/31 22:43:00 1.16 --- proxy_util.c 1997/06/04 21:20:27 1.17 *** *** 399,405 */ hard_timeout(proxy send body, r); ! while (!con-aborted) { n = bread(f, buf, IOBUFSIZE); if (n == -1) /* input error */ { --- 399,405 */ hard_timeout(proxy send body, r); ! while (!con-aborted f != NULL) { n = bread(f, buf, IOBUFSIZE); if (n == -1) /* input error */ { *** *** 717,723 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); --- 717,723 ipaddr = inet_addr(host); hp = gethostbyaddr((char *)ipaddr, sizeof(u_long), AF_INET); if (hp == NULL) { ! memset(hpbuf, 0, sizeof(hpbuf)); hpbuf.h_name = 0; hpbuf.h_addrtype = AF_INET; hpbuf.h_length = sizeof(u_long);
cvs commit: apache/src/modules/proxy proxy_util.c
chuck 97/05/31 15:43:02 Modified:src/modules/proxy proxy_util.c Log: Submitted by: Jozsef Hollosi [EMAIL PROTECTED] Cleanup to remove malloc() from proxy_host2addr. Revision ChangesPath 1.16 +2 -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.15 retrieving revision 1.16 diff -C3 -r1.15 -r1.16 *** proxy_util.c 1997/05/29 06:23:36 1.15 --- proxy_util.c 1997/05/31 22:43:00 1.16 *** *** 701,706 --- 701,707 struct hostent *hp; static struct hostent hpbuf; static u_long ipaddr; + static char* charpbuf[2]; for (i=0; host[i] != '\0'; i++) if (!isdigit(host[i]) host[i] != '.') *** *** 720,734 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; } --- 721,733 hpbuf.h_name = 0; hpbuf.h_addrtype = AF_INET; hpbuf.h_length = sizeof(u_long); ! hpbuf.h_addr_list = charpbuf; hpbuf.h_addr_list[0] = (char*)ipaddr; hpbuf.h_addr_list[1] = 0; hp = hpbuf; } } memcpy(reqhp, hp, sizeof(struct hostent)); return NULL; }
cvs commit: apache/src/modules/proxy proxy_util.c
fielding97/05/28 23:23:37 Modified:src/modules/proxy proxy_util.c Log: Until someone has time to create a proxy-specific timeout handler, we need to use hard_timeout any time we are simultaneously reading from one blockable buffer and writing to another. Revision ChangesPath 1.15 +6 -1 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.14 retrieving revision 1.15 diff -C3 -r1.14 -r1.15 *** proxy_util.c 1997/05/27 08:00:48 1.14 --- proxy_util.c 1997/05/29 06:23:36 1.15 *** *** 392,398 conn_rec *con = r-connection; total_bytes_sent = 0; ! soft_timeout(proxy send body, r); while (!con-aborted) { n = bread(f, buf, IOBUFSIZE); --- 392,403 conn_rec *con = r-connection; total_bytes_sent = 0; ! ! /* Since we are reading from one buffer and writing to another, ! * it is unsafe to do a soft_timeout here, at least until the proxy ! * has its own timeout handler which can set both buffers to EOUT. ! */ ! hard_timeout(proxy send body, r); while (!con-aborted) { n = bread(f, buf, IOBUFSIZE);
cvs commit: apache/src/modules/proxy proxy_util.c
chuck 97/04/11 23:17:46 Modified:src/modules/proxy proxy_util.c Log: Fix IP address handling of proxy_host2addr(). Revision ChangesPath 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; }