X-Git-Url: https://git.pld-linux.org/?a=blobdiff_plain;f=apache1-ipv6-PLD.patch;h=3623f0befbd29e510b031db7078d587a3945a95b;hb=53b37e118c381dadf131169a4f51eeffbba78489;hp=c50ed8757db9b70047ab9ee8f7f7ee6f3fecfe22;hpb=2019ee432a3b702ac54e27d9c1250387a5db93aa;p=packages%2Fapache1.git diff --git a/apache1-ipv6-PLD.patch b/apache1-ipv6-PLD.patch index c50ed87..3623f0b 100644 --- a/apache1-ipv6-PLD.patch +++ b/apache1-ipv6-PLD.patch @@ -1,6 +1,5 @@ -diff -Nur apache_1.3.26.orig/README.v6 apache_1.3.26/README.v6 ---- apache_1.3.26.orig/README.v6 Thu Jan 1 01:00:00 1970 -+++ apache_1.3.26/README.v6 Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/README.v6 Thu Jan 1 01:00:00 1970 ++++ apache_1.3.28/README.v6 Fri Jul 25 11:01:55 2003 @@ -0,0 +1,166 @@ +IPv6-ready apache 1.3.x +KAME Project @@ -168,9 +167,8 @@ diff -Nur apache_1.3.26.orig/README.v6 apache_1.3.26/README.v6 + http://www.v6.linux.or.jp/ + YOSHIFUJI Hideaki, USAGI Project + http://www.linux-ipv6.org/ -diff -Nur apache_1.3.26.orig/conf/httpd.conf-dist apache_1.3.26/conf/httpd.conf-dist ---- apache_1.3.26.orig/conf/httpd.conf-dist Tue Mar 5 17:19:12 2002 -+++ apache_1.3.26/conf/httpd.conf-dist Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/conf/httpd.conf-dist Wed Jul 16 21:36:41 2003 ++++ apache_1.3.28/conf/httpd.conf-dist Fri Jul 25 11:01:55 2003 @@ -174,6 +174,11 @@ #Listen 3000 #Listen 12.34.56.78:80 @@ -183,16 +181,14 @@ diff -Nur apache_1.3.26.orig/conf/httpd.conf-dist apache_1.3.26/conf/httpd.conf- # # BindAddress: You can support virtual hosts with this option. This directive # is used to tell the server which IP address to listen to. It can either -diff -Nur apache_1.3.26.orig/configure.v6 apache_1.3.26/configure.v6 ---- apache_1.3.26.orig/configure.v6 Thu Jan 1 01:00:00 1970 -+++ apache_1.3.26/configure.v6 Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/configure.v6 Thu Jan 1 01:00:00 1970 ++++ apache_1.3.28/configure.v6 Fri Jul 25 11:01:55 2003 @@ -0,0 +1,3 @@ +#! /bin/sh + +./configure --enable-rule=INET6 --enable-module=proxy $* -diff -Nur apache_1.3.26.orig/src/Configuration.tmpl apache_1.3.26/src/Configuration.tmpl ---- apache_1.3.26.orig/src/Configuration.tmpl Wed Jun 19 10:25:56 2002 -+++ apache_1.3.26/src/Configuration.tmpl Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/Configuration.tmpl Fri Jul 25 11:00:49 2003 ++++ apache_1.3.28/src/Configuration.tmpl Fri Jul 25 11:01:55 2003 @@ -191,6 +191,9 @@ # Rule EXPAT=default : If Expat can be found at the system or # in lib/expat-lite, use it; otherwise @@ -211,9 +207,8 @@ diff -Nur apache_1.3.26.orig/src/Configuration.tmpl apache_1.3.26/src/Configurat Rule CYGWIN_WINSOCK=no # DEV_RANDOM: -diff -Nur apache_1.3.26.orig/src/Configure apache_1.3.26/src/Configure ---- apache_1.3.26.orig/src/Configure Wed Jun 19 10:25:56 2002 -+++ apache_1.3.26/src/Configure Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/Configure Fri Jul 25 11:00:49 2003 ++++ apache_1.3.28/src/Configure Fri Jul 25 11:01:55 2003 @@ -238,6 +238,7 @@ RULE_CYGWIN_WINSOCK=`./helpers/CutRule CYGWIN_WINSOCK $file` RULE_SHARED_CORE=`./helpers/CutRule SHARED_CORE $file` @@ -222,7 +217,7 @@ diff -Nur apache_1.3.26.orig/src/Configure apache_1.3.26/src/Configure #################################################################### ## Rule SHARED_CORE implies required DSO support -@@ -1701,6 +1702,124 @@ +@@ -1724,6 +1725,124 @@ esac fi @@ -347,7 +342,7 @@ diff -Nur apache_1.3.26.orig/src/Configure apache_1.3.26/src/Configure #################################################################### ## Find out what modules we want and try and configure things for them ## Module lines can look like this: -@@ -2296,6 +2415,38 @@ +@@ -2320,6 +2439,38 @@ echo "#define AP_LONGEST_LONG $AP_LONGEST_LONG" >>$AP_CONFIG_AUTO_H echo "#endif" >>$AP_CONFIG_AUTO_H @@ -386,9 +381,8 @@ diff -Nur apache_1.3.26.orig/src/Configure apache_1.3.26/src/Configure #################################################################### ## More building ap_config_auto.h ## -diff -Nur apache_1.3.26.orig/src/ap/ap_snprintf.c apache_1.3.26/src/ap/ap_snprintf.c ---- apache_1.3.26.orig/src/ap/ap_snprintf.c Thu Mar 14 13:08:06 2002 -+++ apache_1.3.26/src/ap/ap_snprintf.c Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/ap/ap_snprintf.c Mon Feb 3 18:13:17 2003 ++++ apache_1.3.28/src/ap/ap_snprintf.c Fri Jul 25 11:01:55 2003 @@ -73,6 +73,7 @@ #include #include @@ -397,7 +391,7 @@ diff -Nur apache_1.3.26.orig/src/ap/ap_snprintf.c apache_1.3.26/src/ap/ap_snprin #ifdef WIN32 #include #endif -@@ -504,6 +505,42 @@ +@@ -510,6 +511,42 @@ @@ -440,7 +434,7 @@ diff -Nur apache_1.3.26.orig/src/ap/ap_snprintf.c apache_1.3.26/src/ap/ap_snprin /* * Convert a floating point number to a string formats 'f', 'e' or 'E'. * The result is placed in buf, and len denotes the length of the string -@@ -1055,6 +1092,7 @@ +@@ -1057,6 +1094,7 @@ /* print a struct sockaddr_in as a.b.c.d:port */ case 'I': { @@ -448,7 +442,7 @@ diff -Nur apache_1.3.26.orig/src/ap/ap_snprintf.c apache_1.3.26/src/ap/ap_snprin struct sockaddr_in *si; si = va_arg(ap, struct sockaddr_in *); -@@ -1063,6 +1101,16 @@ +@@ -1065,6 +1103,16 @@ if (adjust_precision && precision < s_len) s_len = precision; } @@ -465,9 +459,8 @@ diff -Nur apache_1.3.26.orig/src/ap/ap_snprintf.c apache_1.3.26/src/ap/ap_snprin else { s = S_NULL; s_len = S_NULL_LEN; -diff -Nur apache_1.3.26.orig/src/include/ap.h apache_1.3.26/src/include/ap.h ---- apache_1.3.26.orig/src/include/ap.h Tue Jun 18 06:19:45 2002 -+++ apache_1.3.26/src/include/ap.h Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/include/ap.h Mon Feb 3 18:13:17 2003 ++++ apache_1.3.28/src/include/ap.h Fri Jul 25 11:01:55 2003 @@ -95,7 +95,8 @@ * with some extensions. The extensions are: * @@ -478,10 +471,9 @@ diff -Nur apache_1.3.26.orig/src/include/ap.h apache_1.3.26/src/include/ap.h * %pp takes a void * and outputs it in hex * * The %p hacks are to force gcc's printf warning code to skip -diff -Nur apache_1.3.26.orig/src/include/ap_config.h apache_1.3.26/src/include/ap_config.h ---- apache_1.3.26.orig/src/include/ap_config.h Mon Jun 3 14:28:27 2002 -+++ apache_1.3.26/src/include/ap_config.h Wed Jun 19 10:26:32 2002 -@@ -407,6 +407,10 @@ +--- apache_1.3.28.orig/src/include/ap_config.h Mon May 5 13:45:49 2003 ++++ apache_1.3.28/src/include/ap_config.h Fri Jul 25 11:01:55 2003 +@@ -411,6 +411,10 @@ #endif #ifndef S_IWOTH #define S_IWOTH 000002 @@ -492,7 +484,7 @@ diff -Nur apache_1.3.26.orig/src/include/ap_config.h apache_1.3.26/src/include/a #endif #define STDIN_FILENO 0 -@@ -1509,6 +1513,70 @@ +@@ -1523,6 +1527,70 @@ #define ap_wait_t int #endif @@ -563,9 +555,8 @@ diff -Nur apache_1.3.26.orig/src/include/ap_config.h apache_1.3.26/src/include/a #ifdef __cplusplus } #endif -diff -Nur apache_1.3.26.orig/src/include/http_conf_globals.h apache_1.3.26/src/include/http_conf_globals.h ---- apache_1.3.26.orig/src/include/http_conf_globals.h Wed Jun 19 10:25:56 2002 -+++ apache_1.3.26/src/include/http_conf_globals.h Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/include/http_conf_globals.h Fri Jul 25 11:00:49 2003 ++++ apache_1.3.28/src/include/http_conf_globals.h Fri Jul 25 11:01:55 2003 @@ -82,7 +82,8 @@ extern API_VAR_EXPORT int ap_max_requests_per_child; extern API_VAR_EXPORT int ap_threads_per_child; @@ -576,9 +567,8 @@ diff -Nur apache_1.3.26.orig/src/include/http_conf_globals.h apache_1.3.26/src/i extern listen_rec *ap_listeners; extern API_VAR_EXPORT int ap_daemons_to_start; extern API_VAR_EXPORT int ap_daemons_min_free; -diff -Nur apache_1.3.26.orig/src/include/http_vhost.h apache_1.3.26/src/include/http_vhost.h ---- apache_1.3.26.orig/src/include/http_vhost.h Wed Mar 13 22:05:29 2002 -+++ apache_1.3.26/src/include/http_vhost.h Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/include/http_vhost.h Mon Feb 3 18:13:19 2003 ++++ apache_1.3.28/src/include/http_vhost.h Fri Jul 25 11:01:55 2003 @@ -73,7 +73,7 @@ API_EXPORT(const char *) ap_parse_vhost_addrs(pool *p, const char *hostname, server_rec *s); @@ -588,10 +578,9 @@ diff -Nur apache_1.3.26.orig/src/include/http_vhost.h apache_1.3.26/src/include/ /* given an ip address only, give our best guess as to what vhost it is */ API_EXPORT(void) ap_update_vhost_given_ip(conn_rec *conn); -diff -Nur apache_1.3.26.orig/src/include/httpd.h apache_1.3.26/src/include/httpd.h ---- apache_1.3.26.orig/src/include/httpd.h Wed Jun 19 10:25:56 2002 -+++ apache_1.3.26/src/include/httpd.h Wed Jun 19 10:26:32 2002 -@@ -903,8 +903,8 @@ +--- apache_1.3.28.orig/src/include/httpd.h Fri Jul 25 11:00:49 2003 ++++ apache_1.3.28/src/include/httpd.h Fri Jul 25 11:01:55 2003 +@@ -904,8 +904,8 @@ /* Who is the client? */ @@ -602,7 +591,7 @@ diff -Nur apache_1.3.26.orig/src/include/httpd.h apache_1.3.26/src/include/httpd char *remote_ip; /* Client's IP address */ char *remote_host; /* Client's DNS name, if known. * NULL if DNS hasn't been checked, -@@ -946,8 +946,8 @@ +@@ -947,8 +947,8 @@ typedef struct server_addr_rec server_addr_rec; struct server_addr_rec { server_addr_rec *next; @@ -613,7 +602,7 @@ diff -Nur apache_1.3.26.orig/src/include/httpd.h apache_1.3.26/src/include/httpd char *virthost; /* The name given in */ }; -@@ -1015,7 +1015,7 @@ +@@ -1016,7 +1016,7 @@ /* These are more like real hosts than virtual hosts */ struct listen_rec { listen_rec *next; @@ -622,7 +611,7 @@ diff -Nur apache_1.3.26.orig/src/include/httpd.h apache_1.3.26/src/include/httpd int fd; int used; /* Only used during restart */ /* more stuff here, like which protocol is bound to the port */ -@@ -1183,7 +1183,7 @@ +@@ -1184,7 +1184,7 @@ #endif /*#ifdef CHARSET_EBCDIC*/ API_EXPORT(char *) ap_get_local_host(pool *); @@ -631,9 +620,8 @@ diff -Nur apache_1.3.26.orig/src/include/httpd.h apache_1.3.26/src/include/httpd extern API_VAR_EXPORT time_t ap_restart_time; -diff -Nur apache_1.3.26.orig/src/include/sa_len.h apache_1.3.26/src/include/sa_len.h ---- apache_1.3.26.orig/src/include/sa_len.h Thu Jan 1 01:00:00 1970 -+++ apache_1.3.26/src/include/sa_len.h Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/include/sa_len.h Thu Jan 1 01:00:00 1970 ++++ apache_1.3.28/src/include/sa_len.h Fri Jul 25 11:01:55 2003 @@ -0,0 +1,41 @@ +/* sa_len.h : tiny version of SA_LEN (written by ) */ + @@ -676,9 +664,8 @@ diff -Nur apache_1.3.26.orig/src/include/sa_len.h apache_1.3.26/src/include/sa_l +} +#endif /* SA_LEN */ +#endif /* HAVE_SOCKADDR_LEN */ -diff -Nur apache_1.3.26.orig/src/include/sockaddr_storage.h apache_1.3.26/src/include/sockaddr_storage.h ---- apache_1.3.26.orig/src/include/sockaddr_storage.h Thu Jan 1 01:00:00 1970 -+++ apache_1.3.26/src/include/sockaddr_storage.h Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/include/sockaddr_storage.h Thu Jan 1 01:00:00 1970 ++++ apache_1.3.28/src/include/sockaddr_storage.h Fri Jul 25 11:01:55 2003 @@ -0,0 +1,53 @@ +/* +struct sockaddr_storage @@ -733,9 +720,8 @@ diff -Nur apache_1.3.26.orig/src/include/sockaddr_storage.h apache_1.3.26/src/in +#define su_port su_si.si_port + +#endif /* NEED_SOCKADDR_STORAGE */ -diff -Nur apache_1.3.26.orig/src/main/getaddrinfo.c apache_1.3.26/src/main/getaddrinfo.c ---- apache_1.3.26.orig/src/main/getaddrinfo.c Thu Jan 1 01:00:00 1970 -+++ apache_1.3.26/src/main/getaddrinfo.c Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/main/getaddrinfo.c Thu Jan 1 01:00:00 1970 ++++ apache_1.3.28/src/main/getaddrinfo.c Fri Jul 25 11:01:55 2003 @@ -0,0 +1,162 @@ +/* + * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. @@ -899,9 +885,8 @@ diff -Nur apache_1.3.26.orig/src/main/getaddrinfo.c apache_1.3.26/src/main/getad + } + return EAI_NODATA; +} -diff -Nur apache_1.3.26.orig/src/main/getnameinfo.c apache_1.3.26/src/main/getnameinfo.c ---- apache_1.3.26.orig/src/main/getnameinfo.c Thu Jan 1 01:00:00 1970 -+++ apache_1.3.26/src/main/getnameinfo.c Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/main/getnameinfo.c Thu Jan 1 01:00:00 1970 ++++ apache_1.3.28/src/main/getnameinfo.c Fri Jul 25 11:01:55 2003 @@ -0,0 +1,95 @@ +/* + * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. @@ -998,10 +983,9 @@ diff -Nur apache_1.3.26.orig/src/main/getnameinfo.c apache_1.3.26/src/main/getna + return EAI_NODATA; + return 0; +} -diff -Nur apache_1.3.26.orig/src/main/http_config.c apache_1.3.26/src/main/http_config.c ---- apache_1.3.26.orig/src/main/http_config.c Wed Jun 19 10:25:56 2002 -+++ apache_1.3.26/src/main/http_config.c Wed Jun 19 10:26:32 2002 -@@ -1564,7 +1564,6 @@ +--- apache_1.3.28.orig/src/main/http_config.c Fri Jul 25 11:00:49 2003 ++++ apache_1.3.28/src/main/http_config.c Fri Jul 25 11:01:55 2003 +@@ -1591,7 +1591,6 @@ ap_scoreboard_fname = DEFAULT_SCOREBOARD; ap_lock_fname = DEFAULT_LOCKFILE; ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; @@ -1009,7 +993,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_config.c apache_1.3.26/src/main/http_ ap_listeners = NULL; ap_listenbacklog = DEFAULT_LISTENBACKLOG; ap_extended_status = 0; -@@ -1597,7 +1596,13 @@ +@@ -1624,7 +1623,13 @@ s->next = NULL; s->addrs = ap_pcalloc(p, sizeof(server_addr_rec)); /* NOT virtual host; don't match any real network interface */ @@ -1024,7 +1008,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_config.c apache_1.3.26/src/main/http_ s->addrs->host_port = 0; /* matches any port */ s->addrs->virthost = ""; /* must be non-NULL */ s->names = s->wild_names = NULL; -@@ -1616,21 +1621,33 @@ +@@ -1643,21 +1648,33 @@ static void default_listeners(pool *p, server_rec *s) { listen_rec *new; @@ -1063,10 +1047,9 @@ diff -Nur apache_1.3.26.orig/src/main/http_config.c apache_1.3.26/src/main/http_ } -diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_core.c ---- apache_1.3.26.orig/src/main/http_core.c Tue Jun 18 02:59:57 2002 -+++ apache_1.3.26/src/main/http_core.c Wed Jun 19 10:26:32 2002 -@@ -71,6 +71,7 @@ +--- apache_1.3.34/src/main/http_core.c.orig 2005-06-28 20:03:25.000000000 +0200 ++++ apache_1.3.34/src/main/http_core.c 2005-10-18 10:14:09.000000000 +0200 +@@ -28,6 +28,7 @@ #include "util_md5.h" #include "scoreboard.h" #include "fnmatch.h" @@ -1074,7 +1057,16 @@ diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_co #ifdef USE_MMAP_FILES #include -@@ -638,7 +639,9 @@ +@@ -570,7 +571,7 @@ + * file if you care. So the adhoc value should do. + */ + return ap_psprintf(r->pool,"%pA%pp%pp%pp%pp", +- &r->connection->local_addr.sin_addr, ++ &((struct sockaddr_in *)&(r->connection->local_addr))->sin_addr, + (void *)ap_user_name, + (void *)ap_listeners, + (void *)ap_server_argv0, +@@ -666,7 +667,9 @@ */ static ap_inline void do_double_reverse (conn_rec *conn) { @@ -1085,7 +1077,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_co if (conn->double_reverse) { /* already done */ -@@ -650,19 +653,43 @@ +@@ -678,30 +681,54 @@ conn->remote_host = ""; /* prevent another lookup */ return; } @@ -1138,9 +1130,11 @@ diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_co + conn->double_reverse = ok ? 1 : -1; + freeaddrinfo(res0); /* invalidate possible reverse-resolved hostname if forward lookup fails */ - conn->remote_host = ""; +- conn->remote_host = ""; ++ if(!ok) ++ conn->remote_host = ""; } -@@ -670,10 +697,9 @@ + API_EXPORT(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type) { @@ -1152,7 +1146,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_co /* If we haven't checked the host name, and we want to */ if (dir_config) { -@@ -695,10 +721,14 @@ +@@ -723,10 +750,14 @@ || hostname_lookups != HOSTNAME_LOOKUP_OFF)) { old_stat = ap_update_child_status(conn->child_num, SERVER_BUSY_DNS, (request_rec*)NULL); @@ -1171,7 +1165,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_co ap_str_tolower(conn->remote_host); if (hostname_lookups == HOSTNAME_LOOKUP_DOUBLE) { -@@ -776,6 +806,7 @@ +@@ -804,6 +835,7 @@ { conn_rec *conn = r->connection; core_dir_config *d; @@ -1179,7 +1173,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_co d = (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); -@@ -785,23 +816,22 @@ +@@ -813,23 +845,22 @@ } if (d->use_canonical_name == USE_CANONICAL_NAME_DNS) { if (conn->local_host == NULL) { @@ -1215,26 +1209,16 @@ diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_co (void) ap_update_child_status(conn->child_num, old_stat, r); } return conn->local_host; -@@ -820,11 +850,13 @@ - - if (d->use_canonical_name == USE_CANONICAL_NAME_OFF - || d->use_canonical_name == USE_CANONICAL_NAME_DNS) { -- return r->hostname ? ntohs(r->connection->local_addr.sin_port) -- : port; -- } -- /* default */ -- return port; -+ return r->hostname -+ ? ntohs(((struct sockaddr_in *)&r->connection->local_addr)->sin_port) -+ : port; -+ } -+ return r->hostname -+ ? ntohs(((struct sockaddr_in *)&r->connection->local_addr)->sin_port) -+ : port; - } - - API_EXPORT(char *) ap_construct_url(pool *p, const char *uri, -@@ -2556,12 +2588,25 @@ +@@ -841,7 +872,7 @@ + API_EXPORT(unsigned) ap_get_server_port(const request_rec *r) + { + unsigned port; +- unsigned cport = ntohs(r->connection->local_addr.sin_port); ++ unsigned cport = ntohs(((struct sockaddr_in *)&r->connection->local_addr)->sin_port); + core_dir_config *d = + (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); + +@@ -2647,12 +2678,25 @@ static const char *set_bind_address(cmd_parms *cmd, void *dummy, char *arg) { @@ -1261,7 +1245,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_co return NULL; } -@@ -2593,44 +2638,70 @@ +@@ -2684,48 +2728,71 @@ return NULL; } @@ -1269,8 +1253,8 @@ diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_co +static const char *set_listener(cmd_parms *cmd, void *dummy, char *h, char *p) { listen_rec *new; -- char *ports; -- unsigned short port; +- char *ports, *endptr; +- long port; + char *host, *port; + struct addrinfo hints, *res; + int error; @@ -1289,18 +1273,19 @@ diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_co - return "Address must end in :"; + host = port = NULL; + if (!p) { -+ port = strrchr(h, ':'); -+ if (port != NULL) { ++ port = strrchr(h, ':'); ++ if (port != NULL) { + if (port == h) { -+ return "Missing IP address"; ++ return "Missing IP address"; + } + else if (port[1] == '\0') { -+ return "Address must end in :"; ++ return "Address must end in :"; + } + *(port++) = '\0'; + if (*h) + host = h; -+ } else { ++ } ++ else { + host = NULL; + port = h; } @@ -1321,9 +1306,13 @@ diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_co - else { - new->local_addr.sin_addr.s_addr = ap_get_virthost_addr(ips, NULL); - } -- port = atoi(ports); -- if (!port) { -- return "Port must be numeric"; +- errno = 0; /* clear errno before calling strtol */ +- port = ap_strtol(ports, &endptr, 10); +- if (errno /* some sort of error */ +- || (endptr && *endptr) /* make sure no trailing characters */ +- || port < 1 || port > 65535) /* underflow/overflow */ +- { +- return "Missing, invalid, or non-numeric port"; + if (host && strcmp(host, "*") == 0) + host = NULL; + @@ -1351,14 +1340,14 @@ diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_co + fprintf(stderr, "resolved to multiple addresses, ambiguous.\n"); + exit(1); } -- new->local_addr.sin_port = htons(port); +- new->local_addr.sin_port = htons((unsigned short)port); + + memcpy(&new->local_addr, res->ai_addr, res->ai_addrlen); + new->fd = -1; new->used = 0; new->next = ap_listeners; -@@ -3353,7 +3424,7 @@ +@@ -3650,7 +3717,7 @@ { "ThreadStackSize", set_threadstacksize, NULL, RSRC_CONF, TAKE1, "Stack size each created thread will use."}, #endif @@ -1367,7 +1356,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_co "A port number or a numeric IP address and a port number"}, { "SendBufferSize", set_send_buffer_size, NULL, RSRC_CONF, TAKE1, "Send buffer size in bytes"}, -@@ -3387,7 +3458,7 @@ +@@ -3684,7 +3751,7 @@ "Name of the config file to be included" }, { "LogLevel", set_loglevel, NULL, RSRC_CONF, TAKE1, "Level of verbosity in error logging" }, @@ -1376,9 +1365,8 @@ diff -Nur apache_1.3.26.orig/src/main/http_core.c apache_1.3.26/src/main/http_co "A numeric IP address:port, or the name of a host" }, #ifdef _OSD_POSIX { "BS2000Account", set_bs2000_account, NULL, RSRC_CONF, TAKE1, -diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_main.c ---- apache_1.3.26.orig/src/main/http_main.c Wed Jun 19 10:25:56 2002 -+++ apache_1.3.26/src/main/http_main.c Wed Jun 19 10:30:52 2002 +--- apache_1.3.28.orig/src/main/http_main.c Fri Jul 25 11:00:49 2003 ++++ apache_1.3.28/src/main/http_main.c Fri Jul 25 12:13:12 2003 @@ -124,6 +124,8 @@ #include /* for IRIX, FD_SET calls bzero() */ #endif @@ -1402,7 +1390,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma API_VAR_EXPORT int ap_daemons_to_start=0; API_VAR_EXPORT int ap_daemons_min_free=0; API_VAR_EXPORT int ap_daemons_max_free=0; -@@ -1389,7 +1396,11 @@ +@@ -1448,7 +1455,11 @@ fprintf(stderr, "Usage: %s [-D name] [-d directory] [-f file]\n", bin); #endif fprintf(stderr, " %s [-C \"directive\"] [-c \"directive\"]\n", pad); @@ -1415,7 +1403,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma fprintf(stderr, "Options:\n"); #ifdef SHARED_CORE fprintf(stderr, " -R directory : specify an alternate location for shared object files\n"); -@@ -1415,6 +1426,10 @@ +@@ -1474,6 +1485,10 @@ #ifndef WIN32 fprintf(stderr, " -F : run main process in foreground, for process supervisors\n"); #endif @@ -1426,7 +1414,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma #ifdef WIN32 fprintf(stderr, " -n name : name the Apache service for -k options below;\n"); fprintf(stderr, " -k stop|shutdown : tell running Apache to shutdown\n"); -@@ -3592,11 +3607,13 @@ +@@ -3630,11 +3645,13 @@ static conn_rec *new_connection(pool *p, server_rec *server, BUFF *inout, @@ -1442,7 +1430,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma /* Got a connection structure, so initialize what fields we can * (the rest are zeroed out by pcalloc). -@@ -3605,17 +3622,29 @@ +@@ -3643,17 +3660,29 @@ conn->child_num = child_num; conn->pool = p; @@ -1478,8 +1466,8 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma #ifdef EAPI conn->ctx = ap_ctx_new(conn->pool); #endif /* EAPI */ -@@ -3666,21 +3695,47 @@ - #define sock_disable_nagle(s) /* NOOP */ +@@ -3711,21 +3740,47 @@ + #define sock_disable_nagle(s, c) /* NOOP */ #endif -static int make_sock(pool *p, const struct sockaddr_in *server) @@ -1534,7 +1522,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, "make_sock: failed to get a socket for %s", addr); -@@ -3783,15 +3838,19 @@ +@@ -3828,15 +3883,19 @@ #ifdef MPE /* MPE requires CAP=PM and GETPRIVMODE to bind to ports less than 1024 */ @@ -1558,7 +1546,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma GETUSERMODE(); #endif -@@ -3804,7 +3863,7 @@ +@@ -3849,7 +3908,7 @@ exit(1); } #ifdef MPE @@ -1567,7 +1555,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma GETUSERMODE(); #endif -@@ -3957,15 +4016,17 @@ +@@ -4002,15 +4061,17 @@ for (;;) { fd = find_listener(lr); if (fd < 0) { @@ -1575,7 +1563,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma + fd = make_sock(p, (struct sockaddr *)&lr->local_addr); } else { - ap_note_cleanups_for_socket(p, fd); + ap_note_cleanups_for_socket_ex(p, fd, 1); } /* if we get here, (fd >= 0) && (fd < FD_SETSIZE) */ - FD_SET(fd, &listenfds); @@ -1584,12 +1572,12 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma + if (fd > 0) { + FD_SET(fd, &listenfds); + if (fd > listenmaxfd) -+ listenmaxfd = fd; ++ listenmaxfd = fd; + } lr->fd = fd; if (lr->next == NULL) break; -@@ -4280,8 +4341,8 @@ +@@ -4327,8 +4388,8 @@ static void child_main(int child_num_arg) { NET_SIZE_T clen; @@ -1600,7 +1588,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma listen_rec *lr; /* All of initialization is a critical section, we don't care if we're -@@ -4453,7 +4514,7 @@ +@@ -4505,7 +4566,7 @@ usr1_just_die = 0; for (;;) { clen = sizeof(sa_client); @@ -1609,16 +1597,16 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma if (csd >= 0 || errno != EINTR) break; if (deferred_die) { -@@ -4616,7 +4677,7 @@ +@@ -4671,7 +4732,7 @@ */ clen = sizeof(sa_server); - if (getsockname(csd, &sa_server, &clen) < 0) { + if (getsockname(csd, (struct sockaddr *)&sa_server, &clen) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "getsockname"); - continue; - } -@@ -4661,8 +4722,8 @@ + ap_log_error(APLOG_MARK, APLOG_DEBUG, server_conf, + "getsockname, client %pA probably dropped the " + "connection", +@@ -4719,8 +4780,8 @@ ap_bpushfd(conn_io, csd, dupped_csd); current_conn = new_connection(ptrans, server_conf, conn_io, @@ -1629,7 +1617,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma my_child_num); /* -@@ -4817,12 +4878,13 @@ +@@ -4875,12 +4936,13 @@ #ifdef _OSD_POSIX /* BS2000 requires a "special" version of fork() before a setuid() call */ @@ -1646,7 +1634,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma ap_log_error(APLOG_MARK, APLOG_ERR, s, "fork: Unable to fork new process"); /* fork didn't succeed. Fix the scoreboard or else -@@ -5434,7 +5496,10 @@ +@@ -5497,7 +5559,10 @@ ap_setup_prelinked_modules(); while ((c = getopt(argc, argv, @@ -1658,7 +1646,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma #ifdef DEBUG_SIGSTOP "Z:" #endif -@@ -5512,8 +5577,14 @@ +@@ -5575,8 +5640,14 @@ ap_configtestonly = 1; ap_docrootcheck = 0; break; @@ -1675,7 +1663,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma case '?': usage(argv[0]); } -@@ -5601,9 +5672,10 @@ +@@ -5665,9 +5736,10 @@ else { conn_rec *conn; request_rec *r; @@ -1687,7 +1675,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma ap_set_version(); /* Yes this is called twice. */ -@@ -5658,25 +5730,32 @@ +@@ -5722,25 +5794,32 @@ #endif l = sizeof(sa_client); @@ -1725,7 +1713,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma while ((r = ap_read_request(conn)) != NULL) { -@@ -7383,7 +7462,11 @@ +@@ -7447,7 +7526,11 @@ while ((c = getopt(argc, argv, "D:C:c:Xd:f:vVlLz:Z:wiuStThk:n:W:")) != -1) { #else /* !WIN32 */ @@ -1738,7 +1726,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma #endif char **new; switch (c) { -@@ -7929,6 +8012,10 @@ +@@ -7993,6 +8076,10 @@ case 't': case 'T': case 'h': @@ -1749,10 +1737,9 @@ diff -Nur apache_1.3.26.orig/src/main/http_main.c apache_1.3.26/src/main/http_ma case '?': break; case 'R': -diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_vhost.c ---- apache_1.3.26.orig/src/main/http_vhost.c Wed Mar 13 22:05:31 2002 -+++ apache_1.3.26/src/main/http_vhost.c Wed Jun 19 10:26:32 2002 -@@ -68,6 +68,7 @@ +--- apache_1.3.31/src/main/http_vhost.c.orig Mon Mar 29 23:03:25 2004 ++++ apache_1.3.31/src/main/http_vhost.c Wed May 12 13:49:13 2004 +@@ -25,6 +25,7 @@ #include "http_log.h" #include "http_vhost.h" #include "http_protocol.h" @@ -1760,7 +1747,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v /* * After all the definitions there's an explanation of how it's all put -@@ -165,78 +166,114 @@ +@@ -122,78 +123,114 @@ * *paddr is the variable used to keep track of **paddr between calls * port is the default port to assume */ @@ -1924,7 +1911,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v return NULL; } -@@ -250,7 +287,8 @@ +@@ -207,7 +244,8 @@ /* start the list of addreses */ addrs = &s->addrs; while (hostname[0]) { @@ -1934,7 +1921,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v if (err) { *addrs = NULL; return err; -@@ -268,10 +306,11 @@ +@@ -225,10 +263,11 @@ } @@ -1948,7 +1935,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v cmd->server->port); } -@@ -345,6 +384,19 @@ +@@ -302,6 +341,19 @@ return ((key >> 8) ^ key) % IPHASH_TABLE_SIZE; } @@ -1968,7 +1955,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v static ipaddr_chain *new_ipaddr_chain(pool *p, -@@ -372,25 +424,77 @@ +@@ -329,25 +381,77 @@ return new; } @@ -2056,7 +2043,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v return NULL; } -@@ -416,21 +520,7 @@ +@@ -373,21 +477,7 @@ int len; char buf[MAX_STRING_LEN]; @@ -2079,7 +2066,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v if (ic->names == NULL) { if (ic->server == NULL) fprintf(f, "%-22s WARNING: No defined for this NameVirtualHost!\n", buf); -@@ -558,10 +648,37 @@ +@@ -515,10 +605,37 @@ * occured in the config file, we'll copy it in that order. */ for (sar = name_vhost_list; sar; sar = sar->next) { @@ -2087,7 +2074,8 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v + unsigned bucket = hash_addr((struct sockaddr *)&sar->host_addr); ipaddr_chain *ic = new_ipaddr_chain(p, NULL, sar); + int wildcard; -+ + +- if (sar->host_addr.s_addr != INADDR_ANY) { + wildcard = 0; + switch (sar->host_addr.ss_family) { + case AF_INET: @@ -2113,18 +2101,22 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v + } +#endif + } - -- if (sar->host_addr.s_addr != INADDR_ANY) { ++ + if (!wildcard) { *iphash_table_tail[bucket] = ic; iphash_table_tail[bucket] = &ic->next; } -@@ -588,12 +705,45 @@ +@@ -545,12 +662,45 @@ has_default_vhost_addr = 0; for (sar = s->addrs; sar; sar = sar->next) { ipaddr_chain *ic; + int wildcard; -+ + +- if (sar->host_addr.s_addr == DEFAULT_VHOST_ADDR +- || sar->host_addr.s_addr == INADDR_ANY) { +- ic = find_default_server(sar->host_port); +- if (!ic || !add_name_vhost_config(p, main_s, s, sar, ic)) { +- if (ic && ic->sar->host_port != 0) { + wildcard = 0; + switch (sar->host_addr.ss_family) { + case AF_INET: @@ -2152,12 +2144,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v + } +#endif + } - -- if (sar->host_addr.s_addr == DEFAULT_VHOST_ADDR -- || sar->host_addr.s_addr == INADDR_ANY) { -- ic = find_default_server(sar->host_port); -- if (!ic || !add_name_vhost_config(p, main_s, s, sar, ic)) { -- if (ic && ic->sar->host_port != 0) { ++ + if (wildcard) { + /* add it to default bucket for each appropriate sar + * since we need to do a port test @@ -2170,7 +2157,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, main_s, "_default_ VirtualHost overlap on port %u," " the first has precedence", sar->host_port); -@@ -606,10 +756,11 @@ +@@ -563,10 +713,11 @@ } else { /* see if it matches something we've already got */ @@ -2184,7 +2171,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v ic = new_ipaddr_chain(p, s, sar); ic->next = *iphash_table_tail[bucket]; -@@ -646,19 +797,33 @@ +@@ -603,19 +754,33 @@ } else { struct hostent *h; @@ -2223,11 +2210,11 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v s->server_hostname = ap_pstrdup(p, "bogus_host_without_reverse_dns"); } -@@ -705,35 +870,58 @@ - char *host = ap_palloc(r->pool, strlen(r->hostname) + 1); +@@ -663,45 +828,80 @@ const char *src; char *dst; -+ const char *u = NULL, *v = NULL; + const char *port_str; ++ const char *u, *v = NULL; /* check and copy the host part */ - src = r->hostname; @@ -2246,67 +2233,93 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v - goto bad; - } - if (*src == ':') { +- port_str = src + 1; - /* check the port part */ - while (*++src) { - if (!ap_isdigit(*src)) { -- goto bad; ++ if (*u == '[') { /* IPv6 numeral address in brackets */ ++ v = strchr(u, ']'); ++ if (v == NULL) { ++ /* missing closing bracket */ ++ goto bad; ++ } ++ if (v == (u + 1)) { ++ /* bad empty address */ ++ goto bad; ++ } ++ for (src = u+1; src < v; src++) /* copy IPv6 adress */ ++ *dst = *src; ++ v++; ++ if (*v == ':') { ++ port_str = v + 1; ++ v++; ++ while (*v) { /* check if portnum is correct */ ++ if (!ap_isdigit(*v++)) + goto bad; - } -- } + } - if (src[-1] == ':') -- goto bad; -- else ++ if (v[-1] == ':') ++ goto bad; ++ else { ++ /* a known "good" port value */ ++ int iport; ++ iport = atoi(port_str); ++ if (iport < 1 || iport > 65535) { ++ goto bad; ++ } ++ r->parsed_uri.port_str = ap_pstrdup(r->pool, port_str); ++ r->parsed_uri.port = iport; ++ } ++ } ++ } else { ++ while (*src) { ++ if (*src == '.') { ++ *dst++ = *src++; ++ if (*src == '.') ++ goto bad; ++ else ++ continue; ++ } ++ if (*src == '/' || *src == '\\') { + goto bad; +- else { +- /* a known "good" port value */ +- int iport; +- iport = atoi(port_str); +- if (iport < 1 || iport > 65535) { ++ } ++ if (*src == ':') { ++ port_str = src + 1; ++ /* sheck the port part */ ++ while (*++src) { ++ if (!ap_isdigit(*src)) { ++ goto bad; ++ } ++ } ++ if (src[-1] == ':') + goto bad; ++ else { ++ /* a known "good" port value */ ++ int iport; ++ iport = atoi(port_str); ++ if (iport < 1 || iport > 65535) { ++ goto bad; ++ } ++ r->parsed_uri.port_str = ap_pstrdup(r->pool, port_str); ++ r->parsed_uri.port = iport; + } +- r->parsed_uri.port_str = ap_pstrdup(r->pool, port_str); +- r->parsed_uri.port = iport; - break; -+ if (*u == '[') { /* IPv6 numeral address in brackets */ -+ v = strchr(u, ']'); -+ if (v == NULL) { -+ /* missing closing bracket */ -+ goto bad; -+ } -+ if (v == (u + 1)) { -+ /* bad empty address */ -+ goto bad; -+ } -+ for (src = u+1; src < v; src++) /* copy IPv6 adress */ -+ *dst = *src; -+ v++; -+ if (*v == ':') { -+ v++; -+ while (*v) { /* check if portnum is correct */ -+ if (!ap_isdigit(*v++)) -+ goto bad; -+ } + } ++ *dst++ = *src++; } - *dst++ = *src++; -+ } else { -+ while (*src) { -+ if (*src == '.') { -+ *dst++ = *src++; -+ if (*src == '.') -+ goto bad; -+ else -+ continue; -+ } -+ if (*src == '/' || *src == '\\') { -+ goto bad; -+ } -+ if (*src == ':') { -+ /* sheck the port part */ -+ while (*++src) { -+ if (!ap_isdigit(*src)) { -+ goto bad; -+ } -+ } -+ if (src[-1] == ':') -+ goto bad; -+ else -+ break; -+ } -+ *dst++ = *src++; -+ } } /* strip trailing gubbins */ if (dst > host && dst[-1] == '.') { -@@ -748,7 +936,7 @@ +@@ -716,7 +916,7 @@ bad: r->status = HTTP_BAD_REQUEST; ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, @@ -2315,7 +2328,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v return; } -@@ -851,11 +1039,25 @@ +@@ -819,11 +1019,25 @@ * names we'll match have ports associated with them */ const char *host = r->hostname; @@ -2342,7 +2355,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v last_s = NULL; /* Recall that the name_chain is a list of server_addr_recs, some of -@@ -910,7 +1112,22 @@ +@@ -878,7 +1092,22 @@ server_rec *s; server_rec *last_s; name_chain *src; @@ -2366,7 +2379,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v /* * This is in conjunction with the ServerPath code in http_core, so we -@@ -970,10 +1187,22 @@ +@@ -938,10 +1167,22 @@ API_EXPORT(void) ap_update_vhost_given_ip(conn_rec *conn) { ipaddr_chain *trav; @@ -2391,7 +2404,7 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v if (trav) { /* save the name_chain for later in case this is a name-vhost */ conn->vhost_lookup_data = trav->names; -@@ -991,6 +1220,7 @@ +@@ -959,6 +1200,7 @@ return; } @@ -2399,9 +2412,8 @@ diff -Nur apache_1.3.26.orig/src/main/http_vhost.c apache_1.3.26/src/main/http_v /* otherwise we're stuck with just the main server * and no name-based vhosts */ -diff -Nur apache_1.3.26.orig/src/main/rfc1413.c apache_1.3.26/src/main/rfc1413.c ---- apache_1.3.26.orig/src/main/rfc1413.c Wed Mar 13 22:05:31 2002 -+++ apache_1.3.26/src/main/rfc1413.c Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/main/rfc1413.c Mon Feb 3 18:13:23 2003 ++++ apache_1.3.28/src/main/rfc1413.c Fri Jul 25 12:15:05 2003 @@ -82,6 +82,7 @@ #include "http_log.h" /* for aplog_error */ #include "rfc1413.h" @@ -2522,8 +2534,8 @@ diff -Nur apache_1.3.26.orig/src/main/rfc1413.c apache_1.3.26/src/main/rfc1413.c result = FROM_UNKNOWN; -- sock = ap_psocket(conn->pool, AF_INET, SOCK_STREAM, IPPROTO_TCP); -+ sock = ap_psocket(conn->pool, conn->remote_addr.ss_family, SOCK_STREAM, IPPROTO_TCP); +- sock = ap_psocket_ex(conn->pool, AF_INET, SOCK_STREAM, IPPROTO_TCP, 1); ++ sock = ap_psocket_ex(conn->pool, conn->remote_addr.ss_family, SOCK_STREAM, IPPROTO_TCP, 1); if (sock < 0) { ap_log_error(APLOG_MARK, APLOG_CRIT, srv, "socket: rfc1413: error creating socket"); @@ -2539,9 +2551,8 @@ diff -Nur apache_1.3.26.orig/src/main/rfc1413.c apache_1.3.26/src/main/rfc1413.c } ap_set_callback_and_alarm(NULL, 0); ap_pclosesocket(conn->pool, sock); -diff -Nur apache_1.3.26.orig/src/main/util.c apache_1.3.26/src/main/util.c ---- apache_1.3.26.orig/src/main/util.c Tue Jun 18 02:59:58 2002 -+++ apache_1.3.26/src/main/util.c Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/main/util.c Mon Feb 3 18:13:23 2003 ++++ apache_1.3.28/src/main/util.c Fri Jul 25 11:01:55 2003 @@ -2017,52 +2017,87 @@ * Parses a host of the form
[:port] * :port is permitted if 'port' is not NULL @@ -2739,9 +2750,8 @@ diff -Nur apache_1.3.26.orig/src/main/util.c apache_1.3.26/src/main/util.c +#ifdef NEED_GETNAMEINFO +#include "getnameinfo.c" +#endif -diff -Nur apache_1.3.26.orig/src/main/util_script.c apache_1.3.26/src/main/util_script.c ---- apache_1.3.26.orig/src/main/util_script.c Thu Mar 21 17:07:02 2002 -+++ apache_1.3.26/src/main/util_script.c Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/main/util_script.c Mon Feb 3 18:13:23 2003 ++++ apache_1.3.28/src/main/util_script.c Fri Jul 25 11:01:55 2003 @@ -67,6 +67,7 @@ #include "http_request.h" /* for sub_req_lookup_uri() */ #include "util_script.h" @@ -2758,7 +2768,7 @@ diff -Nur apache_1.3.26.orig/src/main/util_script.c apache_1.3.26/src/main/util_ /* use a temporary table which we'll overlap onto * r->subprocess_env later -@@ -293,8 +295,16 @@ +@@ -294,8 +296,16 @@ ap_table_addn(e, "SERVER_ADMIN", s->server_admin); /* Apache */ ap_table_addn(e, "SCRIPT_FILENAME", r->filename); /* Apache */ @@ -2777,10 +2787,9 @@ diff -Nur apache_1.3.26.orig/src/main/util_script.c apache_1.3.26/src/main/util_ if (c->user) { ap_table_addn(e, "REMOTE_USER", c->user); -diff -Nur apache_1.3.26.orig/src/main/util_uri.c apache_1.3.26/src/main/util_uri.c ---- apache_1.3.26.orig/src/main/util_uri.c Tue Jun 18 02:59:58 2002 -+++ apache_1.3.26/src/main/util_uri.c Wed Jun 19 10:26:32 2002 -@@ -419,6 +419,12 @@ +--- apache_1.3.28.orig/src/main/util_uri.c Mon Feb 3 18:13:24 2003 ++++ apache_1.3.28/src/main/util_uri.c Fri Jul 25 11:01:55 2003 +@@ -424,6 +424,12 @@ * the hostname. If there's a port it is the first colon. */ s = memchr(hostinfo, ':', uri - hostinfo); @@ -2793,7 +2802,7 @@ diff -Nur apache_1.3.26.orig/src/main/util_uri.c apache_1.3.26/src/main/util_uri if (s == NULL) { /* we expect the common case to have no port */ uptr->hostname = ap_pstrndup(p, hostinfo, uri - hostinfo); -@@ -475,7 +481,12 @@ +@@ -480,7 +486,12 @@ /* We expect hostinfo to point to the first character of * the hostname. There must be a port, separated by a colon */ @@ -2807,9 +2816,8 @@ diff -Nur apache_1.3.26.orig/src/main/util_uri.c apache_1.3.26/src/main/util_uri if (s == NULL) { return HTTP_BAD_REQUEST; } -diff -Nur apache_1.3.26.orig/src/modules/proxy/mod_proxy.c apache_1.3.26/src/modules/proxy/mod_proxy.c ---- apache_1.3.26.orig/src/modules/proxy/mod_proxy.c Wed Jun 19 10:25:56 2002 -+++ apache_1.3.26/src/modules/proxy/mod_proxy.c Wed Jun 19 10:32:29 2002 +--- apache_1.3.28.orig/src/modules/proxy/mod_proxy.c Fri Jul 25 11:00:49 2003 ++++ apache_1.3.28/src/modules/proxy/mod_proxy.c Fri Jul 25 11:01:55 2003 @@ -574,11 +574,31 @@ struct proxy_remote *new; char *p, *q; @@ -2861,9 +2869,8 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/mod_proxy.c apache_1.3.26/src/mod new->port = port; return NULL; } -diff -Nur apache_1.3.26.orig/src/modules/proxy/mod_proxy.h apache_1.3.26/src/modules/proxy/mod_proxy.h ---- apache_1.3.26.orig/src/modules/proxy/mod_proxy.h Sun Apr 21 13:35:07 2002 -+++ apache_1.3.26/src/modules/proxy/mod_proxy.h Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/modules/proxy/mod_proxy.h Mon Feb 3 18:13:26 2003 ++++ apache_1.3.28/src/modules/proxy/mod_proxy.h Fri Jul 25 11:01:55 2003 @@ -310,7 +310,7 @@ int ap_proxy_is_domainname(struct dirconn_entry *This, pool *p); int ap_proxy_is_hostname(struct dirconn_entry *This, pool *p); @@ -2873,9 +2880,8 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/mod_proxy.h apache_1.3.26/src/mod int ap_proxy_garbage_init(server_rec *, pool *); /* This function is called by ap_table_do() for all header lines */ int ap_proxy_send_hdr_line(void *p, const char *key, const char *value); -diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_connect.c apache_1.3.26/src/modules/proxy/proxy_connect.c ---- apache_1.3.26.orig/src/modules/proxy/proxy_connect.c Mon Mar 25 10:21:58 2002 -+++ apache_1.3.26/src/modules/proxy/proxy_connect.c Wed Jun 19 10:38:06 2002 +--- apache_1.3.28.orig/src/modules/proxy/proxy_connect.c Mon Feb 3 18:13:26 2003 ++++ apache_1.3.28/src/modules/proxy/proxy_connect.c Fri Jul 25 11:27:12 2003 @@ -113,14 +113,15 @@ const char *proxyhost, int proxyport) { @@ -2970,13 +2976,13 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_connect.c apache_1.3.26/src case DEFAULT_SNEWS_PORT: break; default: -+ freeaddrinfo(res0); ++ freeaddrinfo(res0); return HTTP_FORBIDDEN; } } - else if (!allowed_port(conf, port)) + else if (!allowed_port(conf, port)) { -+ freeaddrinfo(res0); ++ freeaddrinfo(res0); return HTTP_FORBIDDEN; + } @@ -3011,14 +3017,14 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_connect.c apache_1.3.26/src - return ap_proxyerror(r, - proxyhost ? HTTP_BAD_GATEWAY : HTTP_INTERNAL_SERVER_ERROR, err); - -- sock = ap_psocket(r->pool, PF_INET, SOCK_STREAM, IPPROTO_TCP); +- sock = ap_psocket_ex(r->pool, PF_INET, SOCK_STREAM, IPPROTO_TCP, 1); - if (sock == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "proxy: error creating socket"); - return HTTP_INTERNAL_SERVER_ERROR; - } + sock = i = -1; + for (res = res0; res; res = res->ai_next) { -+ sock = ap_psocket(r->pool, res->ai_family, res->ai_socktype, res->ai_protocol); ++ sock = ap_psocket_ex(r->pool, res->ai_family, res->ai_socktype, res->ai_protocol, 1); + if (sock == -1) + continue; @@ -3047,9 +3053,8 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_connect.c apache_1.3.26/src if (i == -1) { ap_pclosesocket(r->pool, sock); return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, ap_pstrcat(r->pool, -diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_ftp.c apache_1.3.26/src/modules/proxy/proxy_ftp.c ---- apache_1.3.26.orig/src/modules/proxy/proxy_ftp.c Sun Apr 7 20:57:36 2002 -+++ apache_1.3.26/src/modules/proxy/proxy_ftp.c Wed Jun 19 10:49:53 2002 +--- apache_1.3.28.orig/src/modules/proxy/proxy_ftp.c Mon Feb 3 18:13:26 2003 ++++ apache_1.3.28/src/modules/proxy/proxy_ftp.c Fri Jul 25 11:18:38 2003 @@ -62,6 +62,7 @@ #include "http_main.h" #include "http_log.h" @@ -3091,40 +3096,38 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_ftp.c apache_1.3.26/src/mod /* stuff for responses */ char resp[MAX_STRING_LEN]; char *size = NULL; -@@ -658,62 +668,52 @@ +@@ -658,62 +668,50 @@ if (parms != NULL) *(parms++) = '\0'; - memset(&server, 0, sizeof(struct sockaddr_in)); - server.sin_family = AF_INET; -- server.sin_port = htons((unsigned short)port); -- err = ap_proxy_host2addr(host, &server_hp); +- server.sin_port = htons((unsigned short)destport); +- err = ap_proxy_host2addr(desthost, &server_hp); - if (err != NULL) - return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, err); - -- sock = ap_psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP); +- sock = ap_psocket_ex(p, PF_INET, SOCK_STREAM, IPPROTO_TCP, 1); - if (sock == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: error creating socket"); - return HTTP_INTERNAL_SERVER_ERROR; -- } -+ ap_snprintf(portbuf, sizeof(portbuf), "%d", port); ++ ap_snprintf(portbuf, sizeof(portbuf), "%d", destport); + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; -+ error = getaddrinfo(host, portbuf, &hints, &res0); ++ error = getaddrinfo(desthost, portbuf, &hints, &res0); + if (error) { -+ return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, -+ gai_strerror(error)); -+ } -+ ++ return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, gai_strerror(error)); + } + + i = -1; + for (res = res0; res; res = res->ai_next) { -+ sock = ap_psocket(p, res->ai_family, res->ai_socktype, -+ res->ai_protocol); ++ sock = ap_psocket_ex(p, res->ai_family, res->ai_socktype, ++ res->ai_protocol, 1); + if (sock == -1) + continue; - ++ #if !defined(TPF) && !defined(BEOS) - if (conf->recv_buffer_size > 0 - && setsockopt(sock, SOL_SOCKET, SO_RCVBUF, @@ -3133,29 +3136,29 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_ftp.c apache_1.3.26/src/mod - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); - } -+ if (conf->recv_buffer_size > 0 -+ && setsockopt(sock, SOL_SOCKET, SO_RCVBUF, -+ (const char *)&conf->recv_buffer_size, sizeof(int)) -+ == -1) { -+ ap_log_rerror(APLOG_MARK, APLOG_ERR, r, -+ "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); -+ } ++ if (conf->recv_buffer_size > 0 ++ && setsockopt(sock, SOL_SOCKET, SO_RCVBUF, ++ (const char *)&conf->recv_buffer_size, sizeof(int)) ++ == -1) { ++ ap_log_rerror(APLOG_MARK, APLOG_ERR, r, ++ "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default"); ++ } #endif - if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&one, - sizeof(one)) == -1) { -+ if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&one, -+ sizeof(one)) == -1) { ++ if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&one, ++ sizeof(one)) == -1) { #ifndef _OSD_POSIX /* BS2000 has this option "always on" */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: error setting reuseaddr option: setsockopt(SO_REUSEADDR)"); - ap_pclosesocket(p, sock); - return HTTP_INTERNAL_SERVER_ERROR; -+ ap_log_rerror(APLOG_MARK, APLOG_ERR, r, -+ "proxy: error setting reuseaddr option: setsockopt(SO_REUSEADDR)"); -+ ap_pclosesocket(p, sock); ++ ap_log_rerror(APLOG_MARK, APLOG_ERR, r, ++ "proxy: error setting reuseaddr option: setsockopt(SO_REUSEADDR)"); ++ ap_pclosesocket(p, sock); + freeaddrinfo(res0); -+ return HTTP_INTERNAL_SERVER_ERROR; ++ return HTTP_INTERNAL_SERVER_ERROR; #endif /* _OSD_POSIX */ - } - @@ -3177,9 +3180,8 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_ftp.c apache_1.3.26/src/mod - sizeof(struct in_addr)); - i = ap_proxy_doconnect(sock, &server, r); - if (i == 0) -+ -+ i = ap_proxy_doconnect(sock, res->ai_addr, r); -+ if (i == 0) { ++ i = ap_proxy_doconnect(sock, res->ai_addr, r); ++ if (i == 0) { + memcpy(&server, res->ai_addr, res->ai_addrlen); break; - j++; @@ -3191,16 +3193,16 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_ftp.c apache_1.3.26/src/mod if (i == -1) { return ftp_cleanup_and_return(r, ctrl, data, sock, dsock, ap_proxyerror(r, HTTP_BAD_GATEWAY, ap_pstrcat(r->pool, -@@ -944,7 +944,7 @@ +@@ -944,7 +942,7 @@ } /* try to set up PASV data connection first */ -- dsock = ap_psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP); -+ dsock = ap_psocket(p, server.ss_family, SOCK_STREAM, IPPROTO_TCP); +- dsock = ap_psocket_ex(p, PF_INET, SOCK_STREAM, IPPROTO_TCP, 1); ++ dsock = ap_psocket_ex(p, server.ss_family, SOCK_STREAM, IPPROTO_TCP, 1); if (dsock == -1) { return ftp_cleanup_and_return(r, ctrl, data, sock, dsock, ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, -@@ -961,11 +961,22 @@ +@@ -961,11 +959,22 @@ } #endif @@ -3225,7 +3227,7 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_ftp.c apache_1.3.26/src/mod /* 421 Service not available, closing control connection. */ /* 500 Syntax error, command unrecognized. */ /* 501 Syntax error in parameters or arguments. */ -@@ -976,7 +987,7 @@ +@@ -976,7 +985,7 @@ if (i == -1 || i == 421) { return ftp_cleanup_and_return(r, ctrl, data, sock, dsock, ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, @@ -3234,7 +3236,7 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_ftp.c apache_1.3.26/src/mod } else { pasv[i - 1] = '\0'; -@@ -1004,10 +1015,14 @@ +@@ -1004,10 +1013,14 @@ pport = (p1 << 8) + p0; ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, r->server, "FTP: contacting host %d.%d.%d.%d:%d", h3, h2, h1, h0, pport); @@ -3253,7 +3255,7 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_ftp.c apache_1.3.26/src/mod if (i == -1) { return ftp_cleanup_and_return(r, ctrl, data, sock, dsock, -@@ -1017,6 +1032,64 @@ +@@ -1017,6 +1030,64 @@ strerror(errno), NULL))); } pasvmode = 1; @@ -3318,7 +3320,7 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_ftp.c apache_1.3.26/src/mod } else { ap_pclosesocket(p, dsock); /* and try the regular way */ -@@ -1025,14 +1098,14 @@ +@@ -1025,14 +1096,14 @@ } if (!pasvmode) { /* set up data connection */ @@ -3330,12 +3332,12 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_ftp.c apache_1.3.26/src/mod "proxy: error getting socket address")); } -- dsock = ap_psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP); -+ dsock = ap_psocket(p, server.ss_family, SOCK_STREAM, IPPROTO_TCP); +- dsock = ap_psocket_ex(p, PF_INET, SOCK_STREAM, IPPROTO_TCP, 1); ++ dsock = ap_psocket_ex(p, server.ss_family, SOCK_STREAM, IPPROTO_TCP, 1); if (dsock == -1) { return ftp_cleanup_and_return(r, ctrl, data, sock, dsock, ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, -@@ -1048,13 +1121,28 @@ +@@ -1048,13 +1119,28 @@ #endif /* _OSD_POSIX */ } @@ -3368,7 +3370,7 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_ftp.c apache_1.3.26/src/mod } listen(dsock, 2); /* only need a short queue */ } -@@ -1308,7 +1396,7 @@ +@@ -1308,7 +1394,7 @@ if (!pasvmode) { /* wait for connection */ ap_hard_timeout("proxy ftp data connect", r); @@ -3377,10 +3379,9 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_ftp.c apache_1.3.26/src/mod do csd = accept(dsock, (struct sockaddr *)&server, &clen); while (csd == -1 && errno == EINTR); -diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_http.c apache_1.3.26/src/modules/proxy/proxy_http.c ---- apache_1.3.26.orig/src/modules/proxy/proxy_http.c Wed Jun 19 10:25:56 2002 -+++ apache_1.3.26/src/modules/proxy/proxy_http.c Wed Jun 19 11:00:47 2002 -@@ -156,9 +156,8 @@ +--- apache_1.3.34/src/modules/proxy/proxy_http.c.orig 2005-10-18 09:56:15.000000000 +0200 ++++ apache_1.3.34/src/modules/proxy/proxy_http.c 2005-10-18 10:15:06.000000000 +0200 +@@ -113,9 +113,8 @@ table *req_hdrs, *resp_hdrs; array_header *reqhdrs_arr; table_entry *reqhdrs_elts; @@ -3392,17 +3393,17 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_http.c apache_1.3.26/src/mo BUFF *f; char buffer[HUGE_STRING_LEN]; char portstr[32]; -@@ -184,9 +183,6 @@ +@@ -141,9 +140,6 @@ if (conf->cache.root == NULL) nocache = 1; - memset(&server, '\0', sizeof(server)); - server.sin_family = AF_INET; -- +- /* We break the URL into host, port, path-search */ urlptr = strstr(url, "://"); -@@ -194,6 +190,8 @@ +@@ -151,6 +147,8 @@ return HTTP_BAD_REQUEST; urlptr += 3; destport = DEFAULT_HTTP_PORT; @@ -3411,7 +3412,7 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_http.c apache_1.3.26/src/mo #ifdef EAPI ap_hook_use("ap::mod_proxy::http::handler::set_destport", AP_HOOK_SIG2(int,ptr), -@@ -212,7 +210,20 @@ +@@ -169,7 +167,20 @@ urlptr = strp; desthost = q; } @@ -3433,15 +3434,10 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_http.c apache_1.3.26/src/mo strp2 = strchr(desthost, ':'); if (strp2 != NULL) { *(strp2++) = '\0'; -@@ -223,46 +234,70 @@ +@@ -179,46 +190,71 @@ + } } - /* check if ProxyBlock directive on this host */ -- destaddr.s_addr = ap_inet_addr(desthost); -- for (i = 0; i < conf->noproxies->nelts; i++) { -- if (destaddr.s_addr == npent[i].addr.s_addr || -- (npent[i].name != NULL && -- (npent[i].name[0] == '*' || strstr(desthost, npent[i].name) != NULL))) + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; @@ -3452,7 +3448,12 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_http.c apache_1.3.26/src/mo + gai_strerror(error)); /* give up */ + } + -+ /* check if ProxyBlock directive on this host */ + /* check if ProxyBlock directive on this host */ +- destaddr.s_addr = ap_inet_addr(desthost); +- for (i = 0; i < conf->noproxies->nelts; i++) { +- if (destaddr.s_addr == npent[i].addr.s_addr || +- (npent[i].name != NULL && +- (npent[i].name[0] == '*' || strstr(desthost, npent[i].name) != NULL))) + for (res = res0; res; res = res->ai_next) { + struct sockaddr_in *sin; +#ifdef INET6 @@ -3510,30 +3511,26 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_http.c apache_1.3.26/src/mo -#endif - } - -- -- /* -- * we have worked out who exactly we are going to connect to, now make -- * that connection... -- */ -- sock = ap_psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP); + + /* + * we have worked out who exactly we are going to connect to, now make + * that connection... + */ +- sock = ap_psocket_ex(p, PF_INET, SOCK_STREAM, IPPROTO_TCP, 1); - if (sock == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: error creating socket"); - return HTTP_INTERNAL_SERVER_ERROR; - } - -+ + sock = i = -1; + for (res = res0; res; res = res->ai_next) { -+ sock = ap_psocket(p, res->ai_family, res->ai_socktype, -+ res->ai_protocol); ++ sock = ap_psocket_ex(p, res->ai_family, res->ai_socktype, res->ai_protocol, 1); + if (sock < 0) + continue; -+ + #if !defined(TPF) && !defined(BEOS) if (conf->recv_buffer_size) { - if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, -@@ -274,28 +309,12 @@ +@@ -231,38 +267,13 @@ } #endif @@ -3546,6 +3543,11 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_http.c apache_1.3.26/src/mo - i = ap_proxy_doconnect(sock, &server, r); - if (i == 0) - break; +- /* +- * Even if the connection was unsuccesful we should +- * reinit the socket +- */ +- sock = ap_psocket_ex(p, PF_INET, SOCK_STREAM, IPPROTO_TCP, 1); - } - } -#else @@ -3554,18 +3556,23 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_http.c apache_1.3.26/src/mo - memcpy(&server.sin_addr, server_hp.h_addr_list[j], - sizeof(struct in_addr)); - i = ap_proxy_doconnect(sock, &server, r); -+ i = ap_proxy_doconnect(sock, res->ai_addr, r); ++ i = ap_proxy_doconnect(sock, res->ai_addr, r); if (i == 0) break; -- j++; -+ ap_pclosesocket(p, sock); +- /* +- * Even if the connection was unsuccesful we should +- * reinit the socket +- */ +- sock = ap_psocket_ex(p, PF_INET, SOCK_STREAM, IPPROTO_TCP, 1); ++ ap_pclosesocket(p, sock); + j++; } -#endif + freeaddrinfo(res0); if (i == -1) { if (proxyhost != NULL) return DECLINED; /* try again another way */ -@@ -599,17 +618,30 @@ +@@ -591,17 +602,30 @@ ap_table_set(resp_hdrs, "Content-Location", proxy_location_reverse_map(r, urlstr)); /* check if NoCache directive on this host */ @@ -3603,9 +3610,8 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_http.c apache_1.3.26/src/mo /* * update the cache file, possibly even fulfilling the request if it * turns out a conditional allowed us to serve the object from the -diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_util.c apache_1.3.26/src/modules/proxy/proxy_util.c ---- apache_1.3.26.orig/src/modules/proxy/proxy_util.c Tue Jun 18 02:59:59 2002 -+++ apache_1.3.26/src/modules/proxy/proxy_util.c Wed Jun 19 11:05:11 2002 +--- apache_1.3.28.orig/src/modules/proxy/proxy_util.c Mon Feb 3 18:13:26 2003 ++++ apache_1.3.28/src/modules/proxy/proxy_util.c Fri Jul 25 11:01:55 2003 @@ -64,6 +64,7 @@ #include "http_log.h" #include "util_uri.h" @@ -3734,10 +3740,9 @@ diff -Nur apache_1.3.26.orig/src/modules/proxy/proxy_util.c apache_1.3.26/src/mo } ap_kill_timeout(r); -diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src/modules/standard/mod_access.c ---- apache_1.3.26.orig/src/modules/standard/mod_access.c Wed Mar 13 22:05:33 2002 -+++ apache_1.3.26/src/modules/standard/mod_access.c Wed Jun 19 10:26:32 2002 -@@ -74,7 +74,10 @@ +--- apache_1.3.31/src/modules/standard/mod_access.c.orig Sun Mar 7 22:47:14 2004 ++++ apache_1.3.31/src/modules/standard/mod_access.c Sat May 15 00:05:40 2004 +@@ -31,7 +31,10 @@ T_ALL, T_IP, T_HOST, @@ -3749,14 +3754,9 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src }; typedef struct { -@@ -82,9 +85,15 @@ - union { - char *from; - struct { -- unsigned long net; -- unsigned long mask; -+ struct in_addr net; -+ struct in_addr mask; +@@ -42,6 +45,12 @@ + struct in_addr net; + struct in_addr mask; } ip; +#ifdef INET6 + struct { @@ -3767,11 +3767,11 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src } x; enum allowdeny_type type; } allowdeny; -@@ -167,90 +176,230 @@ +@@ -124,94 +133,242 @@ } else if ((s = strchr(where, '/'))) { -- unsigned long mask; +- struct in_addr mask; + struct addrinfo hints, *resnet, *resmask; + struct sockaddr_storage net, mask; + int error; @@ -3784,7 +3784,7 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src *s++ = '\0'; - if (!is_ip(where) -- || (a->x.ip.net = ap_inet_addr(where)) == INADDR_NONE) { +- || (a->x.ip.net.s_addr = ap_inet_addr(where)) == INADDR_NONE) { + justdigits = 0; + for (p = s; *p; p++) { + if (!isdigit(*p)) @@ -3807,16 +3807,25 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src a->type = T_FAIL; return "syntax error in network portion of network/netmask"; } +- +- /* is_ip just tests if it matches [\d.]+ */ +- if (!is_ip(s)) { + if (resnet->ai_next) { + freeaddrinfo(resnet); -+ a->type = T_FAIL; + a->type = T_FAIL; +- return "syntax error in mask portion of network/netmask"; + return "network/netmask resolved to multiple addresses"; -+ } + } +- /* is it in /a.b.c.d form? */ +- if (strchr(s, '.')) { +- mask.s_addr = ap_inet_addr(s); +- if (mask.s_addr == INADDR_NONE) { +- a->type = T_FAIL; +- return "syntax error in mask portion of network/netmask"; +- } + memcpy(&net, resnet->ai_addr, resnet->ai_addrlen); + freeaddrinfo(resnet); - -- /* is_ip just tests if it matches [\d.]+ */ -- if (!is_ip(s)) { ++ + switch (net.ss_family) { + case AF_INET: + a->type = T_IP; @@ -3830,15 +3839,15 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src + break; +#endif + default: - a->type = T_FAIL; -- return "syntax error in mask portion of network/netmask"; ++ a->type = T_FAIL; + return "unknown address family for network"; } -- /* is it in /a.b.c.d form? */ -- if (strchr(s, '.')) { -- mask = ap_inet_addr(s); -- if (mask == INADDR_NONE) { -+ +- else { +- int i; + +- /* assume it's in /nnn form */ +- i = atoi(s); +- if (i > 32 || i <= 0) { + if (!justdigits) { + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; @@ -3852,21 +3861,14 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src + if (resmask) + freeaddrinfo(resmask); a->type = T_FAIL; - return "syntax error in mask portion of network/netmask"; - } -- } -- else { -- /* assume it's in /nnn form */ -- mask = atoi(s); -- if (mask > 32 || mask <= 0) { -- a->type = T_FAIL; - return "invalid mask in network/netmask"; -- } -- mask = 0xFFFFFFFFUL << (32 - mask); -- mask = htonl(mask); ++ return "syntax error in mask portion of network/netmask"; + } +- mask.s_addr = 0xFFFFFFFFUL << (32 - i); +- mask.s_addr = htonl(mask.s_addr); - } - a->x.ip.mask = mask; -- a->x.ip.net = (a->x.ip.net & mask); /* pjr - This fixes PR 4770 */ +- a->x.ip.net.s_addr = (a->x.ip.net.s_addr & mask.s_addr); /* pjr - This fixes PR 4770 */ - } - else if (ap_isdigit(*where) && is_ip(where)) { - /* legacy syntax for ip addrs: a.b.c. ==> a.b.c.0/24 for example */ @@ -3877,8 +3879,8 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src - a->type = T_IP; - /* parse components */ - s = where; -- a->x.ip.net = 0; -- a->x.ip.mask = 0; +- a->x.ip.net.s_addr = 0; +- a->x.ip.mask.s_addr = 0; - shift = 24; - while (*s) { - t = s; @@ -3887,14 +3889,14 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src + freeaddrinfo(resmask); a->type = T_FAIL; - return "invalid ip address"; -+ return "network/netmask resolved to multiple addresses"; - } +- } - while (ap_isdigit(*t)) { - ++t; - } - if (*t == '.') { - *t++ = 0; -- } ++ return "network/netmask resolved to multiple addresses"; + } - else if (*t) { + memcpy(&mask, resmask->ai_addr, resmask->ai_addrlen); + freeaddrinfo(resmask); @@ -3905,6 +3907,7 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src + return "network/netmask resolved to different address family"; } - if (shift < 0) { +- a->type = T_FAIL; - return "invalid ip address, only 4 octets allowed"; + + switch (a->type) { @@ -3952,16 +3955,28 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src + } +#endif } -- a->x.ip.net |= octet << shift; -- a->x.ip.mask |= 0xFFUL << shift; +- a->x.ip.net.s_addr |= (unsigned int)octet << shift; +- a->x.ip.mask.s_addr |= 0xFFUL << shift; - s = t; - shift -= 8; } -- a->x.ip.net = ntohl(a->x.ip.net); -- a->x.ip.mask = ntohl(a->x.ip.mask); +- a->x.ip.net.s_addr = ntohl(a->x.ip.net.s_addr); +- a->x.ip.mask.s_addr = ntohl(a->x.ip.mask.s_addr); ++ /* mask network address */ ++ switch (a->type) { ++ case T_IP: ++ a->x.ip.net.s_addr &= a->x.ip.mask.s_addr; ++ break; ++ case T_IP6: ++ a->x.ip6.net6.s6_addr32[0] &= a->x.ip6.mask6.s6_addr32[0]; ++ a->x.ip6.net6.s6_addr32[1] &= a->x.ip6.mask6.s6_addr32[1]; ++ a->x.ip6.net6.s6_addr32[2] &= a->x.ip6.mask6.s6_addr32[2]; ++ a->x.ip6.net6.s6_addr32[3] &= a->x.ip6.mask6.s6_addr32[3]; ++ } } else { - a->type = T_HOST; +- } + struct addrinfo hints, *res; + struct sockaddr_storage ss; + int error; @@ -4005,7 +4020,7 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src + a->type = T_FAIL; + return "each octet must be between 0 and 255 inclusive"; + } -+ a->x.ip.net.s_addr |= octet << shift; ++ a->x.ip.net.s_addr |= (unsigned int)octet << shift; + a->x.ip.mask.s_addr |= 0xFFUL << shift; + s = t; + shift -= 8; @@ -4057,16 +4072,17 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src + a->type = T_FAIL; + return "unknown address family for network"; + } - } ++ } return NULL; -@@ -315,12 +464,63 @@ + } +@@ -275,13 +432,63 @@ return 1; case T_IP: -- if (ap[i].x.ip.net != INADDR_NONE +- if (ap[i].x.ip.net.s_addr != INADDR_NONE - && (r->connection->remote_addr.sin_addr.s_addr -- & ap[i].x.ip.mask) == ap[i].x.ip.net) { +- & ap[i].x.ip.mask.s_addr) == ap[i].x.ip.net.s_addr) { - return 1; + if (ap[i].x.ip.net.s_addr == INADDR_NONE) + break; @@ -4087,9 +4103,9 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src + } + break; +#endif -+ } -+ break; -+ + } + break; + +#ifdef INET6 + case T_IP6: + { @@ -4121,16 +4137,15 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_access.c apache_1.3.26/src + if (memcmp(&masked, &ap[i].x.ip6.net6, sizeof(masked)) == 0) + return 1; + break; - } - break; ++ } ++ break; + } +#endif - case T_HOST: if (!gothost) { -diff -Nur apache_1.3.26.orig/src/modules/standard/mod_unique_id.c apache_1.3.26/src/modules/standard/mod_unique_id.c ---- apache_1.3.26.orig/src/modules/standard/mod_unique_id.c Wed Mar 13 22:05:34 2002 -+++ apache_1.3.26/src/modules/standard/mod_unique_id.c Wed Jun 19 10:26:32 2002 + remotehost = ap_get_remote_host(r->connection, r->per_dir_config, +--- apache_1.3.28.orig/src/modules/standard/mod_unique_id.c Mon Feb 3 18:13:30 2003 ++++ apache_1.3.28/src/modules/standard/mod_unique_id.c Fri Jul 25 11:01:55 2003 @@ -67,10 +67,22 @@ #include "http_config.h" #include "http_log.h" @@ -4260,9 +4275,8 @@ diff -Nur apache_1.3.26.orig/src/modules/standard/mod_unique_id.c apache_1.3.26/ /* * If we use 0 as the initial counter we have a little less protection -diff -Nur apache_1.3.26.orig/src/support/ab.c apache_1.3.26/src/support/ab.c ---- apache_1.3.26.orig/src/support/ab.c Sat May 11 22:47:57 2002 -+++ apache_1.3.26/src/support/ab.c Wed Jun 19 11:08:58 2002 +--- apache_1.3.28.orig/src/support/ab.c Sun Jul 6 19:52:27 2003 ++++ apache_1.3.28/src/support/ab.c Fri Jul 25 11:01:55 2003 @@ -158,6 +158,8 @@ #include #endif @@ -4331,7 +4345,7 @@ diff -Nur apache_1.3.26.orig/src/support/ab.c apache_1.3.26/src/support/ab.c if (errno != EINPROGRESS) { what = "CONNECT"; goto _bad; -@@ -1182,7 +1189,7 @@ +@@ -1189,7 +1196,7 @@ struct timeval timeout, now; fd_set sel_read, sel_except, sel_write; long i; @@ -4340,7 +4354,7 @@ diff -Nur apache_1.3.26.orig/src/support/ab.c apache_1.3.26/src/support/ab.c char * connecthost; char * url_on_request; -@@ -1225,17 +1232,21 @@ +@@ -1232,17 +1239,21 @@ } { /* get server information */ @@ -4373,7 +4387,7 @@ diff -Nur apache_1.3.26.orig/src/support/ab.c apache_1.3.26/src/support/ab.c } con = malloc(concurrency * sizeof(struct connection)); -@@ -1423,7 +1434,7 @@ +@@ -1430,7 +1441,7 @@ if (strlen(purl) > 8 && strncmp(purl, "https://", 8) == 0) { purl += 8; ssl = 1; @@ -4382,7 +4396,7 @@ diff -Nur apache_1.3.26.orig/src/support/ab.c apache_1.3.26/src/support/ab.c } #else if (strlen(purl) > 8 && strncmp(purl, "https://", 8) == 0) { -@@ -1444,15 +1455,15 @@ +@@ -1451,15 +1462,15 @@ *cp = '\0'; strcpy(hostname, h); if (p != NULL) @@ -4402,7 +4416,7 @@ diff -Nur apache_1.3.26.orig/src/support/ab.c apache_1.3.26/src/support/ab.c } else { colonport[0] = '\0'; } -@@ -1615,7 +1626,7 @@ +@@ -1622,7 +1633,7 @@ if ((p = strchr(optarg, ':'))) { *p = '\0'; p++; @@ -4411,7 +4425,7 @@ diff -Nur apache_1.3.26.orig/src/support/ab.c apache_1.3.26/src/support/ab.c }; strcpy(proxyhost, optarg); isproxy = 1; -@@ -1698,3 +1709,7 @@ +@@ -1705,3 +1716,7 @@ exit(0); } @@ -4419,9 +4433,8 @@ diff -Nur apache_1.3.26.orig/src/support/ab.c apache_1.3.26/src/support/ab.c +#ifdef NEED_GETADDRINFO +#include "../main/getaddrinfo.c" +#endif -diff -Nur apache_1.3.26.orig/src/support/logresolve.c apache_1.3.26/src/support/logresolve.c ---- apache_1.3.26.orig/src/support/logresolve.c Wed May 23 00:52:21 2001 -+++ apache_1.3.26/src/support/logresolve.c Wed Jun 19 10:26:32 2002 +--- apache_1.3.28.orig/src/support/logresolve.c Wed May 23 00:52:21 2001 ++++ apache_1.3.28/src/support/logresolve.c Fri Jul 25 11:01:55 2003 @@ -54,7 +54,9 @@ #endif /* BEOS */ #endif /* !MPE && !WIN32*/ @@ -4664,3 +4677,46 @@ diff -Nur apache_1.3.26.orig/src/support/logresolve.c apache_1.3.26/src/support/ +#ifdef NEED_GETNAMEINFO +#include "../main/getnameinfo.c" +#endif +--- apache_1.3.28/src/modules/standard/mod_usertrack.c.orig Mon Feb 3 18:13:30 2003 ++++ apache_1.3.28/src/modules/standard/mod_usertrack.c Fri Jul 25 13:13:43 2003 +@@ -162,7 +162,7 @@ + long reqtime = (long) r->request_time; + long clocktime; + +- unsigned long ipaddr = ntohl(r->connection->remote_addr.sin_addr.s_addr); ++ unsigned long ipaddr = ntohl(((struct sockaddr_in*)&r->connection->remote_addr)->sin_addr.s_addr); + const char *rname = ap_get_remote_host(r->connection, r->per_dir_config, + REMOTE_NAME); + dcfg = ap_get_module_config(r->per_dir_config, &usertrack_module); +--- apache_1.3.31/src/modules/standard/mod_rewrite.c.orig Wed May 12 14:57:09 2004 ++++ apache_1.3.31/src/modules/standard/mod_rewrite.c Wed May 12 15:40:04 2004 +@@ -48,6 +48,7 @@ + + + #include "mod_rewrite.h" ++#include "sa_len.h" + + #ifndef NO_WRITEV + #ifndef NETWARE +@@ -3651,8 +3652,19 @@ + result = r->connection->remote_ip; + } + else if (strcasecmp(var, "REMOTE_PORT") == 0) { +- return ap_psprintf(r->pool, "%d", +- ntohs(r->connection->remote_addr.sin_port)); ++ char servbuf[NI_MAXSERV]; ++ servbuf[0] = '\0'; ++ if (!getnameinfo((struct sockaddr *)&r->connection->remote_addr, ++#ifndef HAVE_SOCKADDR_LEN ++ SA_LEN((struct sockaddr *)&r->connection->remote_addr), ++#else ++ r->connection->remote_addr.ss_len, ++#endif ++ NULL, 0, servbuf, sizeof(servbuf), NI_NUMERICSERV)) { ++ return ap_pstrdup(r->pool, servbuf); ++ } else { ++ return ap_pstrdup(r->pool, ""); ++ } + } + else if (strcasecmp(var, "REMOTE_HOST") == 0) { + result = (char *)ap_get_remote_host(r->connection,