Index: apache13/README.v6 diff -c /dev/null apache13/README.v6:1.29 *** /dev/null Fri Mar 9 22:18:16 2001 --- apache13/README.v6 Fri Mar 9 22:15:30 2001 *************** *** 0 **** --- 1,173 ---- + IPv6-ready apache 1.3.x + KAME Project + $Id: README.v6,v 1.29 2001/03/09 13:15:30 itojun Exp $ + + This patchkit enables apache 1.3.x to perform HTTP connection over IPv6. + Most of optional modules are left unchanged, i.e. some of them won't support + IPv6, and some of them may not compile. + + + CAVEAT: This patchkit may change some of apache module API, to avoid + IPv4-dependent structure member variable (like use of u_long to hold + IPv4 address, or whatever). Therefore, it is almost impossible for the + IPv6 patch to be used with other module patches, at the same time + (including mod_ssl, mod_perl and others). We have no plan to fix it. + + http://www.imasy.or.jp/~ume/ipv6/test/ has an experimental patch against + mod_ssl, which makes SSL over IPv6 work with the patch. + + + Basically you can write IPv6 address where IPv4 address fits. + + extra command-line argument: + -4 Assume IPv4 address on ambiguous directives + -6 Assume IPv6 address on ambiguous directives (default) + + The above two can be used, for example, to disambiguate + "BindAddress *". + + base commands: + Listen + Listen is expanded to take one or two arguments. + Listen port + Listen address:port + Listen address port + This is to let you specify "Listen :: 80", since "Listen :::80" + won't work. + + mod_access: + deny from + allow from + "deny from" and "allow from" supports IPv6 addresses, under the + following forms: + {deny,allow} from v6addr + {deny,allow} from v6addr/v6mask + {deny,allow} from v6addr/prefixlen + Also, wildcard ("*") and string hostname matches IPv6 hosts as well. + + mod_proxy: + ProxyRequests on + http/ftp proxying for both IPv4 and IPv6 is possible. + Access control functions (NoProxy) are not updated yet. + + NOTE: for security reasons, we recommend you to filter out + outsider's access to your proxy, by directives like below: + + order deny,allow + deny from all + allow from 10.0.0.0/8 + allow from 3ffe:9999:8888:7777::/64 + + + virtual host: + If you would like to this feature, you must describe 'Listen' + part on configuration file explicitly. like below: + Listen :: 80 + Listen 0.0.0.0 80 + + NameVirtualHost + NameVirtualHost is expanded to take one more two arguments. + NameVirtualHost address + NameVirtualHost address:port + NameVirtualHost address port + This is to let you specify IPv6 address into address part. + + Note that, if colon is found in the specified address string, + the code will to resolve the address in the following way: + 1. try to resolve as address:port (most of IPv6 address fails) + 2. if (1) is failed, try to resolve as address only + If there's ambiguity, i.e. 3ffe:0501::1:2, the address may not be + parsed as you expect (3ffe:0501::1 with port 2, or 3ffe:0501::1:2 + with default port). To get the right effect you are encouraged + to specify it without ambiguity. In IPv6 case "address port" + (specify address and port separated by a space) is the safest way. + + + If you would like to specify IPv6 numeric address in host part, + use bracketed format like below: + + Note: Now we DO NOT handle old non-bracketed format, + + so configuration file must be updated. + Note: The following is bad example to specify host ::1 port 80. + This will treated as host ::1:80. + + + logresolve (src/support) + error statistics in nameserver cache code is omitted. + + mod_unique_id + Originally mod_unique_id used IPv4 address as a seed for UNIQUE_ID, + and took IPv4 address registered onto DNS for the hostname (UNIX + hostname taken by gethostname(3)). Therefore, this does not work + for IPv6-only hosts as they do not have IPv4 address for them. + + Now, UNIQUE_ID can be generated using IPv6 address. IPv6 address can + be used as the seed for UNIQUE_ID. + Because of this, UNIQUE_ID will be longer than normal apache. This + may cause problem with some of the CGI scripts. + The preference of the addresses is based on the order returned + by getaddrinfo(). If your getaddrinfo() returns IPv4 address, IPv4 + adderss will be used as a seed. + Note that some of IPv6 addresses are "scoped"; If you happened to use + link-local or site-local address as a seed, the UNIQUE_ID may not be + worldwide unique. + + If longer UNIQUE_ID causes a problem, define SHORT_UNIQUE_ID in + mod_unique_id.c. In this case, length of UNIQUE_ID will be kept the + same. However, for IPv6 addresses mod_unique_id.c will use the last + 32bit (not the whole 128bit) as the seed. Therefore, there can be + collision in UNIQUE_ID. + + The behavior should be improved in the near future; we welcome your + inputs. + + Modules known to be incompatible with IPv6 + (please report us) + + configure + Configure has extra option, --enable-rule=INET6. if the option + is specified, IPv6 code will be enabled. + + configuration file + We do not support IPv4 mapped address (IPv6 address format like + ::ffff:10.1.1.1) in configuration file. + + This kit assumes that you have working(*) getaddrinfo() and getnameinfo() + library functions. Even if you don't have one, don't panic. We have + included last-resort version (which support IPv4 only) into the kit. + For more complete implementation you might want to check BIND 8.2. + (*) NOTE: we have noticed that some of IPv6 stack is shipped with broken + getaddrinfo(). In such cases, you should get and install BIND 8.2. + + When compiling this kit onto IPv6, you may need to specify some additional + library paths or cpp defs (like -linet6 or -DINET6). + Now you don't have to specify --enable-rule=INET6. The "configure" script + will give you some warnings if the IPv6 stack is not known to the + "configure" script. Currently, the following IPv6 stacks are supported: + - KAME IPv6 stack, http://www.kame.net/ + use configure.v6 for convenience, + - Linux IPv6 stack, http://www.linux.org/ + use configure.v6 for convenience. + - Solaris 8 IPv6 stack, http://www.sun.com/ + use configure.v6 for convenience. + To disable IPv6 support, specify --disable-rule=INET6 to the "configure" + script. + + Acknowledgements + Thanks to all people submitted patches/fixes for this patch kit, + including: + "Chris P. Ross" + + Author contacts + Jun-ichiro itojun Hagino, KAME project + http://www.kame.net/ + mailto:core@kame.net + Linux Port + Arkadiusz Miskiewicz, Polish Linux Distribution project (IPv6) + http://www.pld.org.pl/ + mailto:pld-list@pld.org.pl + Satoshi SHIDA, Linux IPv6 Users Group JP + http://www.v6.linux.or.jp/ + YOSHIFUJI Hideaki, USAGI Project + http://www.linux-ipv6.org/ Index: apache13/configure.v6 diff -c /dev/null apache13/configure.v6:1.8 *** /dev/null Fri Mar 9 22:18:16 2001 --- apache13/configure.v6 Wed Jan 26 22:09:13 2000 *************** *** 0 **** --- 1,3 ---- + #! /bin/sh + + ./configure --enable-rule=INET6 --enable-module=proxy $* Index: apache13/conf/httpd.conf-dist diff -c apache13/conf/httpd.conf-dist:1.1.1.9 apache13/conf/httpd.conf-dist:1.11 *** apache13/conf/httpd.conf-dist:1.1.1.9 Thu Mar 1 11:40:48 2001 --- apache13/conf/httpd.conf-dist Thu Mar 1 12:14:17 2001 *************** *** 174,179 **** --- 174,184 ---- #Listen 3000 #Listen 12.34.56.78:80 + # Listen can take two arguments. + # (this is an extension for supporting IPv6 addresses) + #Listen :: 80 + #Listen 0.0.0.0 80 + # # 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 Index: apache13/src/Configuration.tmpl diff -c apache13/src/Configuration.tmpl:1.1.1.3 apache13/src/Configuration.tmpl:1.8 *** apache13/src/Configuration.tmpl:1.1.1.3 Tue Aug 24 13:20:13 1999 --- apache13/src/Configuration.tmpl Wed Jan 26 21:38:05 2000 *************** *** 166,171 **** --- 166,174 ---- # directory is present. This rule will always be interpreted as "no" # if the directory is not present. # + # INET6: + # IPv6 support. + # Rule SOCKS4=no Rule SOCKS5=no *************** *** 173,178 **** --- 176,182 ---- Rule IRIXN32=yes Rule PARANOID=no Rule EXPAT=default + Rule INET6=no # DEV_RANDOM: # Note: this rule is only used when compiling mod_auth_digest. Index: apache13/src/Configure diff -c apache13/src/Configure:1.1.1.10 apache13/src/Configure:1.14 *** apache13/src/Configure:1.1.1.10 Thu Mar 1 11:40:28 2001 --- apache13/src/Configure Thu Mar 1 12:14:18 2001 *************** *** 237,242 **** --- 237,243 ---- RULE_EXPAT=`./helpers/CutRule EXPAT $file` RULE_SHARED_CORE=`./helpers/CutRule SHARED_CORE $file` RULE_SHARED_CHAIN=`./helpers/CutRule SHARED_CHAIN $file` + RULE_INET6=`./helpers/CutRule INET6 $file` #################################################################### ## Rule SHARED_CORE implies required DSO support *************** *** 1640,1645 **** --- 1641,1764 ---- esac fi + # INET6 support. + if [ "$RULE_INET6" = "yes" ]; then + echo " + enabling INET6 support" + CFLAGS="$CFLAGS -DINET6" + CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len" + IPV6_STACKTYPE="UNKNOWN" + for i in KAME Linux Solaris; do + case "$i" in + KAME) + if [ -f /usr/include/netinet6/in6.h -a "x`egrep '__KAME__' /usr/include/netinet6/in6.h 2>/dev/null`" != "x" ]; then + IPV6_STACKTYPE=$i + fi + ;; + Linux) + if [ /usr/include/netinet/ip6.h -a -d /usr/include/linux ]; then + IPV6_STACKTYPE=$i + fi + ;; + Solaris) + SOL_VERSION=`(uname -v) 2>/dev/null` || SOL_VERSION="unknown" + case "${PLAT}-${SOL_VERSION}" in + *-solaris2.27*-*IPv6*) + if [ -f /etc/hostname -o -f /etc/hostname.[a-z]*[0-9] ]; then + IPV6_STACKTYPE="Solaris 7 (${SOL_VERSION})" + fi + ;; + esac + ;; + esac + if [ "$IPV6_STACKTYPE" != "UNKNOWN" ]; then + break + fi + done + if [ "$IPV6_STACKTYPE" != "UNKNOWN" ]; then + echo " + You seem to be using $IPV6_STACKTYPE stack" + if ./helpers/TestCompile func getaddrinfo; then + echo " - Assuming you have working getaddrinfo in libc" + else + if [ -f /usr/local/v6/lib/libinet6.a -a "x`egrep '^EXTRA_L' Makefile.config | grep linet6`" = "x" ]; then + LIBS="$LIBS -L/usr/local/v6/lib -linet6" + echo " - using getaddrinfo in libinet6" + elif [ -f /usr/local/lib/libinet6.a -a "x`egrep '^EXTRA_L' Makefile.config | grep linet6`" = "x" ]; then + LIBS="$LIBS -L/usr/local/lib -linet6" + echo " - using getaddrinfo in libinet6" + elif [ -f /usr/inet6/lib/libinet6.a -a "x`egrep '^EXTRA_L' Makefile.config | grep linet6`" = "x" ]; then + echo " - using getaddrinfo in libinet6" + else + echo "** WARNING: No getaddrinfo found, linkage may fail" + fi + fi + else + echo "" + echo "** WARNING: We have no explicit knowledge about the IPv6" + echo "** implementation on this host. You may need to specify" + echo "** EXTRA_LIBS so that we can find getaddrinfo() and" + echo "** getnameinfo() library functions." + echo "" + fi + case $PLAT in + *-solaris2* ) + LIBS="$LIBS -lresolv" + ;; + esac + else + CFLAGS="$CFLAGS -DNEED_GETADDRINFO -DNEED_GETNAMEINFO" + if [ -f /usr/include/netdb.h -a "x`egrep 'addrinfo' /usr/include/netdb.h`" = "x" ]; then + CFLAGS="$CFLAGS -DNEED_ADDRINFO" + fi + fi + + echo '#include ' >testfunc.c + echo '#include ' >>testfunc.c + echo 'int testfunc(){ struct sockaddr sa; int i = sa.sa_len; };' >>testfunc.c + rm -f testfunc.o + eval "${MAKE-make} -f Makefile.config testfunc.o >/dev/null 2>/dev/null" + if [ -f testfunc.o ]; then + echo " + you have sa_len in struct sockaddr." + CFLAGS="$CFLAGS -DHAVE_SOCKADDR_LEN" + else + echo " + you don't have sa_len in struct sockaddr." + fi + rm -f testfunc.c testfunc.o + + echo '#include ' >testfunc.c + echo '#include ' >>testfunc.c + echo 'struct sockaddr_storage sockaddr_storage;' >>testfunc.c + rm -f testfunc.o + eval "${MAKE-make} -f Makefile.config testfunc.o >/dev/null 2>/dev/null" + if [ -f testfunc.o ]; then + echo " + assuming you have struct sockaddr_storage" + else + CFLAGS="$CFLAGS -DNEED_SOCKADDR_STORAGE" + echo " + you need struct sockaddr_storage" + fi + rm -f testfunc.c testfunc.o + + echo '#include ' >testfunc.c + echo '#include ' >>testfunc.c + echo 'int testfunc(){ socklen_t t; }' >>testfunc.c + rm -f testfunc.o + eval "${MAKE-make} -f Makefile.config testfunc.o >/dev/null 2>/dev/null" + if [ ! -f testfunc.o ]; then + CFLAGS="$CFLAGS -Dsocklen_t=int" + fi + rm -f testfunc.c testfunc.o + + echo '#include ' >testfunc.c + echo '#include ' >>testfunc.c + echo 'struct sockaddr_in sin;' >>testfunc.c + echo 'int main(){ int i = sin.sin_len; }' >>testfunc.c + rm -f testfunc.o + eval "${MAKE-make} -f Makefile.config testfunc.o >/dev/null 2>/dev/null" + if [ -f testfunc.o ]; then + CFLAGS="$CFLAGS -DSIN_LEN" + fi + rm -f testfunc.c testfunc.o + + #################################################################### ## Find out what modules we want and try and configure things for them ## Module lines can look like this: *************** *** 2155,2160 **** --- 2274,2311 ---- echo "#ifndef AP_LONGEST_LONG" >>$AP_CONFIG_AUTO_H echo "#define AP_LONGEST_LONG $AP_LONGEST_LONG" >>$AP_CONFIG_AUTO_H echo "#endif" >>$AP_CONFIG_AUTO_H + + if [ x`./helpers/TestCompile -r sizeof 'uint32_t'` != x"" ]; then + echo "" >>$AP_CONFIG_AUTO_H + echo "/* determine: use uint32_t as 32bit unsigned int */" >>$AP_CONFIG_AUTO_H + echo "#ifndef ap_uint32_t" >>$AP_CONFIG_AUTO_H + echo "#define ap_uint32_t uint32_t" >>$AP_CONFIG_AUTO_H + echo "#endif" >>$AP_CONFIG_AUTO_H + echo " - use uint32_t as 32bit unsigned int" + elif [ x`./helpers/TestCompile -r sizeof 'u_int32_t'` != x"" ]; then + echo "" >>$AP_CONFIG_AUTO_H + echo "/* determine: use u_int32_t as 32bit unsigned int */" >>$AP_CONFIG_AUTO_H + echo "#ifndef ap_uint32_t" >>$AP_CONFIG_AUTO_H + echo "#define ap_uint32_t u_int32_t" >>$AP_CONFIG_AUTO_H + echo "#endif" >>$AP_CONFIG_AUTO_H + echo " - use u_int32_t as 32bit unsigned int" + elif [ x`./helpers/TestCompile -r sizeof 'unsigned int'` = x"4" ]; then + echo "" >>$AP_CONFIG_AUTO_H + echo "/* determine: use unsigned int as 32bit unsigned int */" >>$AP_CONFIG_AUTO_H + echo "#ifndef ap_uint32_t" >>$AP_CONFIG_AUTO_H + echo "#define ap_uint32_t unsigned int" >>$AP_CONFIG_AUTO_H + echo "#endif" >>$AP_CONFIG_AUTO_H + echo " - use unsigned int as 32bit unsigned int" + elif [ x`./helpers/TestCompile -r sizeof 'unsigned long int'` = x"4" ]; then + echo "" >>$AP_CONFIG_AUTO_H + echo "/* determine: use unsigned long int as 32bit unsigned int */" >>$AP_CONFIG_AUTO_H + echo "#ifndef uint32_t" >>$AP_CONFIG_AUTO_H + echo "#define uint32_t unsigned long int" >>$AP_CONFIG_AUTO_H + echo "#endif" >>$AP_CONFIG_AUTO_H + echo " - use unsigned long int as 32bit unsigned int" + else + echo " - Warning: cannot determine what type should we use as 32bit unsigned int" + fi #################################################################### ## More building ap_config_auto.h Index: apache13/src/ap/ap_snprintf.c diff -c apache13/src/ap/ap_snprintf.c:1.1.1.5 apache13/src/ap/ap_snprintf.c:1.10 *** apache13/src/ap/ap_snprintf.c:1.1.1.5 Wed Jan 31 21:26:57 2001 --- apache13/src/ap/ap_snprintf.c Wed Jan 31 22:37:29 2001 *************** *** 73,78 **** --- 73,79 ---- #include #include #include + #include "sa_len.h" typedef enum { NO = 0, YES = 1 *************** *** 501,506 **** --- 502,543 ---- + #ifdef INET6 + static char *conv_sockaddr(struct sockaddr *sa, char *buf_end, int *len) + { + char *p = buf_end; + char hostnamebuf[MAXHOSTNAMELEN]; + char portnamebuf[MAXHOSTNAMELEN]; + char *q; + int salen; + + #ifndef SIN6_LEN + salen = SA_LEN(sa); + #else + salen = sa->sa_len; + #endif + if (getnameinfo(sa, salen, hostnamebuf, sizeof(hostnamebuf), + portnamebuf, sizeof(portnamebuf), NI_NUMERICHOST | NI_NUMERICSERV)) { + strcpy(hostnamebuf, "???"); + strcpy(portnamebuf, "???"); + } + if (strcmp(portnamebuf,"0") == 0) + strcpy(portnamebuf, "*"); + q = portnamebuf + strlen(portnamebuf); + while (portnamebuf < q) + *--p = *--q; + *--p = ':'; + q = hostnamebuf + strlen(hostnamebuf); + while (hostnamebuf < q) + *--p = *--q; + + *len = buf_end - p; + return (p); + } + #endif /*INET6*/ + + + /* * 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 *************** *** 1036,1041 **** --- 1073,1079 ---- /* print a struct sockaddr_in as a.b.c.d:port */ case 'I': { + #ifndef INET6 struct sockaddr_in *si; si = va_arg(ap, struct sockaddr_in *); *************** *** 1044,1049 **** --- 1082,1097 ---- if (adjust_precision && precision < s_len) s_len = precision; } + #else + struct sockaddr *sa; + + sa = va_arg(ap, struct sockaddr *); + if (sa != NULL) { + s = conv_sockaddr(sa, &num_buf[NUM_BUF_SIZE], &s_len); + if (adjust_precision && precision < s_len) + s_len = precision; + } + #endif else { s = S_NULL; s_len = S_NULL_LEN; Index: apache13/src/include/ap.h diff -c apache13/src/include/ap.h:1.1.1.5 apache13/src/include/ap.h:1.7 *** apache13/src/include/ap.h:1.1.1.5 Wed Jan 31 21:26:59 2001 --- apache13/src/include/ap.h Wed Jan 31 22:37:29 2001 *************** *** 91,97 **** * with some extensions. The extensions are: * * %pA takes a struct in_addr *, and prints it as a.b.c.d ! * %pI takes a struct sockaddr_in * and prints it as a.b.c.d:port * %pp takes a void * and outputs it in hex * * The %p hacks are to force gcc's printf warning code to skip --- 91,98 ---- * with some extensions. The extensions are: * * %pA takes a struct in_addr *, and prints it as a.b.c.d ! * %pI takes a struct sockaddr * and prints it as a.b.c.d:port, or ! * ipv6-numeric-addr:port * %pp takes a void * and outputs it in hex * * The %p hacks are to force gcc's printf warning code to skip Index: apache13/src/include/ap_config.h diff -c apache13/src/include/ap_config.h:1.1.1.10 apache13/src/include/ap_config.h:1.16 *** apache13/src/include/ap_config.h:1.1.1.10 Thu Mar 1 11:40:36 2001 --- apache13/src/include/ap_config.h Thu Mar 1 12:14:18 2001 *************** *** 395,400 **** --- 395,404 ---- #endif #ifndef S_IWOTH #define S_IWOTH 000002 + #ifndef rlim_t + typedef int rlim_t; + #endif + typedef u_long n_long; #endif #define STDIN_FILENO 0 *************** *** 1457,1462 **** --- 1461,1530 ---- #ifndef ap_wait_t #define ap_wait_t int + #endif + + #ifndef INET6 + #define sockaddr_storage sockaddr + #define ss_family sa_family + #define ss_len sa_len + #else + #include "sockaddr_storage.h" /* sshida@st.rim.or.jp */ + #endif + + #ifndef INET6_ADDRSTRLEN + #define INET6_ADDRSTRLEN 46 + #endif + #ifndef INET_ADDRSTRLEN + #define INET_ADDRSTRLEN 16 + #endif + #ifndef NI_MAXHOST + #define NI_MAXHOST 1025 + #endif + #ifndef NI_MAXSERV + #define NI_MAXSERV 32 + #endif + + #if defined(NEED_GETADDRINFO) || defined(NEED_GETNAMEINFO) + /* + * minimal definitions for fake getaddrinfo()/getnameinfo(). + */ + #ifndef EAI_NODATA + #define EAI_NODATA 1 + #define EAI_MEMORY 2 + #endif + + #ifndef AI_PASSIVE + #define AI_PASSIVE 1 + #define AI_CANONNAME 2 + #define AI_NUMERICHOST 4 + #define NI_NUMERICHOST 8 + #define NI_NAMEREQD 16 + #define NI_NUMERICSERV 32 + #endif + #endif + + #ifdef NEED_GETADDRINFO + #ifdef NEED_ADDRINFO + struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for hostname */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ + }; + #endif + extern char *gai_strerror(int ecode); + extern void freeaddrinfo(struct addrinfo *ai); + extern int getaddrinfo(const char *hostname, const char *servname, + const struct addrinfo *hints, struct addrinfo **res); + #endif + #ifdef NEED_GETNAMEINFO + extern int getnameinfo(const struct sockaddr *sa, size_t salen, + char *host, size_t hostlen, char *serv, size_t servlen, + int flag); #endif #ifdef __cplusplus Index: apache13/src/include/http_conf_globals.h diff -c apache13/src/include/http_conf_globals.h:1.1.1.6 apache13/src/include/http_conf_globals.h:1.8 *** apache13/src/include/http_conf_globals.h:1.1.1.6 Wed Jan 31 21:26:59 2001 --- apache13/src/include/http_conf_globals.h Wed Jan 31 22:37:29 2001 *************** *** 82,88 **** extern API_VAR_EXPORT int ap_max_requests_per_child; extern API_VAR_EXPORT int ap_threads_per_child; extern API_VAR_EXPORT int ap_excess_requests_per_child; ! extern struct in_addr ap_bind_address; extern listen_rec *ap_listeners; extern API_VAR_EXPORT int ap_daemons_to_start; extern API_VAR_EXPORT int ap_daemons_min_free; --- 82,89 ---- extern API_VAR_EXPORT int ap_max_requests_per_child; extern API_VAR_EXPORT int ap_threads_per_child; extern API_VAR_EXPORT int ap_excess_requests_per_child; ! extern struct sockaddr_storage ap_bind_address; ! extern API_VAR_EXPORT int ap_default_family; extern listen_rec *ap_listeners; extern API_VAR_EXPORT int ap_daemons_to_start; extern API_VAR_EXPORT int ap_daemons_min_free; Index: apache13/src/include/http_vhost.h diff -c apache13/src/include/http_vhost.h:1.1.1.3 apache13/src/include/http_vhost.h:1.3 *** apache13/src/include/http_vhost.h:1.1.1.3 Wed Jan 31 21:26:59 2001 --- apache13/src/include/http_vhost.h Wed Jan 31 22:37:30 2001 *************** *** 73,79 **** const char *ap_parse_vhost_addrs(pool *p, const char *hostname, server_rec *s); /* handle NameVirtualHost directive */ ! const char *ap_set_name_virtual_host (cmd_parms *cmd, void *dummy, char *arg); /* given an ip address only, give our best guess as to what vhost it is */ void ap_update_vhost_given_ip(conn_rec *conn); --- 73,79 ---- const char *ap_parse_vhost_addrs(pool *p, const char *hostname, server_rec *s); /* handle NameVirtualHost directive */ ! const char *ap_set_name_virtual_host (cmd_parms *cmd, void *dummy, char *h, char *p); /* given an ip address only, give our best guess as to what vhost it is */ void ap_update_vhost_given_ip(conn_rec *conn); Index: apache13/src/include/httpd.h diff -c apache13/src/include/httpd.h:1.1.1.10 apache13/src/include/httpd.h:1.12 *** apache13/src/include/httpd.h:1.1.1.10 Thu Mar 1 11:40:36 2001 --- apache13/src/include/httpd.h Thu Mar 1 12:14:18 2001 *************** *** 858,865 **** /* Who is the client? */ ! struct sockaddr_in local_addr; /* local address */ ! struct sockaddr_in remote_addr; /* remote address */ char *remote_ip; /* Client's IP address */ char *remote_host; /* Client's DNS name, if known. * NULL if DNS hasn't been checked, --- 858,865 ---- /* Who is the client? */ ! struct sockaddr_storage local_addr; /* local address */ ! struct sockaddr_storage remote_addr; /* remote address */ char *remote_ip; /* Client's IP address */ char *remote_host; /* Client's DNS name, if known. * NULL if DNS hasn't been checked, *************** *** 898,905 **** typedef struct server_addr_rec server_addr_rec; struct server_addr_rec { server_addr_rec *next; ! struct in_addr host_addr; /* The bound address, for this server */ ! unsigned short host_port; /* The bound port, for this server */ char *virthost; /* The name given in */ }; --- 898,905 ---- typedef struct server_addr_rec server_addr_rec; struct server_addr_rec { server_addr_rec *next; ! struct sockaddr_storage host_addr; /* The bound address, for this server */ ! unsigned short host_port; /* The bound port, for this server XXX */ char *virthost; /* The name given in */ }; *************** *** 963,969 **** /* These are more like real hosts than virtual hosts */ struct listen_rec { listen_rec *next; ! struct sockaddr_in local_addr; /* local IP address and port */ int fd; int used; /* Only used during restart */ /* more stuff here, like which protocol is bound to the port */ --- 963,969 ---- /* These are more like real hosts than virtual hosts */ struct listen_rec { listen_rec *next; ! struct sockaddr_storage local_addr; /* local IP address and port */ int fd; int used; /* Only used during restart */ /* more stuff here, like which protocol is bound to the port */ *************** *** 1123,1129 **** #endif /* _OSD_POSIX */ char *ap_get_local_host(pool *); ! unsigned long ap_get_virthost_addr(char *hostname, unsigned short *port); extern API_VAR_EXPORT time_t ap_restart_time; --- 1123,1129 ---- #endif /* _OSD_POSIX */ char *ap_get_local_host(pool *); ! struct sockaddr *ap_get_virthost_addr(char *hostname, unsigned short *port); extern API_VAR_EXPORT time_t ap_restart_time; Index: apache13/src/include/sa_len.h diff -c /dev/null apache13/src/include/sa_len.h:1.5 *** /dev/null Fri Mar 9 22:18:20 2001 --- apache13/src/include/sa_len.h Tue Feb 6 19:21:05 2001 *************** *** 0 **** --- 1,41 ---- + /* sa_len.h : tiny version of SA_LEN (written by ) */ + + #include + #include + #include + #include + + #ifndef HAVE_SOCKADDR_LEN + #ifndef SA_LEN + #define SA_LEN(s_) ap_sa_len((s_)->sa_family) + + static NET_SIZE_T ap_sa_len (sa_family_t af) + { + switch (af){ + #if defined(AF_INET) + case AF_INET: + return (sizeof(struct sockaddr_in)); + #endif /* AF_INET */ + #if defined(AF_INET6) + case AF_INET6: + return (sizeof(struct sockaddr_in6)); + #endif + #ifdef AF_LOCAL + case AF_LOCAL: + #endif /* AF_LOCAL */ + #if defined(AF_UNIX) && (AF_UNIX != AF_LOCAL) + case AF_UNIX: + #endif /* AF_UNIX */ + #if defined(AF_FILE) && (AF_FILE != AF_LOCAL || AF_FILE != AF_UNIX) + case AF_FILE: + #endif /* AF_FILE */ + #if defined(AF_LOCAL) || defined(AF_UNIX) || defined(AF_FILE) + return (sizeof(struct sockaddr_un)); + #endif /* defined(AF_LOCAL) || defined(AF_UNIX) || defined(AF_FILE) */ + default: + return 0; + } + return 0; + } + #endif /* SA_LEN */ + #endif /* HAVE_SOCKADDR_LEN */ Index: apache13/src/include/sockaddr_storage.h diff -c /dev/null apache13/src/include/sockaddr_storage.h:1.2 *** /dev/null Fri Mar 9 22:18:20 2001 --- apache13/src/include/sockaddr_storage.h Wed Jan 26 21:38:08 2000 *************** *** 0 **** --- 1,53 ---- + /* + struct sockaddr_storage + + RFC2553 proposes struct sockaddr_storage. + This is a placeholder for all sockaddr-variant structures. This is + implemented like follows: + + You should use this structure to hold any of sockaddr-variant + structures. + */ + #ifdef NEED_SOCKADDR_STORAGE + + struct sockaddr_storage { + #ifdef HAVE_SOCKADDR_LEN + u_char ss_len; + u_char ss_family; + #else + u_short ss_family; + #endif + u_char __padding[128 - 2]; + }; + + /* + union sockunion + + Alternatively, you may want to implement sockunion.h, with the + following content: + + NOTE: For better portability, struct sockaddr_storage should be used. + union sockunion is okay, but is not really portable enough. + */ + union sockunion { + struct sockinet { + #ifdef HAVE_SOCKADDR_LEN + u_char si_len; + u_char si_family; + #else + u_short si_family; + #endif + u_short si_port; + } su_si; + struct sockaddr_in su_sin; + #ifdef INET6 + struct sockaddr_in6 su_sin6; + #endif + }; + #ifdef HAVE_SOCKADDR_LEN + #define su_len su_si.si_len + #endif + #define su_family su_si.si_family + #define su_port su_si.si_port + + #endif /* NEED_SOCKADDR_STORAGE */ Index: apache13/src/main/getaddrinfo.c diff -c /dev/null apache13/src/main/getaddrinfo.c:1.5 *** /dev/null Fri Mar 9 22:18:21 2001 --- apache13/src/main/getaddrinfo.c Thu Mar 9 17:41:18 2000 *************** *** 0 **** --- 1,162 ---- + /* + * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + /* + * fake library for ssh v6 enabler patch + * + * This file includes getaddrinfo(), freeaddrinfo() and gai_strerror(). + * These funtions are defined in rfc2133. + * + * But these functions are not implemented correctly. The minimum subset + * is implemented for ssh use only. For exapmle, this routine assumes + * that ai_family is AF_INET. Don't use it for another purpose. + * + * In the case not using 'configure --enable-ipv6', this getaddrinfo.c + * will be used if you have broken getaddrinfo or no getaddrinfo. + */ + + #if 0 + #include + #include + #include + #include + #include + #include + #include "gai.h" + #endif + + static struct addrinfo * + malloc_ai(port, addr, socktype, protocol) + int port; + u_long addr; + int socktype; + int protocol; + { + struct addrinfo *ai; + + if (ai = (struct addrinfo *)malloc(sizeof(struct addrinfo) + + sizeof(struct sockaddr_in))) { + memset(ai, 0, sizeof(struct addrinfo) + sizeof(struct sockaddr_in)); + ai->ai_addr = (struct sockaddr *)(ai + 1); + #if defined(HAVE_SOCKADDR_LEN) + ai->ai_addr->sa_len = + #endif + ai->ai_addrlen = sizeof(struct sockaddr_in); + ai->ai_addr->sa_family = ai->ai_family = AF_INET; + ai->ai_socktype = socktype; + ai->ai_protocol = protocol; + ((struct sockaddr_in *)(ai)->ai_addr)->sin_port = port; + ((struct sockaddr_in *)(ai)->ai_addr)->sin_addr.s_addr = addr; + return ai; + } else { + return NULL; + } + } + + char * + gai_strerror(ecode) + int ecode; + { + switch (ecode) { + case EAI_NODATA: + return "no address associated with hostname."; + case EAI_MEMORY: + return "memory allocation failure."; + default: + return "unknown error."; + } + } + + void + freeaddrinfo(ai) + struct addrinfo *ai; + { + struct addrinfo *next; + + do { + next = ai->ai_next; + free(ai); + } while (ai = next); + } + + int + getaddrinfo(hostname, servname, hints, res) + const char *hostname, *servname; + const struct addrinfo *hints; + struct addrinfo **res; + { + struct addrinfo *cur, *prev = NULL; + struct hostent *hp; + int i, port; + + if (servname) + port = htons(atoi(servname)); + else + port = 0; + if (hints && hints->ai_flags & AI_PASSIVE) + if (*res = malloc_ai(port, htonl(0x00000000), + res->ai_socktype ? res->ai_socktype : SOCK_STREAM, + res->ai_protocol)) + return 0; + else + return EAI_MEMORY; + if (!hostname) + if (*res = malloc_ai(port, htonl(0x7f000001), + res->ai_socktype ? res->ai_socktype : SOCK_STREAM, + res->ai_protocol)) + return 0; + else + return EAI_MEMORY; + if (inet_addr(hostname) != -1) + if (*res = malloc_ai(port, inet_addr(hostname), + res->ai_socktype ? res->ai_socktype : SOCK_STREAM, + res->ai_protocol)) + return 0; + else + return EAI_MEMORY; + if ((hp = gethostbyname(hostname)) && + hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { + for (i = 0; hp->h_addr_list[i]; i++) + if (cur = malloc_ai(port, + ((struct in_addr *)hp->h_addr_list[i])->s_addr, + res->ai_socktype ? res->ai_socktype : SOCK_STREAM, + res->ai_protocol)) { + if (prev) + prev->ai_next = cur; + else + *res = cur; + prev = cur; + } else { + if (*res) + freeaddrinfo(*res); + return EAI_MEMORY; + } + return 0; + } + return EAI_NODATA; + } Index: apache13/src/main/getnameinfo.c diff -c /dev/null apache13/src/main/getnameinfo.c:1.2 *** /dev/null Fri Mar 9 22:18:21 2001 --- apache13/src/main/getnameinfo.c Thu Apr 15 20:32:53 1999 *************** *** 0 **** --- 1,95 ---- + /* + * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + /* + * fake library for ssh v6 enabler patch + * + * This file includes getnameinfo(). + * These funtions are defined in rfc2133. + * + * But these functions are not implemented correctly. The minimum subset + * is implemented for ssh use only. For exapmle, this routine assumes + * that ai_family is AF_INET. Don't use it for another purpose. + * + * In the case not using 'configure --enable-ipv6', this getnameinfo.c + * will be used if you have broken getnameinfo or no getnameinfo. + */ + + #if 0 + #include + #include + #include + #include + #include + #include + #include + #include "gai.h" + #endif + + int + getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) + const struct sockaddr *sa; + size_t salen; + char *host; + size_t hostlen; + char *serv; + size_t servlen; + int flags; + { + struct sockaddr_in *sin = (struct sockaddr_in *)sa; + struct hostent *hp; + char tmpserv[16]; + + if (serv) { + sprintf(tmpserv, "%d", ntohs(sin->sin_port)); + if (strlen(tmpserv) > servlen) + return EAI_MEMORY; + else + strcpy(serv, tmpserv); + } + if (host) + if (flags & NI_NUMERICHOST) + if (strlen(inet_ntoa(sin->sin_addr)) > hostlen) + return EAI_MEMORY; + else { + strcpy(host, inet_ntoa(sin->sin_addr)); + return 0; + } + else + if (hp = gethostbyaddr((char *)&sin->sin_addr, sizeof(struct in_addr), + AF_INET)) + if (strlen(hp->h_name) > hostlen) + return EAI_MEMORY; + else { + strcpy(host, hp->h_name); + return 0; + } + else + return EAI_NODATA; + return 0; + } Index: apache13/src/main/http_config.c diff -c apache13/src/main/http_config.c:1.1.1.8 apache13/src/main/http_config.c:1.14 *** apache13/src/main/http_config.c:1.1.1.8 Wed Jan 31 21:26:59 2001 --- apache13/src/main/http_config.c Wed Jan 31 22:37:30 2001 *************** *** 1510,1516 **** ap_scoreboard_fname = DEFAULT_SCOREBOARD; ap_lock_fname = DEFAULT_LOCKFILE; ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; - ap_bind_address.s_addr = htonl(INADDR_ANY); ap_listeners = NULL; ap_listenbacklog = DEFAULT_LISTENBACKLOG; ap_extended_status = 0; --- 1510,1515 ---- *************** *** 1543,1549 **** s->next = NULL; s->addrs = ap_pcalloc(p, sizeof(server_addr_rec)); /* NOT virtual host; don't match any real network interface */ ! s->addrs->host_addr.s_addr = htonl(INADDR_ANY); s->addrs->host_port = 0; /* matches any port */ s->addrs->virthost = ""; /* must be non-NULL */ s->names = s->wild_names = NULL; --- 1542,1554 ---- s->next = NULL; s->addrs = ap_pcalloc(p, sizeof(server_addr_rec)); /* NOT virtual host; don't match any real network interface */ ! memset(&s->addrs->host_addr, 0, sizeof(s->addrs->host_addr)); ! #if 0 ! s->addrs->host_addr.ss_family = ap_default_family; /* XXX: needed?, XXX: PF_xxx can be different from AF_xxx */ ! #endif ! #ifdef HAVE_SOCKADDR_LEN ! s->addrs->host_addr.ss_len = sizeof(s->addrs->host_addr); /* XXX: needed ? */ ! #endif s->addrs->host_port = 0; /* matches any port */ s->addrs->virthost = ""; /* must be non-NULL */ s->names = s->wild_names = NULL; *************** *** 1558,1576 **** static void default_listeners(pool *p, server_rec *s) { listen_rec *new; if (ap_listeners != NULL) { return; } /* allocate a default listener */ new = ap_pcalloc(p, sizeof(listen_rec)); ! new->local_addr.sin_family = AF_INET; ! new->local_addr.sin_addr = ap_bind_address; ! new->local_addr.sin_port = htons(s->port ? s->port : DEFAULT_HTTP_PORT); new->fd = -1; new->used = 0; new->next = NULL; ap_listeners = new; } --- 1563,1595 ---- static void default_listeners(pool *p, server_rec *s) { listen_rec *new; + struct addrinfo hints, *res0, *res; + int gai; + char servbuf[NI_MAXSERV]; if (ap_listeners != NULL) { return; } + ap_snprintf(servbuf, sizeof(servbuf), "%d", s->port ? s->port : DEFAULT_HTTP_PORT); + memset (&hints, 0, sizeof(hints)); + hints.ai_family = ap_default_family; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_PASSIVE; + gai = getaddrinfo(NULL, servbuf, &hints, &res0); + if (gai){ + fprintf(stderr, "default_listeners(): getaddrinfo(PASSIVE) for family %u: %s\n", + gai_strerror(gai), ap_default_family); + exit (1); + } /* allocate a default listener */ new = ap_pcalloc(p, sizeof(listen_rec)); ! memcpy(&new->local_addr, res0->ai_addr, res0->ai_addrlen); new->fd = -1; new->used = 0; new->next = NULL; ap_listeners = new; + + freeaddrinfo(res0); } Index: apache13/src/main/http_core.c diff -c apache13/src/main/http_core.c:1.1.1.10 apache13/src/main/http_core.c:1.24 *** apache13/src/main/http_core.c:1.1.1.10 Thu Mar 1 11:40:37 2001 --- apache13/src/main/http_core.c Thu Mar 1 12:14:19 2001 *************** *** 70,75 **** --- 70,76 ---- #include "util_md5.h" #include "scoreboard.h" #include "fnmatch.h" + #include "sa_len.h" #ifdef USE_MMAP_FILES #include *************** *** 567,573 **** /* Code from Harald Hanche-Olsen */ static ap_inline void do_double_reverse (conn_rec *conn) { ! struct hostent *hptr; if (conn->double_reverse) { /* already done */ --- 568,576 ---- /* Code from Harald Hanche-Olsen */ static ap_inline void do_double_reverse (conn_rec *conn) { ! struct addrinfo hints, *res, *res0; ! char hostbuf1[128], hostbuf2[128]; /* INET6_ADDRSTRLEN(=46) is enough */ ! int ok = 0; if (conn->double_reverse) { /* already done */ *************** *** 578,605 **** conn->double_reverse = -1; return; } ! hptr = gethostbyname(conn->remote_host); ! if (hptr) { ! char **haddr; ! ! for (haddr = hptr->h_addr_list; *haddr; haddr++) { ! if (((struct in_addr *)(*haddr))->s_addr ! == conn->remote_addr.sin_addr.s_addr) { ! conn->double_reverse = 1; ! return; ! } } } ! conn->double_reverse = -1; } API_EXPORT(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type) { - struct in_addr *iaddr; - struct hostent *hptr; int hostname_lookups; int old_stat = SERVER_DEAD; /* we shouldn't ever be in this state */ /* If we haven't checked the host name, and we want to */ if (dir_config) { --- 581,631 ---- conn->double_reverse = -1; return; } ! memset(&hints, 0, sizeof(hints)); ! hints.ai_family = PF_UNSPEC; ! hints.ai_socktype = SOCK_STREAM; ! if (getaddrinfo(conn->remote_host, NULL, &hints, &res0)) { ! conn->double_reverse = -1; ! return; ! } ! for (res = res0; res; res = res->ai_next) { ! if (res->ai_addr->sa_family != conn->remote_addr.ss_family || ! !(res->ai_family == AF_INET ! #ifdef INET6 ! || res->ai_family == AF_INET6 ! #endif ! ) ! ) ! continue; ! #ifndef HAVE_SOCKADDR_LEN ! if (res->ai_addrlen != SA_LEN((struct sockaddr *)&conn->remote_addr)) ! #else ! if (res->ai_addr->sa_len != conn->remote_addr.ss_len) ! #endif ! continue; ! if (getnameinfo(res->ai_addr, res->ai_addrlen, ! hostbuf1, sizeof(hostbuf1), NULL, 0, ! NI_NUMERICHOST)) ! continue; ! if (getnameinfo(((struct sockaddr *)&conn->remote_addr), res->ai_addrlen, ! hostbuf2, sizeof(hostbuf2), NULL, 0, ! NI_NUMERICHOST)) ! continue; ! if (strcmp(hostbuf1, hostbuf2) == 0){ ! ok = 1; ! break; } } ! conn->double_reverse = ok ? 1 : -1; ! freeaddrinfo(res0); } API_EXPORT(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type) { int hostname_lookups; int old_stat = SERVER_DEAD; /* we shouldn't ever be in this state */ + char hostnamebuf[MAXHOSTNAMELEN]; /* If we haven't checked the host name, and we want to */ if (dir_config) { *************** *** 621,630 **** || hostname_lookups != HOSTNAME_LOOKUP_OFF)) { old_stat = ap_update_child_status(conn->child_num, SERVER_BUSY_DNS, (request_rec*)NULL); ! iaddr = &(conn->remote_addr.sin_addr); ! hptr = gethostbyaddr((char *)iaddr, sizeof(struct in_addr), AF_INET); ! if (hptr != NULL) { ! conn->remote_host = ap_pstrdup(conn->pool, (void *)hptr->h_name); ap_str_tolower(conn->remote_host); if (hostname_lookups == HOSTNAME_LOOKUP_DOUBLE) { --- 647,660 ---- || hostname_lookups != HOSTNAME_LOOKUP_OFF)) { old_stat = ap_update_child_status(conn->child_num, SERVER_BUSY_DNS, (request_rec*)NULL); ! if (!getnameinfo((struct sockaddr *)&conn->remote_addr, ! #ifndef SIN6_LEN ! SA_LEN((struct sockaddr *)&conn->remote_addr), ! #else ! conn->remote_addr.ss_len, ! #endif ! hostnamebuf, sizeof(hostnamebuf), NULL, 0, 0)) { ! conn->remote_host = ap_pstrdup(conn->pool, (void *)hostnamebuf); ap_str_tolower(conn->remote_host); if (hostname_lookups == HOSTNAME_LOOKUP_DOUBLE) { *************** *** 705,710 **** --- 735,741 ---- { conn_rec *conn = r->connection; core_dir_config *d; + char hbuf[MAXHOSTNAMELEN]; d = (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); *************** *** 714,736 **** } if (d->use_canonical_name == USE_CANONICAL_NAME_DNS) { if (conn->local_host == NULL) { - struct in_addr *iaddr; - struct hostent *hptr; int old_stat; old_stat = ap_update_child_status(conn->child_num, SERVER_BUSY_DNS, r); ! iaddr = &(conn->local_addr.sin_addr); ! hptr = gethostbyaddr((char *)iaddr, sizeof(struct in_addr), ! AF_INET); ! if (hptr != NULL) { ! conn->local_host = ap_pstrdup(conn->pool, ! (void *)hptr->h_name); ! ap_str_tolower(conn->local_host); ! } ! else { ! conn->local_host = ap_pstrdup(conn->pool, ! r->server->server_hostname); } (void) ap_update_child_status(conn->child_num, old_stat, r); } return conn->local_host; --- 745,766 ---- } if (d->use_canonical_name == USE_CANONICAL_NAME_DNS) { if (conn->local_host == NULL) { int old_stat; old_stat = ap_update_child_status(conn->child_num, SERVER_BUSY_DNS, r); ! if (getnameinfo((struct sockaddr *)&conn->local_addr, ! #ifndef SIN6_LEN ! SA_LEN((struct sockaddr *)&conn->local_addr), ! #else ! conn->local_addr.ss_len, ! #endif ! hbuf, sizeof(hbuf), NULL, 0, 0) == 0) { ! conn->local_host = ap_pstrdup(conn->pool, hbuf); ! } else { ! conn->local_host = ap_pstrdup(conn->pool, ! r->server->server_hostname); } + ap_str_tolower(conn->local_host); (void) ap_update_child_status(conn->child_num, old_stat, r); } return conn->local_host; *************** *** 749,759 **** 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; } API_EXPORT(char *) ap_construct_url(pool *p, const char *uri, --- 779,791 ---- if (d->use_canonical_name == USE_CANONICAL_NAME_OFF || d->use_canonical_name == USE_CANONICAL_NAME_DNS) { ! 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, *************** *** 2472,2483 **** static const char *set_bind_address(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } ! ap_bind_address.s_addr = ap_get_virthost_addr(arg, NULL); return NULL; } --- 2504,2528 ---- static const char *set_bind_address(cmd_parms *cmd, void *dummy, char *arg) { + struct addrinfo hints, *res; + struct sockaddr *sa; + size_t sa_len; + int error; const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } + + if (strcmp(arg, "*") == 0) + arg = NULL; ! sa = ap_get_virthost_addr(arg, NULL); ! #ifdef HAVE_SOCKADDR_LEN ! sa_len = sa->sa_len; ! #else ! sa_len = SA_LEN(sa); ! #endif ! memcpy(&ap_bind_address, &sa, sa_len); return NULL; } *************** *** 2494,2537 **** } #endif ! static const char *set_listener(cmd_parms *cmd, void *dummy, char *ips) { listen_rec *new; ! char *ports; ! unsigned short port; const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } ! ports = strchr(ips, ':'); ! if (ports != NULL) { ! if (ports == ips) { ! return "Missing IP address"; ! } ! else if (ports[1] == '\0') { ! return "Address must end in :"; } ! *(ports++) = '\0'; ! } ! else { ! ports = ips; } ! new=ap_pcalloc(cmd->pool, sizeof(listen_rec)); ! new->local_addr.sin_family = AF_INET; ! if (ports == ips) { /* no address */ ! new->local_addr.sin_addr.s_addr = htonl(INADDR_ANY); ! } ! else { ! new->local_addr.sin_addr.s_addr = ap_get_virthost_addr(ips, NULL); ! } ! port = atoi(ports); ! if (!port) { ! return "Port must be numeric"; } ! new->local_addr.sin_port = htons(port); new->fd = -1; new->used = 0; new->next = ap_listeners; --- 2539,2608 ---- } #endif ! static const char *set_listener(cmd_parms *cmd, void *dummy, char *h, char *p) { listen_rec *new; ! char *host, *port; ! struct addrinfo hints, *res; ! int error; const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } ! host = port = NULL; ! if (!p) { ! port = strrchr(h, ':'); ! if (port != NULL) { ! if (port == h) { ! return "Missing IP address"; ! } ! else if (port[1] == '\0') { ! return "Address must end in :"; ! } ! *(port++) = '\0'; ! if (*h) ! host = h; ! } else { ! host = NULL; ! port = h; } ! } else { ! host = h; ! port = p; } ! if (host && strcmp(host, "*") == 0) ! host = NULL; ! ! new = ap_pcalloc(cmd->pool, sizeof(listen_rec)); ! ! memset(&hints, 0, sizeof(hints)); ! hints.ai_family = host ? PF_UNSPEC : ap_default_family; ! hints.ai_flags = AI_PASSIVE; ! hints.ai_socktype = SOCK_STREAM; ! error = getaddrinfo(host, port, &hints, &res); ! if (error || !res) { ! fprintf(stderr, "could not resolve "); ! if (host) ! fprintf(stderr, "host \"%s\" ", host); ! if (port) ! fprintf(stderr, "port \"%s\" ", port); ! fprintf(stderr, "--- %s\n", gai_strerror(error)); ! exit(1); ! } ! if (res->ai_next) { ! if (host) ! fprintf(stderr, "host \"%s\" ", host); ! if (port) ! fprintf(stderr, "port \"%s\" ", port); ! fprintf(stderr, "resolved to multiple addresses, ambiguous.\n"); ! exit(1); } ! ! memcpy(&new->local_addr, res->ai_addr, res->ai_addrlen); ! new->fd = -1; new->used = 0; new->next = ap_listeners; *************** *** 3000,3006 **** { "ThreadStackSize", set_threadstacksize, NULL, RSRC_CONF, TAKE1, "Stack size each created thread will use."}, #endif ! { "Listen", set_listener, NULL, RSRC_CONF, TAKE1, "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"}, --- 3071,3077 ---- { "ThreadStackSize", set_threadstacksize, NULL, RSRC_CONF, TAKE1, "Stack size each created thread will use."}, #endif ! { "Listen", set_listener, NULL, RSRC_CONF, TAKE12, "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"}, *************** *** 3021,3027 **** "Name of the config file to be included" }, { "LogLevel", set_loglevel, NULL, RSRC_CONF, TAKE1, "Level of verbosity in error logging" }, ! { "NameVirtualHost", ap_set_name_virtual_host, NULL, RSRC_CONF, TAKE1, "A numeric IP address:port, or the name of a host" }, #ifdef _OSD_POSIX { "BS2000Account", set_bs2000_account, NULL, RSRC_CONF, TAKE1, --- 3092,3098 ---- "Name of the config file to be included" }, { "LogLevel", set_loglevel, NULL, RSRC_CONF, TAKE1, "Level of verbosity in error logging" }, ! { "NameVirtualHost", ap_set_name_virtual_host, NULL, RSRC_CONF, TAKE12, "A numeric IP address:port, or the name of a host" }, #ifdef _OSD_POSIX { "BS2000Account", set_bs2000_account, NULL, RSRC_CONF, TAKE1, Index: apache13/src/main/http_main.c diff -c apache13/src/main/http_main.c:1.1.1.10 apache13/src/main/http_main.c:1.20 *** apache13/src/main/http_main.c:1.1.1.10 Thu Mar 1 11:40:37 2001 --- apache13/src/main/http_main.c Thu Mar 1 12:14:19 2001 *************** *** 124,129 **** --- 124,131 ---- #include /* for IRIX, FD_SET calls bzero() */ #endif + #include "sa_len.h" + #ifdef MULTITHREAD /* special debug stuff -- PCS */ *************** *** 250,256 **** API_VAR_EXPORT char *ap_scoreboard_fname=NULL; char *ap_lock_fname; API_VAR_EXPORT char *ap_server_argv0=NULL; ! struct in_addr ap_bind_address; 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; --- 252,263 ---- API_VAR_EXPORT char *ap_scoreboard_fname=NULL; char *ap_lock_fname; API_VAR_EXPORT char *ap_server_argv0=NULL; ! #ifdef INET6 ! API_VAR_EXPORT int ap_default_family = PF_INET6; ! #else ! API_VAR_EXPORT int ap_default_family = PF_INET; ! #endif ! struct sockaddr_storage ap_bind_address; 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; *************** *** 1056,1062 **** fprintf(stderr, "Usage: %s [-D name] [-d directory] [-f file]\n", bin); #endif fprintf(stderr, " %s [-C \"directive\"] [-c \"directive\"]\n", pad); ! fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]\n", pad); fprintf(stderr, "Options:\n"); #ifdef SHARED_CORE fprintf(stderr, " -R directory : specify an alternate location for shared object files\n"); --- 1063,1073 ---- fprintf(stderr, "Usage: %s [-D name] [-d directory] [-f file]\n", bin); #endif fprintf(stderr, " %s [-C \"directive\"] [-c \"directive\"]\n", pad); ! fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]" ! #ifdef INET6 ! " [-46]" ! #endif ! "\n", pad); fprintf(stderr, "Options:\n"); #ifdef SHARED_CORE fprintf(stderr, " -R directory : specify an alternate location for shared object files\n"); *************** *** 1078,1083 **** --- 1089,1098 ---- #endif fprintf(stderr, " -t : run syntax check for config files (with docroot check)\n"); fprintf(stderr, " -T : run syntax check for config files (without docroot check)\n"); + #ifdef INET6 + fprintf(stderr, " -4 : assume IPv4 on parsing configuration file\n"); + fprintf(stderr, " -6 : assume IPv6 on parsing configuration file\n"); + #endif #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"); *************** *** 3202,3212 **** static conn_rec *new_connection(pool *p, server_rec *server, BUFF *inout, ! const struct sockaddr_in *remaddr, ! const struct sockaddr_in *saddr, int child_num) { conn_rec *conn = (conn_rec *) ap_pcalloc(p, sizeof(conn_rec)); /* Got a connection structure, so initialize what fields we can * (the rest are zeroed out by pcalloc). --- 3217,3229 ---- static conn_rec *new_connection(pool *p, server_rec *server, BUFF *inout, ! const struct sockaddr *remaddr, ! const struct sockaddr *saddr, int child_num) { conn_rec *conn = (conn_rec *) ap_pcalloc(p, sizeof(conn_rec)); + char hostnamebuf[MAXHOSTNAMELEN]; + size_t addr_len; /* Got a connection structure, so initialize what fields we can * (the rest are zeroed out by pcalloc). *************** *** 3215,3231 **** conn->child_num = child_num; conn->pool = p; ! conn->local_addr = *saddr; ! conn->local_ip = ap_pstrdup(conn->pool, ! inet_ntoa(conn->local_addr.sin_addr)); conn->server = server; /* just a guess for now */ ap_update_vhost_given_ip(conn); conn->base_server = conn->server; conn->client = inout; ! conn->remote_addr = *remaddr; ! conn->remote_ip = ap_pstrdup(conn->pool, ! inet_ntoa(conn->remote_addr.sin_addr)); return conn; } --- 3232,3260 ---- conn->child_num = child_num; conn->pool = p; ! #ifndef SIN6_LEN ! addr_len = SA_LEN(saddr); ! #else ! addr_len = saddr->sa_len; ! #endif ! memcpy(&conn->local_addr, saddr, addr_len); ! getnameinfo((struct sockaddr *)&conn->local_addr, addr_len, ! hostnamebuf, sizeof(hostnamebuf), NULL, 0, NI_NUMERICHOST); ! conn->local_ip = ap_pstrdup(conn->pool, hostnamebuf); conn->server = server; /* just a guess for now */ ap_update_vhost_given_ip(conn); conn->base_server = conn->server; conn->client = inout; ! #ifndef SIN6_LEN ! addr_len = SA_LEN(remaddr); ! #else ! addr_len = remaddr->sa_len; ! #endif ! memcpy(&conn->remote_addr, remaddr, addr_len); ! getnameinfo((struct sockaddr *)&conn->remote_addr, addr_len, ! hostnamebuf, sizeof(hostnamebuf), NULL, 0, NI_NUMERICHOST); ! conn->remote_ip = ap_pstrdup(conn->pool, hostnamebuf); return conn; } *************** *** 3258,3278 **** #define sock_disable_nagle(s) /* NOOP */ #endif ! static int make_sock(pool *p, const struct sockaddr_in *server) { int s; int one = 1; ! char addr[512]; ! if (server->sin_addr.s_addr != htonl(INADDR_ANY)) ! ap_snprintf(addr, sizeof(addr), "address %s port %d", ! inet_ntoa(server->sin_addr), ntohs(server->sin_port)); ! else ! ap_snprintf(addr, sizeof(addr), "port %d", ntohs(server->sin_port)); /* note that because we're about to slack we don't use psocket */ ap_block_alarms(); ! if ((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, "make_sock: failed to get a socket for %s", addr); --- 3287,3333 ---- #define sock_disable_nagle(s) /* NOOP */ #endif ! static int make_sock(pool *p, const struct sockaddr *server) { int s; int one = 1; ! char addr[INET6_ADDRSTRLEN + 128]; ! char a0[INET6_ADDRSTRLEN]; ! char p0[NI_MAXSERV]; ! #ifdef MPE ! int privport = 0; ! #endif ! switch(server->sa_family){ ! case AF_INET: ! #ifdef INET6 ! case AF_INET6: ! #endif ! break; ! default: ! ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, ! "make_sock: unsupported address family %u", ! server->sa_family); ! ap_unblock_alarms(); ! exit(1); ! } ! ! getnameinfo(server, ! #ifndef SIN6_LEN ! SA_LEN(server), ! #else ! server->sa_len, ! #endif ! a0, sizeof(a0), p0, sizeof(p0), NI_NUMERICHOST | NI_NUMERICSERV); ! ap_snprintf(addr, sizeof(addr), "address %s port %s", a0, p0); ! #ifdef MPE ! if (atoi(p0) < 1024) ! privport++; ! #endif /* note that because we're about to slack we don't use psocket */ ap_block_alarms(); ! if ((s = socket(server->sa_family, SOCK_STREAM, IPPROTO_TCP)) == -1) { ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, "make_sock: failed to get a socket for %s", addr); *************** *** 3375,3389 **** #ifdef MPE /* MPE requires CAP=PM and GETPRIVMODE to bind to ports less than 1024 */ ! if (ntohs(server->sin_port) < 1024) GETPRIVMODE(); #endif ! ! if (bind(s, (struct sockaddr *) server, sizeof(struct sockaddr_in)) == -1) { ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, "make_sock: could not bind to %s", addr); #ifdef MPE ! if (ntohs(server->sin_port) < 1024) GETUSERMODE(); #endif --- 3430,3448 ---- #ifdef MPE /* MPE requires CAP=PM and GETPRIVMODE to bind to ports less than 1024 */ ! if (privport) GETPRIVMODE(); #endif ! #ifndef SIN6_LEN ! if (bind(s, server, SA_LEN(server)) == -1) ! #else ! if (bind(s, server, server->sa_len) == -1) ! #endif ! { ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, "make_sock: could not bind to %s", addr); #ifdef MPE ! if (privport) GETUSERMODE(); #endif *************** *** 3396,3402 **** exit(1); } #ifdef MPE ! if (ntohs(server->sin_port) < 1024) GETUSERMODE(); #endif --- 3455,3461 ---- exit(1); } #ifdef MPE ! if (privport) GETUSERMODE(); #endif *************** *** 3543,3556 **** for (;;) { fd = find_listener(lr); if (fd < 0) { ! fd = make_sock(p, &lr->local_addr); } else { ap_note_cleanups_for_socket(p, fd); } ! FD_SET(fd, &listenfds); ! if (fd > listenmaxfd) ! listenmaxfd = fd; lr->fd = fd; if (lr->next == NULL) break; --- 3602,3617 ---- for (;;) { fd = find_listener(lr); if (fd < 0) { ! fd = make_sock(p, (struct sockaddr *)&lr->local_addr); } else { ap_note_cleanups_for_socket(p, fd); } ! if (fd >= 0) { ! FD_SET(fd, &listenfds); ! if (fd > listenmaxfd) ! listenmaxfd = fd; ! } lr->fd = fd; if (lr->next == NULL) break; *************** *** 3824,3831 **** static void child_main(int child_num_arg) { NET_SIZE_T clen; ! struct sockaddr sa_server; ! struct sockaddr sa_client; listen_rec *lr; /* All of initialization is a critical section, we don't care if we're --- 3885,3892 ---- static void child_main(int child_num_arg) { NET_SIZE_T clen; ! struct sockaddr_storage sa_server; ! struct sockaddr_storage sa_client; listen_rec *lr; /* All of initialization is a critical section, we don't care if we're *************** *** 3990,3996 **** usr1_just_die = 0; for (;;) { clen = sizeof(sa_client); ! csd = ap_accept(sd, &sa_client, &clen); if (csd >= 0 || errno != EINTR) break; if (deferred_die) { --- 4051,4057 ---- usr1_just_die = 0; for (;;) { clen = sizeof(sa_client); ! csd = ap_accept(sd, (struct sockaddr *)&sa_client, &clen); if (csd >= 0 || errno != EINTR) break; if (deferred_die) { *************** *** 4140,4146 **** */ clen = sizeof(sa_server); ! if (getsockname(csd, &sa_server, &clen) < 0) { ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "getsockname"); continue; } --- 4201,4207 ---- */ clen = sizeof(sa_server); ! if (getsockname(csd, (struct sockaddr *)&sa_server, &clen) < 0) { ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "getsockname"); continue; } *************** *** 4185,4192 **** ap_bpushfd(conn_io, csd, dupped_csd); current_conn = new_connection(ptrans, server_conf, conn_io, ! (struct sockaddr_in *) &sa_client, ! (struct sockaddr_in *) &sa_server, my_child_num); /* --- 4246,4253 ---- ap_bpushfd(conn_io, csd, dupped_csd); current_conn = new_connection(ptrans, server_conf, conn_io, ! (struct sockaddr *)&sa_client, ! (struct sockaddr *)&sa_server, my_child_num); /* *************** *** 4321,4332 **** #ifdef _OSD_POSIX /* BS2000 requires a "special" version of fork() before a setuid() call */ ! if ((pid = os_fork(ap_user_name)) == -1) { #elif defined(TPF) ! if ((pid = os_fork(s, slot)) == -1) { #else ! if ((pid = fork()) == -1) { #endif ap_log_error(APLOG_MARK, APLOG_ERR, s, "fork: Unable to fork new process"); /* fork didn't succeed. Fix the scoreboard or else --- 4382,4394 ---- #ifdef _OSD_POSIX /* BS2000 requires a "special" version of fork() before a setuid() call */ ! if ((pid = os_fork(ap_user_name)) == -1) #elif defined(TPF) ! if ((pid = os_fork(s, slot)) == -1) #else ! if ((pid = fork()) == -1) #endif + { ap_log_error(APLOG_MARK, APLOG_ERR, s, "fork: Unable to fork new process"); /* fork didn't succeed. Fix the scoreboard or else *************** *** 4900,4906 **** ap_setup_prelinked_modules(); while ((c = getopt(argc, argv, ! "D:C:c:xXd:f:vVlLR:StTh" #ifdef DEBUG_SIGSTOP "Z:" #endif --- 4962,4971 ---- ap_setup_prelinked_modules(); while ((c = getopt(argc, argv, ! "D:C:c:xXd:f:vVlLR:StTh4" ! #ifdef INET6 ! "6" ! #endif #ifdef DEBUG_SIGSTOP "Z:" #endif *************** *** 4975,4982 **** ap_configtestonly = 1; ap_docrootcheck = 0; break; ! case 'h': ! usage(argv[0]); case '?': usage(argv[0]); } --- 5040,5053 ---- ap_configtestonly = 1; ap_docrootcheck = 0; break; ! case '4': ! ap_default_family = PF_INET; ! break; ! #ifdef INET6 ! case '6': ! ap_default_family = PF_INET6; ! break; ! #endif case '?': usage(argv[0]); } *************** *** 5040,5048 **** else { conn_rec *conn; request_rec *r; - struct sockaddr sa_server, sa_client; BUFF *cio; NET_SIZE_T l; ap_set_version(); /* Yes this is called twice. */ --- 5111,5120 ---- else { conn_rec *conn; request_rec *r; BUFF *cio; + struct sockaddr_storage sa_server, sa_client; NET_SIZE_T l; + char servbuf[NI_MAXSERV]; ap_set_version(); /* Yes this is called twice. */ *************** *** 5089,5113 **** #endif l = sizeof(sa_client); ! if ((getpeername(sock_in, &sa_client, &l)) < 0) { /* get peername will fail if the input isn't a socket */ perror("getpeername"); memset(&sa_client, '\0', sizeof(sa_client)); } l = sizeof(sa_server); ! if (getsockname(sock_in, &sa_server, &l) < 0) { perror("getsockname"); fprintf(stderr, "Error getting local address\n"); exit(1); } ! server_conf->port = ntohs(((struct sockaddr_in *) &sa_server)->sin_port); cio = ap_bcreate(ptrans, B_RDWR | B_SOCKET); cio->fd = sock_out; cio->fd_in = sock_in; conn = new_connection(ptrans, server_conf, cio, ! (struct sockaddr_in *) &sa_client, ! (struct sockaddr_in *) &sa_server, -1); while ((r = ap_read_request(conn)) != NULL) { --- 5161,5192 ---- #endif l = sizeof(sa_client); ! if ((getpeername(sock_in, (struct sockaddr *)&sa_client, &l)) < 0) { /* get peername will fail if the input isn't a socket */ perror("getpeername"); memset(&sa_client, '\0', sizeof(sa_client)); } l = sizeof(sa_server); ! if (getsockname(sock_in, (struct sockaddr *)&sa_server, &l) < 0) { perror("getsockname"); fprintf(stderr, "Error getting local address\n"); exit(1); + } + if (getnameinfo(((struct sockaddr *)&sa_server), l, + NULL, 0, servbuf, sizeof(servbuf), + NI_NUMERICSERV)){ + fprintf(stderr, "getnameinfo(): family=%d\n", sa_server.ss_family); + exit(1); } ! servbuf[sizeof(servbuf)-1] = '\0'; ! server_conf->port = atoi(servbuf); cio = ap_bcreate(ptrans, B_RDWR | B_SOCKET); cio->fd = sock_out; cio->fd_in = sock_in; conn = new_connection(ptrans, server_conf, cio, ! (struct sockaddr *)&sa_client, ! (struct sockaddr *)&sa_server, -1); while ((r = ap_read_request(conn)) != NULL) { *************** *** 7233,7239 **** * but only handle the -L option */ llp_dir = SHARED_CORE_DIR; ! while ((c = getopt(argc, argv, "D:C:c:Xd:f:vVlLR:SZ:tTh")) != -1) { switch (c) { case 'D': case 'C': --- 7312,7322 ---- * but only handle the -L option */ llp_dir = SHARED_CORE_DIR; ! while ((c = getopt(argc, argv, "D:C:c:Xd:f:vVlLR:SZ:tTh4" ! #ifdef INET6 ! "6" ! #endif ! )) != -1) { switch (c) { case 'D': case 'C': *************** *** 7250,7255 **** --- 7333,7342 ---- case 't': case 'T': case 'h': + case '4': + #ifdef INET6 + case '6': + #endif case '?': break; case 'R': Index: apache13/src/main/http_vhost.c diff -c apache13/src/main/http_vhost.c:1.1.1.6 apache13/src/main/http_vhost.c:1.34 *** apache13/src/main/http_vhost.c:1.1.1.6 Thu Mar 1 11:40:38 2001 --- apache13/src/main/http_vhost.c Thu Mar 1 12:14:19 2001 *************** *** 68,73 **** --- 68,74 ---- #include "http_log.h" #include "http_vhost.h" #include "http_protocol.h" + #include "sa_len.h" /* * After all the definitions there's an explanation of how it's all put *************** *** 165,242 **** * *paddr is the variable used to keep track of **paddr between calls * port is the default port to assume */ ! static const char *get_addresses(pool *p, char *w, server_addr_rec ***paddr, ! unsigned port) { ! struct hostent *hep; ! unsigned long my_addr; server_addr_rec *sar; ! char *t; ! int i, is_an_ip_addr; ! if (*w == 0) return NULL; ! t = strchr(w, ':'); ! if (t) { ! if (strcmp(t + 1, "*") == 0) { ! port = 0; } ! else if ((i = atoi(t + 1))) { ! port = i; } else { ! return ":port must be numeric"; } ! *t = 0; } ! is_an_ip_addr = 0; ! if (strcmp(w, "*") == 0) { ! my_addr = htonl(INADDR_ANY); ! is_an_ip_addr = 1; ! } ! else if (strcasecmp(w, "_default_") == 0 ! || strcmp(w, "255.255.255.255") == 0) { ! my_addr = DEFAULT_VHOST_ADDR; ! is_an_ip_addr = 1; ! } ! else if ((my_addr = ap_inet_addr(w)) != INADDR_NONE) { ! is_an_ip_addr = 1; } ! if (is_an_ip_addr) { ! sar = ap_pcalloc(p, sizeof(server_addr_rec)); ! **paddr = sar; ! *paddr = &sar->next; ! sar->host_addr.s_addr = my_addr; ! sar->host_port = port; ! sar->virthost = ap_pstrdup(p, w); ! if (t != NULL) ! *t = ':'; ! return NULL; } - - hep = gethostbyname(w); ! if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL, ! "Cannot resolve host name %s --- ignoring!", w); ! if (t != NULL) ! *t = ':'; return NULL; } ! ! for (i = 0; hep->h_addr_list[i]; ++i) { sar = ap_pcalloc(p, sizeof(server_addr_rec)); **paddr = sar; *paddr = &sar->next; ! sar->host_addr = *(struct in_addr *) hep->h_addr_list[i]; ! sar->host_port = port; sar->virthost = ap_pstrdup(p, w); } ! if (t != NULL) ! *t = ':'; return NULL; } --- 166,279 ---- * *paddr is the variable used to keep track of **paddr between calls * port is the default port to assume */ ! static const char *get_addresses(pool *p, char *w, char *pstr, ! server_addr_rec ***paddr, unsigned port) { ! struct addrinfo hints, *res, *res0; server_addr_rec *sar; ! char *t = NULL, *u = NULL, *v = NULL; ! char *hoststr = NULL, *portstr = NULL; ! char portpool[10]; ! int error; ! char servbuf[NI_MAXSERV]; ! if (w == 0 || *w == 0) return NULL; ! portstr = portpool; ! ap_snprintf(portpool, sizeof(portpool), "%u", port); ! if (!pstr) { ! v = w; ! u = NULL; ! if (*w == '['){ ! u = strrchr(w, ']'); ! if (u) { /* [host]:port or [host] */ ! w++; ! *u = '\0'; ! v = u + 1; ! } } ! /* w uv , w=v , w=v */ ! /* u!=0: [host]:port , u==0: [host:port , host */ ! t = strchr(v, ':'); ! if (t != NULL && strchr(t+1, ':') == NULL) { ! /* [host]:port-w/o-colons, host-without-colons:port-w/o-colons */ ! *t = '\0'; ! portstr = t + 1; } else { ! portstr = "0"; } ! } else { ! portstr = pstr; } ! memset(&hints, 0, sizeof(hints)); ! hints.ai_socktype = SOCK_STREAM; ! if (strcmp(w, "*") == 0 || strlen(w) == 0) { ! hoststr = NULL; ! hints.ai_family = PF_UNSPEC; ! hints.ai_flags = AI_PASSIVE; ! } ! else if (strcasecmp(w, "_default4_") == 0 || ! ((ap_default_family == PF_INET ! #ifndef INET6 ! || ap_default_family == PF_UNSPEC ! #endif ! ) && strcasecmp(w, "_default_") == 0)){ ! hoststr = "255.255.255.255"; ! hints.ai_family = PF_INET; ! } ! #ifdef INET6 ! else if (strcasecmp(w, "_default6_") == 0 || ! ((ap_default_family == PF_INET6 ! || ap_default_family == PF_UNSPEC ! ) && strcasecmp(w, "_default_") == 0)){ ! hoststr = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"; ! hints.ai_family = PF_INET6; } ! #endif ! else{ ! hoststr = w; ! hints.ai_family = PF_UNSPEC; } ! error = getaddrinfo(hoststr, portstr, &hints, &res0); ! if (error || !res0) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL, ! "Cannot resolve host %s port %s --- ignoring!", hoststr, portstr); ! if (t != NULL) *t = ':'; ! if (u != NULL) *u = ']'; return NULL; } ! for (res=res0; res; res=res->ai_next) { ! switch (res->ai_addr->sa_family) { ! case AF_INET: ! #ifdef INET6 ! case AF_INET6: ! #endif ! break; ! default: ! ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL, ! "Unsupported address family %u, for host %s port %s --- ignoring!", ! res->ai_addr->sa_family, hoststr, portstr); ! continue; ! } sar = ap_pcalloc(p, sizeof(server_addr_rec)); **paddr = sar; *paddr = &sar->next; ! memcpy(&sar->host_addr, res->ai_addr, res->ai_addrlen); ! if (getnameinfo(res->ai_addr, res->ai_addrlen, NULL, 0, servbuf, ! sizeof(servbuf), NI_NUMERICSERV) == 0) ! sar->host_port = atoi(servbuf); ! else ! sar->host_port = 0; sar->virthost = ap_pstrdup(p, w); } ! freeaddrinfo(res0); ! if (t != NULL) *t = ':'; ! if (u != NULL) *u = ']'; return NULL; } *************** *** 250,256 **** /* start the list of addreses */ addrs = &s->addrs; while (hostname[0]) { ! err = get_addresses(p, ap_getword_conf(p, &hostname), &addrs, s->port); if (err) { *addrs = NULL; return err; --- 287,294 ---- /* start the list of addreses */ addrs = &s->addrs; while (hostname[0]) { ! err = get_addresses(p, ap_getword_conf(p, &hostname), NULL, ! &addrs, s->port); if (err) { *addrs = NULL; return err; *************** *** 268,277 **** } ! const char *ap_set_name_virtual_host (cmd_parms *cmd, void *dummy, char *arg) { /* use whatever port the main server has at this point */ ! return get_addresses(cmd->pool, arg, &name_vhost_list_tail, cmd->server->port); } --- 306,316 ---- } ! const char *ap_set_name_virtual_host (cmd_parms *cmd, void *dummy, char *h, ! char *p) { /* use whatever port the main server has at this point */ ! return get_addresses(cmd->pool, h, p, &name_vhost_list_tail, cmd->server->port); } *************** *** 345,350 **** --- 384,402 ---- return ((key >> 8) ^ key) % IPHASH_TABLE_SIZE; } + static unsigned hash_addr(struct sockaddr *sa) + { + switch (sa->sa_family) { + case AF_INET: + return hash_inaddr(((struct sockaddr_in *)sa)->sin_addr.s_addr); + #ifdef INET6 + case AF_INET6: + return hash_inaddr(((struct sockaddr_in6 *)sa)->sin6_addr.s6_addr[12]); + #endif + default: + return hash_inaddr(sa->sa_family); + } + } static ipaddr_chain *new_ipaddr_chain(pool *p, *************** *** 372,396 **** return new; } ! ! static ap_inline ipaddr_chain *find_ipaddr(struct in_addr *server_ip, ! unsigned port) { unsigned bucket; ipaddr_chain *trav; ! unsigned addr; /* scan the hash table for an exact match first */ ! addr = server_ip->s_addr; ! bucket = hash_inaddr(addr); for (trav = iphash_table[bucket]; trav; trav = trav->next) { server_addr_rec *sar = trav->sar; ! if ((sar->host_addr.s_addr == addr) ! && (sar->host_port == 0 || sar->host_port == port ! || port == 0)) { ! return trav; } } return NULL; } --- 424,500 ---- return new; } ! static ap_inline ipaddr_chain *find_ipaddr(struct sockaddr *sa) { unsigned bucket; ipaddr_chain *trav; ! char a[NI_MAXHOST], b[NI_MAXHOST]; /* scan the hash table for an exact match first */ ! bucket = hash_addr(sa); for (trav = iphash_table[bucket]; trav; trav = trav->next) { server_addr_rec *sar = trav->sar; ! if (sar->host_addr.ss_family != sa->sa_family) ! continue; ! switch (sa->sa_family) { ! case AF_INET: ! { ! struct sockaddr_in *sin1, *sin2; ! sin1 = (struct sockaddr_in *)&sar->host_addr; ! sin2 = (struct sockaddr_in *)sa; ! if (sin1->sin_port == 0 || sin2->sin_port == 0 ! || sin1->sin_port == sin2->sin_port) { ! if (memcmp(&sin1->sin_addr, &sin2->sin_addr, ! sizeof(sin1->sin_addr)) == 0) { ! return trav; ! } ! } ! break; ! } ! #ifdef INET6 ! case AF_INET6: ! { ! struct sockaddr_in6 *sin1, *sin2; ! sin1 = (struct sockaddr_in6 *)&sar->host_addr; ! sin2 = (struct sockaddr_in6 *)sa; ! if (sin1->sin6_port == 0 || sin2->sin6_port == 0 ! || sin1->sin6_port == sin2->sin6_port) { ! if (memcmp(&sin1->sin6_addr, &sin2->sin6_addr, ! sizeof(sin1->sin6_addr)) == 0) { ! return trav; ! } ! } ! break; ! } ! #endif ! default: /*unsupported*/ ! break; } } + + #ifdef INET6 + if (sa->sa_family == AF_INET6 && + IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)sa)->sin6_addr)) { + /* + * This is just horrible. I just hate IPv4 mapped address. It + * complicates access control too much. + * Due to hashed lookup, we need to visit it again. + */ + struct sockaddr_in sin; + + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + #ifdef SIN6_LEN + sin.sin_len = sizeof(sin); + #endif + sin.sin_port = ((struct sockaddr_in6 *)sa)->sin6_port; + memcpy(&sin.sin_addr, + &((struct sockaddr_in6 *)sa)->sin6_addr.s6_addr[12], + sizeof(sin.sin_addr)); + return find_ipaddr((struct sockaddr *)&sin); + } + #endif + return NULL; } *************** *** 416,436 **** int len; char buf[MAX_STRING_LEN]; ! if (ic->sar->host_addr.s_addr == DEFAULT_VHOST_ADDR) { ! len = ap_snprintf(buf, sizeof(buf), "_default_:%u", ! ic->sar->host_port); ! } ! else if (ic->sar->host_addr.s_addr == INADDR_ANY) { ! len = ap_snprintf(buf, sizeof(buf), "*:%u", ! ic->sar->host_port); ! } ! else { ! len = ap_snprintf(buf, sizeof(buf), "%pA:%u", ! &ic->sar->host_addr, ic->sar->host_port); ! } ! if (ic->sar->host_port == 0) { ! buf[len-1] = '*'; ! } if (ic->names == NULL) { if (ic->server == NULL) fprintf(f, "%-22s WARNING: No defined for this NameVirtualHost!\n", buf); --- 520,526 ---- int len; char buf[MAX_STRING_LEN]; ! len = ap_snprintf(buf, sizeof(buf), "%pI", &ic->sar->host_addr); if (ic->names == NULL) { if (ic->server == NULL) fprintf(f, "%-22s WARNING: No defined for this NameVirtualHost!\n", buf); *************** *** 558,567 **** * occured in the config file, we'll copy it in that order. */ for (sar = name_vhost_list; sar; sar = sar->next) { ! unsigned bucket = hash_inaddr(sar->host_addr.s_addr); ipaddr_chain *ic = new_ipaddr_chain(p, NULL, sar); ! if (sar->host_addr.s_addr != INADDR_ANY) { *iphash_table_tail[bucket] = ic; iphash_table_tail[bucket] = &ic->next; } --- 648,684 ---- * occured in the config file, we'll copy it in that order. */ for (sar = name_vhost_list; sar; sar = sar->next) { ! unsigned bucket = hash_addr((struct sockaddr *)&sar->host_addr); ipaddr_chain *ic = new_ipaddr_chain(p, NULL, sar); + int wildcard; ! wildcard = 0; ! switch (sar->host_addr.ss_family) { ! case AF_INET: ! { ! struct sockaddr_in *sin; ! sin = (struct sockaddr_in *)&sar->host_addr; ! if (sin->sin_addr.s_addr == INADDR_ANY) ! wildcard++; ! break; ! } ! #ifdef INET6 ! case AF_INET6: ! { ! struct sockaddr_in6 *sin6; ! sin6 = (struct sockaddr_in6 *)&sar->host_addr; ! if (*(ap_uint32_t *)&sin6->sin6_addr.s6_addr[0] == 0 ! && *(ap_uint32_t *)&sin6->sin6_addr.s6_addr[4] == 0 ! && *(ap_uint32_t *)&sin6->sin6_addr.s6_addr[8] == 0 ! && *(ap_uint32_t *)&sin6->sin6_addr.s6_addr[12] == 0) { ! wildcard++; ! } ! break; ! } ! #endif ! } ! ! if (!wildcard) { *iphash_table_tail[bucket] = ic; iphash_table_tail[bucket] = &ic->next; } *************** *** 588,599 **** has_default_vhost_addr = 0; for (sar = s->addrs; sar; sar = sar->next) { ipaddr_chain *ic; ! 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) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, main_s, "_default_ VirtualHost overlap on port %u," " the first has precedence", sar->host_port); --- 705,749 ---- has_default_vhost_addr = 0; for (sar = s->addrs; sar; sar = sar->next) { ipaddr_chain *ic; + int wildcard; ! wildcard = 0; ! switch (sar->host_addr.ss_family) { ! case AF_INET: ! { ! struct sockaddr_in *sin; ! sin = (struct sockaddr_in *)&sar->host_addr; ! if (sin->sin_addr.s_addr == DEFAULT_VHOST_ADDR) ! wildcard++; ! else if (sin->sin_addr.s_addr == INADDR_ANY) ! wildcard++; ! break; ! } ! #ifdef INET6 ! case AF_INET6: ! { ! struct sockaddr_in6 *sin6; ! sin6 = (struct sockaddr_in6 *)&sar->host_addr; ! if (*(ap_uint32_t *)&sin6->sin6_addr.s6_addr[0] == ~0 ! && *(ap_uint32_t *)&sin6->sin6_addr.s6_addr[4] == ~0 ! && *(ap_uint32_t *)&sin6->sin6_addr.s6_addr[8] == ~0 ! && *(ap_uint32_t *)&sin6->sin6_addr.s6_addr[12] == ~0) { ! wildcard++; ! } ! break; ! } ! #endif ! } ! ! if (wildcard) { ! /* add it to default bucket for each appropriate sar ! * since we need to do a port test ! */ ! ipaddr_chain *other; ! ! other = find_default_server(sar->host_port); ! if (!other || !add_name_vhost_config(p, main_s, s, sar, other)) { ! if (other && other->sar->host_port != 0) { 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,615 **** } else { /* see if it matches something we've already got */ ! ic = find_ipaddr(&sar->host_addr, sar->host_port); if (!ic) { ! unsigned bucket = hash_inaddr(sar->host_addr.s_addr); ic = new_ipaddr_chain(p, s, sar); ic->next = *iphash_table_tail[bucket]; --- 756,766 ---- } else { /* see if it matches something we've already got */ ! ic = find_ipaddr((struct sockaddr *)&sar->host_addr); if (!ic) { ! unsigned bucket = ! hash_addr((struct sockaddr *)&sar->host_addr); ic = new_ipaddr_chain(p, s, sar); ic->next = *iphash_table_tail[bucket]; *************** *** 646,664 **** } else { struct hostent *h; ! if ((h = gethostbyaddr((char *) &(s->addrs->host_addr), ! sizeof(struct in_addr), AF_INET))) { ! s->server_hostname = ap_pstrdup(p, (char *) h->h_name); } else { /* again, what can we do? They didn't specify a ServerName, and their DNS isn't working. -djg */ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, main_s, "Failed to resolve server name " "for %s (check DNS) -- or specify an explicit " ! "ServerName", ! inet_ntoa(s->addrs->host_addr)); s->server_hostname = ap_pstrdup(p, "bogus_host_without_reverse_dns"); } --- 797,829 ---- } else { struct hostent *h; + char hostnamebuf[MAXHOSTNAMELEN]; ! if (!getnameinfo((struct sockaddr *)&s->addrs->host_addr, ! #ifndef SIN6_LEN ! SA_LEN((struct sockaddr *)&s->addrs->host_addr), ! #else ! s->addrs->host_addr.ss_len, ! #endif ! hostnamebuf, sizeof(hostnamebuf), ! NULL, 0, 0)) { ! s->server_hostname = ap_pstrdup(p, hostnamebuf); } else { /* again, what can we do? They didn't specify a ServerName, and their DNS isn't working. -djg */ + getnameinfo((struct sockaddr *)&s->addrs->host_addr, + #ifndef SIN6_LEN + SA_LEN((struct sockaddr *)&s->addrs->host_addr), + #else + s->addrs->host_addr.ss_len, + #endif + hostnamebuf, sizeof(hostnamebuf), + NULL, 0, NI_NUMERICHOST); ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, main_s, "Failed to resolve server name " "for %s (check DNS) -- or specify an explicit " ! "ServerName", hostnamebuf); s->server_hostname = ap_pstrdup(p, "bogus_host_without_reverse_dns"); } *************** *** 705,739 **** char *host = ap_palloc(r->pool, strlen(r->hostname) + 1); const char *src; char *dst; /* check and copy the host part */ ! src = r->hostname; dst = host; ! while (*src) { ! if (*src == '.') { ! *dst++ = *src++; ! if (*src == '.') ! goto bad; ! else ! continue; ! } ! if (*src == '/' || *src == '\\') { ! goto bad; } ! if (*src == ':') { ! /* check 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] == '.') { --- 870,927 ---- char *host = ap_palloc(r->pool, strlen(r->hostname) + 1); const char *src; char *dst; + const char *u = NULL, *v = NULL; /* check and copy the host part */ ! u = src = r->hostname; dst = host; ! 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; ! } } ! } 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,754 **** bad: r->status = HTTP_BAD_REQUEST; ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, ! "Client sent malformed Host header"); return; } --- 936,942 ---- bad: r->status = HTTP_BAD_REQUEST; ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, ! "Client sent malformed Host header <<%s>>",u); return; } *************** *** 851,861 **** * names we'll match have ports associated with them */ const char *host = r->hostname; ! unsigned port = ntohs(r->connection->local_addr.sin_port); server_rec *s; server_rec *last_s; name_chain *src; last_s = NULL; /* Recall that the name_chain is a list of server_addr_recs, some of --- 1039,1063 ---- * names we'll match have ports associated with them */ const char *host = r->hostname; ! unsigned port; server_rec *s; server_rec *last_s; name_chain *src; + switch (r->connection->local_addr.ss_family) { + case AF_INET: + port = ntohs(((struct sockaddr_in *) + &r->connection->local_addr)->sin_port); + break; + #ifdef INET6 + case AF_INET6: + port = ntohs(((struct sockaddr_in6 *) + &r->connection->local_addr)->sin6_port); + break; + #endif + default: + port = 0; /*XXX*/ + } last_s = NULL; /* Recall that the name_chain is a list of server_addr_recs, some of *************** *** 910,917 **** server_rec *s; server_rec *last_s; name_chain *src; ! unsigned port = ntohs(r->connection->local_addr.sin_port); /* * This is in conjunction with the ServerPath code in http_core, so we * get the right host attached to a non- Host-sending request. --- 1112,1134 ---- server_rec *s; server_rec *last_s; name_chain *src; ! unsigned port; + switch (r->connection->local_addr.ss_family) { + case AF_INET: + port = ntohs(((struct sockaddr_in *) + &r->connection->local_addr)->sin_port); + break; + #ifdef INET6 + case AF_INET6: + port = ntohs(((struct sockaddr_in6 *) + &r->connection->local_addr)->sin6_port); + break; + #endif + default: + port = 0; /*XXX*/ + } + /* * This is in conjunction with the ServerPath code in http_core, so we * get the right host attached to a non- Host-sending request. *************** *** 970,979 **** void ap_update_vhost_given_ip(conn_rec *conn) { ipaddr_chain *trav; ! unsigned port = ntohs(conn->local_addr.sin_port); /* scan the hash table for an exact match first */ ! trav = find_ipaddr(&conn->local_addr.sin_addr, port); if (trav) { /* save the name_chain for later in case this is a name-vhost */ conn->vhost_lookup_data = trav->names; --- 1187,1208 ---- void ap_update_vhost_given_ip(conn_rec *conn) { ipaddr_chain *trav; ! char portbuf[NI_MAXSERV]; ! unsigned port; ! ! if (getnameinfo((struct sockaddr *)&conn->local_addr, ! #ifndef SIN6_LEN ! SA_LEN((struct sockaddr *)&conn->local_addr), ! #else ! conn->local_addr.ss_len, ! #endif ! NULL, 0, portbuf, sizeof(portbuf), NI_NUMERICSERV) != 0) { ! goto fail; ! } ! port = atoi(portbuf); /* scan the hash table for an exact match first */ ! trav = find_ipaddr((struct sockaddr *)&conn->local_addr); if (trav) { /* save the name_chain for later in case this is a name-vhost */ conn->vhost_lookup_data = trav->names; *************** *** 991,996 **** --- 1220,1226 ---- return; } + fail: /* otherwise we're stuck with just the main server * and no name-based vhosts */ Index: apache13/src/main/rfc1413.c diff -c apache13/src/main/rfc1413.c:1.1.1.5 apache13/src/main/rfc1413.c:1.8 *** apache13/src/main/rfc1413.c:1.1.1.5 Wed Jan 31 21:27:02 2001 --- apache13/src/main/rfc1413.c Wed Jan 31 22:37:31 2001 *************** *** 82,87 **** --- 82,88 ---- #include "http_log.h" /* for aplog_error */ #include "rfc1413.h" #include "http_main.h" /* set_callback_and_alarm */ + #include "sa_len.h" /* Local stuff. */ /* Semi-well-known port */ *************** *** 109,120 **** /* bind_connect - bind both ends of a socket */ /* Ambarish fix this. Very broken */ ! static int get_rfc1413(int sock, const struct sockaddr_in *our_sin, ! const struct sockaddr_in *rmt_sin, char user[RFC1413_USERLEN+1], server_rec *srv) { ! struct sockaddr_in rmt_query_sin, our_query_sin; ! unsigned int rmt_port, our_port; int i; char *cp; char buffer[RFC1413_MAXDATA + 1]; --- 110,122 ---- /* bind_connect - bind both ends of a socket */ /* Ambarish fix this. Very broken */ ! static int get_rfc1413(int sock, const struct sockaddr *our_sin, ! const struct sockaddr *rmt_sin, char user[RFC1413_USERLEN+1], server_rec *srv) { ! struct sockaddr_storage rmt_query_sin, our_query_sin; ! unsigned int o_rmt_port, o_our_port; /* original port pair */ ! unsigned int rmt_port, our_port; /* replied port pair */ int i; char *cp; char buffer[RFC1413_MAXDATA + 1]; *************** *** 129,144 **** * addresses from the query socket. */ ! our_query_sin = *our_sin; ! our_query_sin.sin_port = htons(ANY_PORT); ! #ifdef MPE ! our_query_sin.sin_addr.s_addr = INADDR_ANY; #endif ! rmt_query_sin = *rmt_sin; ! rmt_query_sin.sin_port = htons(RFC1413_PORT); if (bind(sock, (struct sockaddr *) &our_query_sin, ! sizeof(struct sockaddr_in)) < 0) { ap_log_error(APLOG_MARK, APLOG_CRIT, srv, "bind: rfc1413: Error binding to local port"); return -1; --- 131,177 ---- * addresses from the query socket. */ ! #ifndef SIN6_LEN ! memcpy(&our_query_sin, our_sin, SA_LEN(our_sin)); ! memcpy(&rmt_query_sin, rmt_sin, SA_LEN(rmt_sin)); ! #else ! memcpy(&our_query_sin, our_sin, our_sin->sa_len); ! memcpy(&rmt_query_sin, rmt_sin, rmt_sin->sa_len); #endif ! switch (our_sin->sa_family) { ! case AF_INET: ! #ifdef MPE ! ((struct sockaddr_in *)&our_query_sin)->sin_addr.s_addr = INADDR_ANY; /* XXX: htonl(??) */ ! #endif ! ((struct sockaddr_in *)&our_query_sin)->sin_port = htons(ANY_PORT); ! o_our_port = ntohs(((struct sockaddr_in *)our_sin)->sin_port); ! ((struct sockaddr_in *)&rmt_query_sin)->sin_port = htons(RFC1413_PORT); ! o_rmt_port = ntohs(((struct sockaddr_in *)rmt_sin)->sin_port); ! break; ! #ifdef INET6 ! case AF_INET6: ! #ifdef MPE ! memcpy(&((struct sockaddr_in6 *)&our_query_sin)->sin6_addr, ! &in6addr_any, sizeof(struct in6_addr)); ! #endif ! ((struct sockaddr_in6 *)&our_query_sin)->sin6_port = htons(ANY_PORT); ! o_our_port = ntohs(((struct sockaddr_in6 *)our_sin)->sin6_port); ! ((struct sockaddr_in6 *)&rmt_query_sin)->sin6_port = htons(RFC1413_PORT); ! o_rmt_port = ntohs(((struct sockaddr_in6 *)rmt_sin)->sin6_port); ! break; ! #endif ! default: ! /* unsupported AF */ ! return -1; ! } if (bind(sock, (struct sockaddr *) &our_query_sin, ! #ifndef SIN6_LEN ! SA_LEN((struct sockaddr *) &our_query_sin) ! #else ! our_query_sin.ss_len ! #endif ! ) < 0) { ap_log_error(APLOG_MARK, APLOG_CRIT, srv, "bind: rfc1413: Error binding to local port"); return -1; *************** *** 149,160 **** * the service */ if (connect(sock, (struct sockaddr *) &rmt_query_sin, ! sizeof(struct sockaddr_in)) < 0) ! return -1; /* send the data */ ! buflen = ap_snprintf(buffer, sizeof(buffer), "%u,%u\r\n", ntohs(rmt_sin->sin_port), ! ntohs(our_sin->sin_port)); /* send query to server. Handle short write. */ #ifdef CHARSET_EBCDIC --- 182,199 ---- * the service */ if (connect(sock, (struct sockaddr *) &rmt_query_sin, ! #ifndef SIN6_LEN ! SA_LEN((struct sockaddr *) &rmt_query_sin) ! #else ! rmt_query_sin.ss_len ! #endif ! ) < 0) { ! return -1; ! } /* send the data */ ! buflen = ap_snprintf(buffer, sizeof(buffer), "%u,%u\r\n", o_rmt_port, ! o_our_port); /* send query to server. Handle short write. */ #ifdef CHARSET_EBCDIC *************** *** 219,227 **** ascii2ebcdic(buffer, buffer, (size_t)i); #endif if (sscanf(buffer, "%u , %u : USERID :%*[^:]:%512s", &rmt_port, &our_port, ! user) != 3 || ntohs(rmt_sin->sin_port) != rmt_port ! || ntohs(our_sin->sin_port) != our_port) return -1; /* * Strip trailing carriage return. It is part of the --- 258,266 ---- ascii2ebcdic(buffer, buffer, (size_t)i); #endif if (sscanf(buffer, "%u , %u : USERID :%*[^:]:%512s", &rmt_port, &our_port, ! user) != 3 || o_rmt_port != rmt_port || o_our_port != our_port) { return -1; + } /* * Strip trailing carriage return. It is part of the *************** *** 243,249 **** result = FROM_UNKNOWN; ! sock = ap_psocket(conn->pool, AF_INET, SOCK_STREAM, IPPROTO_TCP); if (sock < 0) { ap_log_error(APLOG_MARK, APLOG_CRIT, srv, "socket: rfc1413: error creating socket"); --- 282,288 ---- result = FROM_UNKNOWN; ! sock = ap_psocket(conn->pool, conn->remote_addr.ss_family, SOCK_STREAM, IPPROTO_TCP); if (sock < 0) { ap_log_error(APLOG_MARK, APLOG_CRIT, srv, "socket: rfc1413: error creating socket"); *************** *** 256,263 **** if (ap_setjmp(timebuf) == 0) { ap_set_callback_and_alarm(ident_timeout, ap_rfc1413_timeout); ! if (get_rfc1413(sock, &conn->local_addr, &conn->remote_addr, user, srv) >= 0) result = user; } ap_set_callback_and_alarm(NULL, 0); ap_pclosesocket(conn->pool, sock); --- 295,304 ---- if (ap_setjmp(timebuf) == 0) { ap_set_callback_and_alarm(ident_timeout, ap_rfc1413_timeout); ! if (get_rfc1413(sock, (struct sockaddr *)&conn->local_addr, ! (struct sockaddr *)&conn->remote_addr, user, srv) >= 0) { result = user; + } } ap_set_callback_and_alarm(NULL, 0); ap_pclosesocket(conn->pool, sock); Index: apache13/src/main/util.c diff -c apache13/src/main/util.c:1.1.1.10 apache13/src/main/util.c:1.18 *** apache13/src/main/util.c:1.1.1.10 Thu Mar 1 11:40:38 2001 --- apache13/src/main/util.c Thu Mar 1 12:14:19 2001 *************** *** 1959,2010 **** * Parses a host of the form
[:port] * :port is permitted if 'port' is not NULL */ ! unsigned long ap_get_virthost_addr(char *w, unsigned short *ports) { ! struct hostent *hep; ! unsigned long my_addr; ! char *p; ! ! p = strchr(w, ':'); if (ports != NULL) { ! *ports = 0; ! if (p != NULL && strcmp(p + 1, "*") != 0) ! *ports = atoi(p + 1); } if (p != NULL) *p = '\0'; if (strcmp(w, "*") == 0) { ! if (p != NULL) ! *p = ':'; ! return htonl(INADDR_ANY); ! } ! ! my_addr = ap_inet_addr((char *)w); ! if (my_addr != INADDR_NONE) { ! if (p != NULL) ! *p = ':'; ! return my_addr; } ! hep = gethostbyname(w); ! if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) { ! fprintf(stderr, "Cannot resolve host name %s --- exiting!\n", w); exit(1); } ! if (hep->h_addr_list[1]) { ! fprintf(stderr, "Host %s has multiple addresses ---\n", w); fprintf(stderr, "you must choose one explicitly for use as\n"); fprintf(stderr, "a virtual host. Exiting!!!\n"); exit(1); } if (p != NULL) *p = ':'; ! return ((struct in_addr *) (hep->h_addr))->s_addr; } --- 1959,2045 ---- * Parses a host of the form
[:port] * :port is permitted if 'port' is not NULL */ ! struct sockaddr *ap_get_virthost_addr(char *w, unsigned short *ports) { ! static struct sockaddr_storage ss; ! struct addrinfo hints, *res; ! char *p, *r; ! char *host; ! char *port = "0"; ! int error; ! char servbuf[NI_MAXSERV]; ! ! if (w == NULL) ! w = "*"; ! p = r = NULL; ! if (*w == '['){ ! if (r = strrchr(w+1, ']')){ ! *r = '\0'; ! p = r + 1; ! switch(*p){ ! case ':': ! p++; ! /* nobreak; */ ! case '\0': ! w++; ! break; ! default: ! p = NULL; ! } ! } ! } ! else{ ! p = strchr(w, ':'); ! if (p != NULL && strchr(p+1, ':') != NULL) ! p = NULL; ! } if (ports != NULL) { ! if (p != NULL && *p && strcmp(p + 1, "*") != 0) ! port = p + 1; } + memset(&hints, 0, sizeof(hints)); + hints.ai_socktype = SOCK_STREAM; if (p != NULL) *p = '\0'; if (strcmp(w, "*") == 0) { ! host = NULL; ! hints.ai_flags = AI_PASSIVE; ! hints.ai_family = ap_default_family; ! } else { ! host = w; ! hints.ai_family = PF_UNSPEC; } ! error = getaddrinfo(host, port, &hints, &res); ! if (error || !res) { ! fprintf(stderr, "ap_get_vitrhost_addr(): getaddrinfo(%s):%s --- exiting!\n", w, gai_strerror(error)); exit(1); } ! if (res->ai_next) { ! fprintf(stderr, "ap_get_vitrhost_addr(): Host %s has multiple addresses ---\n", w); fprintf(stderr, "you must choose one explicitly for use as\n"); fprintf(stderr, "a virtual host. Exiting!!!\n"); exit(1); } + if (r != NULL) + *r = ']'; if (p != NULL) *p = ':'; ! memcpy(&ss, res->ai_addr, res->ai_addrlen); ! if (getnameinfo(res->ai_addr, res->ai_addrlen, ! NULL, 0, servbuf, sizeof(servbuf), ! NI_NUMERICSERV)){ ! fprintf(stderr, "ap_get_virthost_addr(): getnameinfo() failed --- Exiting!!!\n"); ! exit(1); ! } ! if (ports) *ports = atoi(servbuf); ! freeaddrinfo(res); ! return (struct sockaddr *)&ss; } *************** *** 2030,2073 **** #endif char str[MAXHOSTNAMELEN]; char *server_hostname = NULL; ! struct hostent *p; #ifdef BEOS /* BeOS returns zero as an error for gethostname */ ! if (gethostname(str, sizeof(str) - 1) == 0) { #else ! if (gethostname(str, sizeof(str) - 1) != 0) { #endif /* BeOS */ ap_log_error(APLOG_MARK, APLOG_WARNING, NULL, "%s: gethostname() failed to determine ServerName\n", ap_server_argv0); server_hostname = ap_pstrdup(a, "127.0.0.1"); } ! else { ! str[sizeof(str) - 1] = '\0'; ! if ((!(p = gethostbyname(str))) ! || (!(server_hostname = find_fqdn(a, p)))) { ! /* Recovery - return the default servername by IP: */ ! if (p->h_addr_list[0]) { ! ap_snprintf(str, sizeof(str), "%pA", p->h_addr_list[0]); ! server_hostname = ap_pstrdup(a, str); ! /* We will drop through to report the IP-named server */ ! } ! } else ! /* Since we found a fdqn, return it with no logged message. */ ! return server_hostname; } /* If we don't have an fdqn or IP, fall back to the loopback addr */ ! if (!server_hostname) ! server_hostname = ap_pstrdup(a, "127.0.0.1"); ! ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, NULL, "%s: Could not determine the server's fully qualified " "domain name, using %s for ServerName", ap_server_argv0, server_hostname); return server_hostname; } --- 2065,2120 ---- #endif char str[MAXHOSTNAMELEN]; char *server_hostname = NULL; ! struct addrinfo hints, *res; ! int error; #ifdef BEOS /* BeOS returns zero as an error for gethostname */ ! if (gethostname(str, sizeof(str) - 1) == 0) #else ! if (gethostname(str, sizeof(str) - 1) != 0) #endif /* BeOS */ + { ap_log_error(APLOG_MARK, APLOG_WARNING, NULL, "%s: gethostname() failed to determine ServerName\n", ap_server_argv0); server_hostname = ap_pstrdup(a, "127.0.0.1"); } ! else { ! str[sizeof(str) - 1] = '\0'; ! memset(&hints, 0, sizeof(hints)); ! hints.ai_family = PF_UNSPEC; ! hints.ai_flags = AI_CANONNAME; ! res = NULL; ! error = getaddrinfo(str, NULL, &hints, &res); ! if (error == 0) ! { ! /* Since we found a fdqn, return it with no logged message. */ ! if (res) ! freeaddrinfo(res); ! return server_hostname; ! } else ! { ! /* Recovery - return the default servername by IP: */ ! server_hostname = ap_pstrdup(a, res->ai_canonname); ! /* We will drop through to report the IP-named server */ ! } ! } /* If we don't have an fdqn or IP, fall back to the loopback addr */ ! if (!server_hostname) ! server_hostname = ap_pstrdup(a, "127.0.0.1"); ! ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, NULL, "%s: Could not determine the server's fully qualified " "domain name, using %s for ServerName", ap_server_argv0, server_hostname); + if (res) + freeaddrinfo(res); + return server_hostname; } *************** *** 2145,2151 **** char *quote_doubled_str, *dest; while (str[len]) { ! num_quotes += str[len++] == '\"'; } quote_doubled_str = ap_palloc(p, len + num_quotes + 1); --- 2192,2198 ---- char *quote_doubled_str, *dest; while (str[len]) { ! num_quotes += str[len++] == '\"'; } quote_doubled_str = ap_palloc(p, len + num_quotes + 1); *************** *** 2270,2272 **** --- 2317,2327 ---- } *dest = 0; } + + #ifdef NEED_GETADDRINFO + #include "getaddrinfo.c" + #endif + + #ifdef NEED_GETNAMEINFO + #include "getnameinfo.c" + #endif Index: apache13/src/main/util_script.c diff -c apache13/src/main/util_script.c:1.1.1.8 apache13/src/main/util_script.c:1.12 *** apache13/src/main/util_script.c:1.1.1.8 Wed Jan 31 21:27:02 2001 --- apache13/src/main/util_script.c Wed Jan 31 22:37:31 2001 *************** *** 67,72 **** --- 67,73 ---- #include "http_request.h" /* for sub_req_lookup_uri() */ #include "util_script.h" #include "util_date.h" /* For parseHTTPdate() */ + #include "sa_len.h" #ifdef OS2 #define INCL_DOS *************** *** 208,213 **** --- 209,215 ---- array_header *hdrs_arr = ap_table_elts(r->headers_in); table_entry *hdrs = (table_entry *) hdrs_arr->elts; int i; + char servbuf[NI_MAXSERV]; /* use a temporary table which we'll overlap onto * r->subprocess_env later *************** *** 298,305 **** ap_table_addn(e, "SERVER_ADMIN", s->server_admin); /* Apache */ ap_table_addn(e, "SCRIPT_FILENAME", r->filename); /* Apache */ ! ap_table_addn(e, "REMOTE_PORT", ! ap_psprintf(r->pool, "%d", ntohs(c->remote_addr.sin_port))); if (c->user) { ap_table_addn(e, "REMOTE_USER", c->user); --- 300,315 ---- ap_table_addn(e, "SERVER_ADMIN", s->server_admin); /* Apache */ ap_table_addn(e, "SCRIPT_FILENAME", r->filename); /* Apache */ ! servbuf[0] = '\0'; ! if (!getnameinfo((struct sockaddr *)&c->remote_addr, ! #ifndef HAVE_SOCKADDR_LEN ! SA_LEN((struct sockaddr *)&c->remote_addr), ! #else ! c->remote_addr.ss_len, ! #endif ! NULL, 0, servbuf, sizeof(servbuf), NI_NUMERICSERV)){ ! ap_table_addn(e, "REMOTE_PORT", ap_pstrdup(r->pool, servbuf)); ! } if (c->user) { ap_table_addn(e, "REMOTE_USER", c->user); Index: apache13/src/main/util_uri.c diff -c apache13/src/main/util_uri.c:1.1.1.5 apache13/src/main/util_uri.c:1.5 *** apache13/src/main/util_uri.c:1.1.1.5 Thu Mar 1 11:40:38 2001 --- apache13/src/main/util_uri.c Thu Mar 1 12:14:19 2001 *************** *** 605,649 **** * &hostinfo[-1] < &hostinfo[0] ... and this loop is valid C. */ do { ! --s; } while (s >= hostinfo && *s != '@'); if (s < hostinfo) { ! /* again we want the common case to be fall through */ ! deal_with_host: ! /* We expect hostinfo to point to the first character of ! * the hostname. If there's a port it is the first colon. ! */ ! s = memchr(hostinfo, ':', uri - hostinfo); ! if (s == NULL) { ! /* we expect the common case to have no port */ ! uptr->hostname = ap_pstrndup(p, hostinfo, uri - hostinfo); ! goto deal_with_path; ! } ! uptr->hostname = ap_pstrndup(p, hostinfo, s - hostinfo); ! ++s; ! uptr->port_str = ap_pstrndup(p, s, uri - s); ! if (uri != s) { ! port = strtol(uptr->port_str, &endstr, 10); ! uptr->port = port; ! if (*endstr == '\0') { ! goto deal_with_path; ! } ! /* Invalid characters after ':' found */ ! return HTTP_BAD_REQUEST; ! } ! uptr->port = ap_default_port_for_scheme(uptr->scheme); ! goto deal_with_path; } /* first colon delimits username:password */ s1 = memchr(hostinfo, ':', s - hostinfo); if (s1) { ! uptr->user = ap_pstrndup(p, hostinfo, s1 - hostinfo); ! ++s1; ! uptr->password = ap_pstrndup(p, s1, s - s1); } else { ! uptr->user = ap_pstrndup(p, hostinfo, s - hostinfo); } hostinfo = s + 1; goto deal_with_host; --- 605,654 ---- * &hostinfo[-1] < &hostinfo[0] ... and this loop is valid C. */ do { ! --s; } while (s >= hostinfo && *s != '@'); if (s < hostinfo) { ! /* again we want the common case to be fall through */ ! deal_with_host: ! /* We expect hostinfo to point to the first character of ! * the hostname. If there's a port it is the first colon. ! */ ! if (*hostinfo == '[') { ! s = memchr(hostinfo+1, ']', uri - hostinfo - 1); ! if (s) ! s = strchr(s, ':'); ! } else ! s = memchr(hostinfo, ':', uri - hostinfo); ! if (s == NULL) { ! /* we expect the common case to have no port */ ! uptr->hostname = ap_pstrndup(p, hostinfo, uri - hostinfo); ! goto deal_with_path; ! } ! uptr->hostname = ap_pstrndup(p, hostinfo, s - hostinfo); ! ++s; ! uptr->port_str = ap_pstrndup(p, s, uri - s); ! if (uri != s) { ! port = strtol(uptr->port_str, &endstr, 10); ! uptr->port = port; ! if (*endstr == '\0') { ! goto deal_with_path; ! } ! /* Invalid characters after ':' found */ ! return HTTP_BAD_REQUEST; ! } ! uptr->port = ap_default_port_for_scheme(uptr->scheme); ! goto deal_with_path; } /* first colon delimits username:password */ s1 = memchr(hostinfo, ':', s - hostinfo); if (s1) { ! uptr->user = ap_pstrndup(p, hostinfo, s1 - hostinfo); ! ++s1; ! uptr->password = ap_pstrndup(p, s1, s - s1); } else { ! uptr->user = ap_pstrndup(p, hostinfo, s - hostinfo); } hostinfo = s + 1; goto deal_with_host; *************** *** 670,676 **** /* We expect hostinfo to point to the first character of * the hostname. There must be a port, separated by a colon */ ! s = strchr(hostinfo, ':'); if (s == NULL) { return HTTP_BAD_REQUEST; } --- 675,686 ---- /* We expect hostinfo to point to the first character of * the hostname. There must be a port, separated by a colon */ ! if (*hostinfo == '[') { ! s = strchr(hostinfo+1, ']'); ! if (s) ! s = strchr(s, ':'); ! } else ! s = strchr(hostinfo, ':'); if (s == NULL) { return HTTP_BAD_REQUEST; } Index: apache13/src/modules/proxy/mod_proxy.c diff -c apache13/src/modules/proxy/mod_proxy.c:1.1.1.6 apache13/src/modules/proxy/mod_proxy.c:1.4 *** apache13/src/modules/proxy/mod_proxy.c:1.1.1.6 Wed Jan 31 21:27:03 2001 --- apache13/src/modules/proxy/mod_proxy.c Wed Jan 31 22:37:32 2001 *************** *** 490,500 **** struct proxy_remote *new; char *p, *q; int port; p = strchr(r, ':'); if (p == NULL || p[1] != '/' || p[2] != '/' || p[3] == '\0') return "ProxyRemote: Bad syntax for a remote proxy server"; ! q = strchr(p + 3, ':'); if (q != NULL) { if (sscanf(q + 1, "%u", &port) != 1 || port > 65535) return "ProxyRemote: Bad syntax for a remote proxy server (bad port number)"; --- 490,520 ---- struct proxy_remote *new; char *p, *q; int port; + char *bl = NULL, *br = NULL; p = strchr(r, ':'); if (p == NULL || p[1] != '/' || p[2] != '/' || p[3] == '\0') return "ProxyRemote: Bad syntax for a remote proxy server"; ! bl = p + 3; ! if (*bl == '['){ ! br = strrchr(bl+1, ']'); ! if (br){ ! bl++; ! *br = '\0'; ! if (*(br+1) == ':'){ /* [host]:xx */ ! q = br+1; ! } ! else if (*(br+1) == '\0'){ /* [host] */ ! q = NULL; ! } ! else ! q = strrchr(br, ':'); /* XXX */ ! } ! else ! q = strrchr(bl, ':'); /* XXX */ ! } ! else ! q = strrchr(bl, ':'); if (q != NULL) { if (sscanf(q + 1, "%u", &port) != 1 || port > 65535) return "ProxyRemote: Bad syntax for a remote proxy server (bad port number)"; *************** *** 505,511 **** *p = '\0'; if (strchr(f, ':') == NULL) ap_str_tolower(f); /* lowercase scheme */ ! ap_str_tolower(p + 3); /* lowercase hostname */ if (port == -1) { int i; --- 525,531 ---- *p = '\0'; if (strchr(f, ':') == NULL) ap_str_tolower(f); /* lowercase scheme */ ! ap_str_tolower(bl); /* lowercase hostname */ if (port == -1) { int i; *************** *** 518,524 **** new = ap_push_array(conf->proxies); new->scheme = f; new->protocol = r; ! new->hostname = p + 3; new->port = port; return NULL; } --- 538,544 ---- new = ap_push_array(conf->proxies); new->scheme = f; new->protocol = r; ! new->hostname = bl; new->port = port; return NULL; } Index: apache13/src/modules/proxy/mod_proxy.h diff -c apache13/src/modules/proxy/mod_proxy.h:1.1.1.6 apache13/src/modules/proxy/mod_proxy.h:1.7 *** apache13/src/modules/proxy/mod_proxy.h:1.1.1.6 Wed Jan 31 21:27:03 2001 --- apache13/src/modules/proxy/mod_proxy.h Wed Jan 31 22:37:32 2001 *************** *** 318,324 **** int ap_proxy_is_domainname(struct dirconn_entry *This, pool *p); int ap_proxy_is_hostname(struct dirconn_entry *This, pool *p); int ap_proxy_is_word(struct dirconn_entry *This, pool *p); ! int ap_proxy_doconnect(int sock, struct sockaddr_in *addr, request_rec *r); 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); --- 318,324 ---- int ap_proxy_is_domainname(struct dirconn_entry *This, pool *p); int ap_proxy_is_hostname(struct dirconn_entry *This, pool *p); int ap_proxy_is_word(struct dirconn_entry *This, pool *p); ! int ap_proxy_doconnect(int sock, struct sockaddr *addr, request_rec *r); 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); Index: apache13/src/modules/proxy/proxy_connect.c diff -c apache13/src/modules/proxy/proxy_connect.c:1.1.1.7 apache13/src/modules/proxy/proxy_connect.c:1.8 *** apache13/src/modules/proxy/proxy_connect.c:1.1.1.7 Wed Jan 31 21:27:03 2001 --- apache13/src/modules/proxy/proxy_connect.c Thu Mar 8 13:30:44 2001 *************** *** 116,129 **** const char *proxyhost, int proxyport) { struct sockaddr_in server; ! struct in_addr destaddr; ! struct hostent server_hp; ! const char *host, *err; char *p; int port, sock; char buffer[HUGE_STRING_LEN]; ! int nbytes, i, j; fd_set fds; void *sconf = r->server->module_config; proxy_server_conf *conf = --- 116,130 ---- const char *proxyhost, int proxyport) { struct sockaddr_in server; ! struct addrinfo hints, *res, *res0; ! const char *hoststr; ! const char *portstr = NULL; char *p; int port, sock; char buffer[HUGE_STRING_LEN]; ! int nbytes, i; fd_set fds; + int error; void *sconf = r->server->module_config; proxy_server_conf *conf = *************** *** 131,156 **** struct noproxy_entry *npent = (struct noproxy_entry *) conf->noproxies->elts; memset(&server, '\0', sizeof(server)); server.sin_family = AF_INET; /* Break the URL into host:port pairs */ ! host = url; p = strchr(url, ':'); ! if (p == NULL) ! port = DEFAULT_HTTPS_PORT; ! else { ! port = atoi(p + 1); *p = '\0'; } /* check if ProxyBlock directive on this host */ - destaddr.s_addr = ap_inet_addr(host); for (i = 0; i < conf->noproxies->nelts; i++) { ! if ((npent[i].name != NULL && strstr(host, npent[i].name) != NULL) ! || destaddr.s_addr == npent[i].addr.s_addr || npent[i].name[0] == '*') return ap_proxyerror(r, HTTP_FORBIDDEN, "Connect to remote machine blocked"); } /* Check if it is an allowed port */ --- 132,191 ---- struct noproxy_entry *npent = (struct noproxy_entry *) conf->noproxies->elts; memset(&server, '\0', sizeof(server)); + #ifdef HAVE_SOCKADDR_LEN + server.sin_len = sizeof(server); + #endif server.sin_family = AF_INET; /* Break the URL into host:port pairs */ ! hoststr = url; p = strchr(url, ':'); ! if (p == NULL) { ! char pbuf[32]; ! ap_snprintf(pbuf, sizeof(pbuf), "%d", DEFAULT_HTTPS_PORT); ! portstr = pbuf; ! } else { ! portstr = p + 1; *p = '\0'; } + port = atoi(portstr); + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + error = getaddrinfo(hoststr, portstr, &hints, &res0); + if (error && proxyhost == NULL) { + return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, + gai_strerror(error)); /* give up */ + } + /* check if ProxyBlock directive on this host */ for (i = 0; i < conf->noproxies->nelts; i++) { ! int fail; ! struct sockaddr_in *sin; ! ! fail = 0; ! if (npent[i].name != NULL && strstr(hoststr, npent[i].name)) ! fail++; ! if (npent[i].name != NULL && strcmp(npent[i].name, "*") == 0) ! fail++; ! for (res = res0; res; res = res->ai_next) { ! switch (res->ai_family) { ! case AF_INET: ! sin = (struct sockaddr_in *)res->ai_addr; ! if (sin->sin_addr.s_addr == npent[i].addr.s_addr) ! fail++; ! break; ! } ! } ! if (fail) { ! if (res0 != NULL) ! freeaddrinfo(res0); return ap_proxyerror(r, HTTP_FORBIDDEN, "Connect to remote machine blocked"); + } } /* Check if it is an allowed port */ *************** *** 161,219 **** case DEFAULT_SNEWS_PORT: break; default: return HTTP_FORBIDDEN; } ! } else if(!allowed_port(conf, port)) return HTTP_FORBIDDEN; if (proxyhost) { Explain2("CONNECT to remote proxy %s on port %d", proxyhost, proxyport); } else { ! Explain2("CONNECT to %s on port %d", host, port); } - - server.sin_port = (proxyport ? htons(proxyport) : htons(port)); - err = ap_proxy_host2addr(proxyhost ? proxyhost : host, &server_hp); ! if (err != NULL) ! return ap_proxyerror(r, ! proxyhost ? HTTP_BAD_GATEWAY : HTTP_INTERNAL_SERVER_ERROR, ! err); ! ! sock = ap_psocket(r->pool, PF_INET, SOCK_STREAM, IPPROTO_TCP); ! if (sock == -1) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, r, ! "proxy: error creating socket"); ! return HTTP_INTERNAL_SERVER_ERROR; ! } #ifdef CHECK_FD_SETSIZE ! if (sock >= FD_SETSIZE) { ! ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL, ! "proxy_connect_handler: filedescriptor (%u) " ! "larger than FD_SETSIZE (%u) " ! "found, you probably need to rebuild Apache with a " ! "larger FD_SETSIZE", sock, FD_SETSIZE); ! ap_pclosesocket(r->pool, sock); ! return HTTP_INTERNAL_SERVER_ERROR; ! } #endif ! j = 0; ! while (server_hp.h_addr_list[j] != NULL) { ! memcpy(&server.sin_addr, server_hp.h_addr_list[j], ! sizeof(struct in_addr)); ! i = ap_proxy_doconnect(sock, &server, r); if (i == 0) break; - j++; } if (i == -1) { ap_pclosesocket(r->pool, sock); ! return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, ap_pstrcat(r->pool, ! "Could not connect to remote machine:
", ! strerror(errno), NULL)); } /* If we are connecting through a remote proxy, we need to pass --- 196,262 ---- case DEFAULT_SNEWS_PORT: break; default: + if (res0 != NULL) + freeaddrinfo(res0); return HTTP_FORBIDDEN; } ! } else if(!allowed_port(conf, port)) { ! if (res0 == NULL) ! freeaddrinfo(res0); return HTTP_FORBIDDEN; + } if (proxyhost) { + char pbuf[10]; + + if (res0 != NULL) + freeaddrinfo(res0); + + ap_snprintf(pbuf, sizeof(pbuf), "%d", proxyport); + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + error = getaddrinfo(proxyhost, pbuf, &hints, &res0); + if (error) + return HTTP_INTERNAL_SERVER_ERROR; /* XXX */ + Explain2("CONNECT to remote proxy %s on port %d", proxyhost, proxyport); } else { ! Explain2("CONNECT to %s on port %d", hoststr, port); } ! 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); ! if (sock == -1) ! continue; #ifdef CHECK_FD_SETSIZE ! if (sock >= FD_SETSIZE) { ! ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL, ! "proxy_connect_handler: filedescriptor (%u) " ! "larger than FD_SETSIZE (%u) " ! "found, you probably need to rebuild Apache with a " ! "larger FD_SETSIZE. Anyway try to open next socket.", ! sock, FD_SETSIZE); ! ap_pclosesocket(r->pool, sock); ! continue; ! } #endif ! i = ap_proxy_doconnect(sock, res->ai_addr, r); if (i == 0) break; } + freeaddrinfo(res0); if (i == -1) { ap_pclosesocket(r->pool, sock); ! return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, ! ap_pstrcat(r->pool, ! "Could not connect to remote machine:
", ! strerror(errno), NULL)); } /* If we are connecting through a remote proxy, we need to pass Index: apache13/src/modules/proxy/proxy_ftp.c diff -c apache13/src/modules/proxy/proxy_ftp.c:1.1.1.8 apache13/src/modules/proxy/proxy_ftp.c:1.18 *** apache13/src/modules/proxy/proxy_ftp.c:1.1.1.8 Thu Mar 1 11:40:39 2001 --- apache13/src/modules/proxy/proxy_ftp.c Thu Mar 1 12:14:20 2001 *************** *** 62,67 **** --- 62,68 ---- #include "http_main.h" #include "http_log.h" #include "http_core.h" + #include "sa_len.h" #define AUTODETECT_PWD *************** *** 453,460 **** const char *err; int port, i, j, len, sock, dsock, rc, nocache = 0; int csd = 0; ! struct sockaddr_in server; ! struct hostent server_hp; struct in_addr destaddr; table *resp_hdrs; BUFF *f; --- 454,463 ---- const char *err; int port, i, j, len, sock, dsock, rc, nocache = 0; int csd = 0; ! struct sockaddr_storage server; ! struct addrinfo hints, *res, *res0; ! char portbuf[10]; ! int error; struct in_addr destaddr; table *resp_hdrs; BUFF *f; *************** *** 475,485 **** unsigned int presult, h0, h1, h2, h3, p0, p1; unsigned int paddr; unsigned short pport; ! struct sockaddr_in data_addr; int pasvmode = 0; char pasv[64]; char *pstr; /* stuff for responses */ char resp[MAX_STRING_LEN]; char *size = NULL; --- 478,495 ---- unsigned int presult, h0, h1, h2, h3, p0, p1; unsigned int paddr; unsigned short pport; ! struct sockaddr_storage data_addr; ! struct sockaddr_in *sin; int pasvmode = 0; char pasv[64]; char *pstr; + /* stuff for LPSV/EPSV */ + unsigned int paf, holen, ho[16], polen, po[2]; + struct sockaddr_in6 *sin6; + int lpsvmode = 0; + char *cmd; + /* stuff for responses */ char resp[MAX_STRING_LEN]; char *size = NULL; *************** *** 549,610 **** if (parms != NULL) *(parms++) = '\0'; ! memset(&server, 0, sizeof(struct sockaddr_in)); ! server.sin_family = AF_INET; ! server.sin_port = htons(port); ! err = ap_proxy_host2addr(host, &server_hp); ! if (err != NULL) ! return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, err); - sock = ap_psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP); - if (sock == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, r, - "proxy: error creating socket"); - return HTTP_INTERNAL_SERVER_ERROR; - } - #if !defined(TPF) && !defined(BEOS) ! 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) { #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; #endif /*_OSD_POSIX*/ - } - - #ifdef SINIX_D_RESOLVER_BUG - { - struct in_addr *ip_addr = (struct in_addr *) *server_hp.h_addr_list; - - for (; ip_addr->s_addr != 0; ++ip_addr) { - memcpy(&server.sin_addr, ip_addr, sizeof(struct in_addr)); - i = ap_proxy_doconnect(sock, &server, r); - if (i == 0) - break; } ! } ! #else ! j = 0; ! while (server_hp.h_addr_list[j] != NULL) { ! memcpy(&server.sin_addr, server_hp.h_addr_list[j], ! sizeof(struct in_addr)); ! i = ap_proxy_doconnect(sock, &server, r); ! if (i == 0) break; ! j++; } ! #endif if (i == -1) { ap_pclosesocket(p, sock); return ap_proxyerror(r, HTTP_BAD_GATEWAY, ap_pstrcat(r->pool, --- 559,610 ---- if (parms != NULL) *(parms++) = '\0'; ! ap_snprintf(portbuf, sizeof(portbuf), "%d", port); ! memset(&hints, 0, sizeof(hints)); ! hints.ai_family = PF_UNSPEC; ! hints.ai_socktype = SOCK_STREAM; ! error = getaddrinfo(host, portbuf, &hints, &res0); ! if (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); ! if (sock == -1) ! continue; #if !defined(TPF) && !defined(BEOS) ! 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) { #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); ! freeaddrinfo(res0); ! return HTTP_INTERNAL_SERVER_ERROR; #endif /*_OSD_POSIX*/ } ! ! i = ap_proxy_doconnect(sock, res->ai_addr, r); ! if (i == 0){ ! memcpy(&server, res->ai_addr, res->ai_addrlen); break; ! } ! ap_pclosesocket(p, sock); } ! freeaddrinfo(res0); if (i == -1) { ap_pclosesocket(p, sock); return ap_proxyerror(r, HTTP_BAD_GATEWAY, ap_pstrcat(r->pool, *************** *** 808,814 **** } /* try to set up PASV data connection first */ ! dsock = ap_psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP); if (dsock == -1) { ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "proxy: error creating PASV socket"); --- 808,814 ---- } /* try to set up PASV data connection first */ ! dsock = ap_psocket(p, server.ss_family, SOCK_STREAM, IPPROTO_TCP); if (dsock == -1) { ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "proxy: error creating PASV socket"); *************** *** 827,837 **** } #endif ! ap_bputs("PASV" CRLF, f); ap_bflush(f); ! Explain0("FTP: PASV command issued"); /* possible results: 227, 421, 500, 501, 502, 530 */ /* 227 Entering Passive Mode (h1,h2,h3,h4,p1,p2). */ /* 421 Service not available, closing control connection. */ /* 500 Syntax error, command unrecognized. */ /* 501 Syntax error in parameters or arguments. */ --- 827,847 ---- } #endif ! lpsvagain: ! if (server.ss_family == AF_INET) ! cmd = "PASV"; ! else if (lpsvmode) ! cmd = "LPSV"; ! else ! cmd = "EPSV"; ! ap_bputs(cmd, f); ! ap_bputs(CRLF, f); ap_bflush(f); ! Explain0("FTP: passive command issued"); /* possible results: 227, 421, 500, 501, 502, 530 */ /* 227 Entering Passive Mode (h1,h2,h3,h4,p1,p2). */ + /* 228 Entering Long Passive Mode (...). */ + /* 229 Entering Extended Passive Mode (...). */ /* 421 Service not available, closing control connection. */ /* 500 Syntax error, command unrecognized. */ /* 501 Syntax error in parameters or arguments. */ *************** *** 840,846 **** i = ap_bgets(pasv, sizeof(pasv), f); if (i == -1) { ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r, ! "PASV: control connection is toast"); ap_pclosesocket(p, dsock); ap_bclose(f); ap_kill_timeout(r); --- 850,856 ---- i = ap_bgets(pasv, sizeof(pasv), f); if (i == -1) { ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r, ! "%s: control connection is toast", cmd); ap_pclosesocket(p, dsock); ap_bclose(f); ap_kill_timeout(r); *************** *** 872,881 **** pport = (p1 << 8) + p0; Explain5("FTP: contacting host %d.%d.%d.%d:%d", h3, h2, h1, h0, pport); ! data_addr.sin_family = AF_INET; ! data_addr.sin_addr.s_addr = htonl(paddr); ! data_addr.sin_port = htons(pport); ! i = ap_proxy_doconnect(dsock, &data_addr, r); if (i == -1) { ap_kill_timeout(r); --- 882,895 ---- pport = (p1 << 8) + p0; Explain5("FTP: contacting host %d.%d.%d.%d:%d", h3, h2, h1, h0, pport); ! sin = (struct sockaddr_in *)&data_addr; ! sin->sin_family = AF_INET; ! #ifdef SIN6_LEN ! sin->sin_len = sizeof(*sin); ! #endif ! sin->sin_addr.s_addr = htonl(paddr); ! sin->sin_port = htons(pport); ! i = ap_proxy_doconnect(dsock, (struct sockaddr *)&data_addr, r); if (i == -1) { ap_kill_timeout(r); *************** *** 883,899 **** ap_pstrcat(r->pool, "Could not connect to remote machine: ", strerror(errno), NULL)); } ! else { pasvmode = 1; } } else ap_pclosesocket(p, dsock); /* and try the regular way */ } if (!pasvmode) { /* set up data connection */ ! clen = sizeof(struct sockaddr_in); if (getsockname(sock, (struct sockaddr *) &server, &clen) < 0) { ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "proxy: error getting socket address"); --- 897,972 ---- ap_pstrcat(r->pool, "Could not connect to remote machine: ", strerror(errno), NULL)); + } else { + pasvmode = 1; } ! } else if (presult == 228 && pstr != NULL ! && sscanf(pstr, ! "%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u", ! &paf, &holen, &ho[0], &ho[1], &ho[2], &ho[3], ! &ho[4], &ho[5], &ho[6], &ho[7], &ho[8], &ho[9], &ho[10], &ho[11], ! &ho[12], &ho[13], &ho[14], &ho[15], &polen, &po[0], &po[1]) == 21 ! && paf == 6 && holen == 16 && polen == 2) { ! int i; ! sin6 = (struct sockaddr_in6 *)&data_addr; ! sin6->sin6_family = AF_INET6; ! #ifdef SIN6_LEN ! sin6->sin6_len = sizeof(*sin6); ! #endif ! for (i = 0; i < 16; i++) ! sin6->sin6_addr.s6_addr[i] = ho[i] & 0xff; ! sin6->sin6_port = htons(((po[0] & 0xff) << 8) | (po[1] & 0xff)); ! i = ap_proxy_doconnect(dsock, (struct sockaddr *)&data_addr, r); ! ! if (i == -1) { ! ap_kill_timeout(r); ! return ap_proxyerror(r, HTTP_BAD_GATEWAY, ! ap_pstrcat(r->pool, ! "Could not connect to remote machine: ", ! strerror(errno), NULL)); ! } else { ! pasvmode = 1; ! } ! } else if (presult == 229 && pstr != NULL ! && pstr[0] == pstr[1] && pstr[0] == pstr[2] ! && pstr[0] == pstr[strlen(pstr) - 1]) { ! /* expect "|||port|" */ ! #ifndef SIN6_LEN ! memcpy(&data_addr, &server, SA_LEN((struct sockaddr *)&server)); ! #else ! memcpy(&data_addr, &server, server.ss_len); ! #endif ! switch (data_addr.ss_family) { ! case AF_INET: ! sin = (struct sockaddr_in *)&data_addr; ! sin->sin_port = htons(atoi(pstr + 3)); ! break; ! case AF_INET6: ! sin6 = (struct sockaddr_in6 *)&data_addr; ! sin6->sin6_port = htons(atoi(pstr + 3)); ! break; ! } ! i = ap_proxy_doconnect(dsock, (struct sockaddr *)&data_addr, r); ! ! if (i == -1) { ! ap_kill_timeout(r); ! return ap_proxyerror(r, HTTP_BAD_GATEWAY, ! ap_pstrcat(r->pool, ! "Could not connect to remote machine: ", ! strerror(errno), NULL)); ! } else { pasvmode = 1; } + } else if (!lpsvmode && strcmp(cmd, "EPSV") == 0) { + lpsvmode = 1; + goto lpsvagain; } else ap_pclosesocket(p, dsock); /* and try the regular way */ } if (!pasvmode) { /* set up data connection */ ! clen = sizeof(server); if (getsockname(sock, (struct sockaddr *) &server, &clen) < 0) { ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "proxy: error getting socket address"); *************** *** 902,908 **** return HTTP_INTERNAL_SERVER_ERROR; } ! dsock = ap_psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP); if (dsock == -1) { ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "proxy: error creating socket"); --- 975,981 ---- return HTTP_INTERNAL_SERVER_ERROR; } ! dsock = ap_psocket(p, server.ss_family, SOCK_STREAM, IPPROTO_TCP); if (dsock == -1) { ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "proxy: error creating socket"); *************** *** 923,935 **** #endif /*_OSD_POSIX*/ } ! if (bind(dsock, (struct sockaddr *) &server, ! sizeof(struct sockaddr_in)) == -1) { ! char buff[22]; ! ap_snprintf(buff, sizeof(buff), "%s:%d", inet_ntoa(server.sin_addr), server.sin_port); ap_log_rerror(APLOG_MARK, APLOG_ERR, r, ! "proxy: error binding to ftp data socket %s", buff); ap_bclose(f); ap_pclosesocket(p, dsock); return HTTP_INTERNAL_SERVER_ERROR; --- 996,1021 ---- #endif /*_OSD_POSIX*/ } ! #ifndef SIN6_LEN ! if (bind(dsock, (struct sockaddr *) &server, SA_LEN((struct sockaddr *)&server)) == -1) ! #else ! if (bind(dsock, (struct sockaddr *) &server, server.ss_len) == -1) ! #endif ! { ! char hostnamebuf[MAXHOSTNAMELEN], portnamebuf[MAXHOSTNAMELEN]; ! getnameinfo((struct sockaddr *)&server, ! #ifndef SIN6_LEN ! SA_LEN((struct sockaddr *)&server), ! #else ! server.ss_len, ! #endif ! hostnamebuf, sizeof(hostnamebuf), ! portnamebuf, sizeof(portnamebuf), ! NI_NUMERICHOST | NI_NUMERICSERV); ap_log_rerror(APLOG_MARK, APLOG_ERR, r, ! "proxy: error binding to ftp data socket %s:%s", ! hostnamebuf, portnamebuf); ap_bclose(f); ap_pclosesocket(p, dsock); return HTTP_INTERNAL_SERVER_ERROR; *************** *** 1181,1187 **** if (!pasvmode) { /* wait for connection */ ap_hard_timeout("proxy ftp data connect", r); ! clen = sizeof(struct sockaddr_in); do csd = accept(dsock, (struct sockaddr *) &server, &clen); while (csd == -1 && errno == EINTR); --- 1267,1273 ---- if (!pasvmode) { /* wait for connection */ ap_hard_timeout("proxy ftp data connect", r); ! clen = sizeof(server); do csd = accept(dsock, (struct sockaddr *) &server, &clen); while (csd == -1 && errno == EINTR); Index: apache13/src/modules/proxy/proxy_http.c diff -c apache13/src/modules/proxy/proxy_http.c:1.1.1.8 apache13/src/modules/proxy/proxy_http.c:1.15 *** apache13/src/modules/proxy/proxy_http.c:1.1.1.8 Thu Mar 1 11:40:39 2001 --- apache13/src/modules/proxy/proxy_http.c Thu Mar 8 13:30:44 2001 *************** *** 177,195 **** array_header *reqhdrs_arr; table *resp_hdrs; table_entry *reqhdrs; - struct sockaddr_in server; - struct in_addr destaddr; - struct hostent server_hp; BUFF *f; char buffer[HUGE_STRING_LEN]; char portstr[32]; pool *p = r->pool; const long int zero = 0L; - int destport = 0; char *destportstr = NULL; const char *urlptr = NULL; const char *datestr; struct tbl_do_args tdo; void *sconf = r->server->module_config; proxy_server_conf *conf = --- 177,193 ---- array_header *reqhdrs_arr; table *resp_hdrs; table_entry *reqhdrs; BUFF *f; char buffer[HUGE_STRING_LEN]; char portstr[32]; pool *p = r->pool; const long int zero = 0L; char *destportstr = NULL; const char *urlptr = NULL; const char *datestr; struct tbl_do_args tdo; + struct addrinfo hints, *res, *res0; + int error; void *sconf = r->server->module_config; proxy_server_conf *conf = *************** *** 198,213 **** struct nocache_entry *ncent = (struct nocache_entry *) conf->nocaches->elts; int nocache = 0; - memset(&server, '\0', sizeof(server)); - server.sin_family = AF_INET; - /* We break the URL into host, port, path-search */ urlptr = strstr(url, "://"); if (urlptr == NULL) return HTTP_BAD_REQUEST; urlptr += 3; ! destport = DEFAULT_HTTP_PORT; strp = strchr(urlptr, '/'); if (strp == NULL) { desthost = ap_pstrdup(p, urlptr); --- 196,209 ---- struct nocache_entry *ncent = (struct nocache_entry *) conf->nocaches->elts; int nocache = 0; /* We break the URL into host, port, path-search */ urlptr = strstr(url, "://"); if (urlptr == NULL) return HTTP_BAD_REQUEST; urlptr += 3; ! ap_snprintf(portstr, sizeof(portstr), "%d", DEFAULT_HTTP_PORT); ! destportstr = portstr; strp = strchr(urlptr, '/'); if (strp == NULL) { desthost = ap_pstrdup(p, urlptr); *************** *** 221,298 **** desthost = q; } ! strp2 = strchr(desthost, ':'); if (strp2 != NULL) { *(strp2++) = '\0'; ! if (ap_isdigit(*strp2)) { ! destport = atoi(strp2); destportstr = strp2; - } } /* 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))) ! return ap_proxyerror(r, HTTP_FORBIDDEN, ! "Connect to remote machine blocked"); } if (proxyhost != NULL) { ! server.sin_port = htons(proxyport); ! err = ap_proxy_host2addr(proxyhost, &server_hp); ! if (err != NULL) return DECLINED; /* try another */ } - else { - server.sin_port = htons(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); ! if (sock == -1) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, r, ! "proxy: error creating socket"); ! return HTTP_INTERNAL_SERVER_ERROR; ! } #if !defined(TPF) && !defined(BEOS) ! if (conf->recv_buffer_size) { ! if (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 ! #ifdef SINIX_D_RESOLVER_BUG ! { ! struct in_addr *ip_addr = (struct in_addr *) *server_hp.h_addr_list; ! ! for (; ip_addr->s_addr != 0; ++ip_addr) { ! memcpy(&server.sin_addr, ip_addr, sizeof(struct in_addr)); ! i = ap_proxy_doconnect(sock, &server, r); ! if (i == 0) ! break; ! } ! } ! #else ! j = 0; ! while (server_hp.h_addr_list[j] != NULL) { ! memcpy(&server.sin_addr, server_hp.h_addr_list[j], ! sizeof(struct in_addr)); ! i = ap_proxy_doconnect(sock, &server, r); if (i == 0) break; ! j++; } ! #endif if (i == -1) { if (proxyhost != NULL) return DECLINED; /* try again another way */ --- 217,325 ---- desthost = q; } ! if (*desthost == '['){ ! char *u = strrchr(desthost+1, ']'); ! if (u){ ! desthost++; ! *u = '\0'; ! if (*(u+1) == ':'){ /* [host]:xx */ ! strp2 = u+1; ! } ! else if (*(u+1) == '\0'){ /* [host] */ ! strp2 = NULL; ! } ! else ! return HTTP_BAD_REQUEST; ! } ! else ! return HTTP_BAD_REQUEST; ! } ! else ! strp2 = strrchr(desthost, ':'); if (strp2 != NULL) { *(strp2++) = '\0'; ! if (ap_isdigit(*strp2)) destportstr = strp2; } + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + error = getaddrinfo(desthost, destportstr, &hints, &res0); + if (error && proxyhost == NULL) { + return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, + gai_strerror(error)); /* give up */ + } + + /* check if ProxyBlock directive on this host */ for (i = 0; i < conf->noproxies->nelts; i++) { ! int fail; ! struct sockaddr_in *sin; ! ! fail = 0; ! if (npent[i].name != NULL && strstr(desthost, npent[i].name)) ! fail++; ! if (npent[i].name != NULL && strcmp(npent[i].name, "*") == 0) ! fail++; ! for (res = res0; res; res = res->ai_next) { ! switch (res->ai_family) { ! case AF_INET: ! sin = (struct sockaddr_in *)res->ai_addr; ! if (sin->sin_addr.s_addr == npent[i].addr.s_addr) ! fail++; ! break; ! } ! } ! if (fail) { ! if (res0 != NULL) ! freeaddrinfo(res0); ! return ap_proxyerror(r, HTTP_FORBIDDEN, ! "Connect to remote machine blocked"); ! } } if (proxyhost != NULL) { ! char pbuf[10]; ! ! if (res0 != NULL) ! freeaddrinfo(res0); ! ! ap_snprintf(pbuf, sizeof(pbuf), "%d", proxyport); ! memset(&hints, 0, sizeof(hints)); ! hints.ai_family = PF_UNSPEC; ! hints.ai_socktype = SOCK_STREAM; ! hints.ai_protocol = IPPROTO_TCP; ! error = getaddrinfo(proxyhost, pbuf, &hints, &res0); ! if (error) return DECLINED; /* try another */ } ! sock = i = -1; ! for (res = res0; res; res = res->ai_next) { ! sock = ap_psocket(p, res->ai_family, res->ai_socktype, ! res->ai_protocol); ! if (sock < 0) ! continue; #if !defined(TPF) && !defined(BEOS) ! if (conf->recv_buffer_size) { ! if (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 ! i = ap_proxy_doconnect(sock, res->ai_addr, r); if (i == 0) break; ! ap_pclosesocket(p, sock); } ! freeaddrinfo(res0); if (i == -1) { if (proxyhost != NULL) return DECLINED; /* try again another way */ *************** *** 310,316 **** ap_hard_timeout("proxy send", r); ap_bvputs(f, r->method, " ", proxyhost ? url : urlptr, " HTTP/1.0" CRLF, NULL); ! if (destportstr != NULL && destport != DEFAULT_HTTP_PORT) ap_bvputs(f, "Host: ", desthost, ":", destportstr, CRLF, NULL); else ap_bvputs(f, "Host: ", desthost, CRLF, NULL); --- 337,343 ---- ap_hard_timeout("proxy send", r); ap_bvputs(f, r->method, " ", proxyhost ? url : urlptr, " HTTP/1.0" CRLF, NULL); ! if (destportstr != NULL && atoi(destportstr) != DEFAULT_HTTP_PORT) ap_bvputs(f, "Host: ", desthost, ":", destportstr, CRLF, NULL); else ap_bvputs(f, "Host: ", desthost, CRLF, NULL); *************** *** 472,488 **** ap_table_set(resp_hdrs, "URI", proxy_location_reverse_map(r, datestr)); /* check if NoCache directive on this host */ if (nocache == 0) { for (i = 0; i < conf->nocaches->nelts; i++) { ! if (destaddr.s_addr == ncent[i].addr.s_addr || ! (ncent[i].name != NULL && ! (ncent[i].name[0] == '*' || ! strstr(desthost, ncent[i].name) != NULL))) { ! nocache = 1; ! break; } } } i = ap_proxy_cache_update(c, resp_hdrs, !backasswards, nocache); if (i != DECLINED) { --- 499,529 ---- ap_table_set(resp_hdrs, "URI", proxy_location_reverse_map(r, datestr)); /* check if NoCache directive on this host */ + { + struct sockaddr_in *sin; + #ifdef INET6 + struct sockaddr_in6 *sin6; + #endif + if (nocache == 0) { for (i = 0; i < conf->nocaches->nelts; i++) { ! if (ncent[i].name != NULL && ! (ncent[i].name[0] == '*' || ! strstr(desthost, ncent[i].name) != NULL)) { ! nocache = 1; ! break; ! } ! switch (res->ai_addr->sa_family) { ! case AF_INET: ! sin = (struct sockaddr_in *)res->ai_addr; ! if (sin->sin_addr.s_addr == ncent[i].addr.s_addr) { ! nocache = 1; ! break; ! } } } } + } i = ap_proxy_cache_update(c, resp_hdrs, !backasswards, nocache); if (i != DECLINED) { Index: apache13/src/modules/proxy/proxy_util.c diff -c apache13/src/modules/proxy/proxy_util.c:1.1.1.9 apache13/src/modules/proxy/proxy_util.c:1.17 *** apache13/src/modules/proxy/proxy_util.c:1.1.1.9 Thu Mar 1 11:40:40 2001 --- apache13/src/modules/proxy/proxy_util.c Thu Mar 1 12:14:20 2001 *************** *** 64,69 **** --- 64,70 ---- #include "http_log.h" #include "util_uri.h" #include "util_date.h" /* get ap_checkmask() decl. */ + #include "sa_len.h" static int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r); static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r); *************** *** 218,223 **** --- 219,225 ---- int i; char *strp, *host, *url = *urlp; char *user = NULL, *password = NULL; + char *t = NULL, *u = NULL, *v = NULL; if (url[0] != '/' || url[1] != '/') return "Malformed URL"; *************** *** 256,266 **** *passwordp = password; } ! strp = strrchr(host, ':'); ! if (strp != NULL) { ! *(strp++) = '\0'; ! ! for (i = 0; strp[i] != '\0'; i++) if (!ap_isdigit(strp[i])) break; --- 258,279 ---- *passwordp = password; } ! v = host; ! if (*host == '['){ ! u = strrchr(host, ']'); ! if (u){ ! host++; ! *u = '\0'; ! v = u + 1; ! } ! } ! t = strrchr(v, ':'); ! if (t){ ! *t = '\0'; ! strp = t + 1; ! } ! if (strp){ ! for (i=0; strp[i] != '\0'; i++) if (!ap_isdigit(strp[i])) break; *************** *** 278,294 **** return "Missing host in URL"; /* check hostname syntax */ for (i = 0; host[i] != '\0'; i++) ! if (!ap_isdigit(host[i]) && host[i] != '.') break; /* must be an IP address */ #if defined(WIN32) || defined(NETWARE) || defined(TPF) || defined(BEOS) if (host[i] == '\0' && (inet_addr(host) == -1)) #else ! if (host[i] == '\0' && (ap_inet_addr(host) == -1 || inet_network(host) == -1)) #endif ! { ! return "Bad IP address in URL"; } /* if (strchr(host,'.') == NULL && domain != NULL) host = pstrcat(p, host, domain, NULL); --- 291,319 ---- return "Missing host in URL"; /* check hostname syntax */ for (i = 0; host[i] != '\0'; i++) ! if (!ap_isxdigit(host[i]) && host[i] != '.' && host[i] != ':') break; /* must be an IP address */ #if defined(WIN32) || defined(NETWARE) || defined(TPF) || defined(BEOS) if (host[i] == '\0' && (inet_addr(host) == -1)) + return "Bad IP address in URL"; + #else + if (host[i] == '\0') { + struct addrinfo hints, *res0; + int gai; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_flags = AI_NUMERICHOST; + if (gai = getaddrinfo(host, NULL, &hints, &res0)) { + #if 0 + return gai_strerror(gai); #else ! return "Bad IP address in URL"; #endif ! } ! freeaddrinfo(res0); } + #endif /* if (strchr(host,'.') == NULL && domain != NULL) host = pstrcat(p, host, domain, NULL); *************** *** 1238,1259 **** return host != NULL && strstr(host, This->name) != NULL; } ! int ap_proxy_doconnect(int sock, struct sockaddr_in *addr, request_rec *r) { int i; ap_hard_timeout("proxy connect", r); do { ! i = connect(sock, (struct sockaddr *) addr, sizeof(struct sockaddr_in)); #if defined(WIN32) || defined(NETWARE) if (i == SOCKET_ERROR) errno = WSAGetLastError(); #endif /* WIN32 */ } while (i == -1 && errno == EINTR); if (i == -1) { ap_log_rerror(APLOG_MARK, APLOG_ERR, r, ! "proxy connect to %s port %d failed", ! inet_ntoa(addr->sin_addr), ntohs(addr->sin_port)); } ap_kill_timeout(r); --- 1263,1307 ---- return host != NULL && strstr(host, This->name) != NULL; } ! int ap_proxy_doconnect(int sock, struct sockaddr *addr, request_rec *r) { int i; + int salen; + char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; + #ifdef NI_WITHSCOPEID + const int niflags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID; + #else + const int niflags = NI_NUMERICHOST | NI_NUMERICSERV; + #endif ap_hard_timeout("proxy connect", r); + #ifdef HAVE_SOCKADDR_LEN + salen = addr->sa_len; + #else + switch (addr->sa_family) { + case AF_INET6: + salen = sizeof(struct sockaddr_in6); + break; + default: + salen = sizeof(struct sockaddr_in); + break; + } + #endif do { ! i = connect(sock, addr, salen); #if defined(WIN32) || defined(NETWARE) if (i == SOCKET_ERROR) errno = WSAGetLastError(); #endif /* WIN32 */ } while (i == -1 && errno == EINTR); if (i == -1) { + if (getnameinfo(addr, salen, hbuf, sizeof(hbuf), pbuf, sizeof(pbuf), + niflags) != 0) { + strcpy(hbuf, "?"); + strcpy(pbuf, "?"); + } ap_log_rerror(APLOG_MARK, APLOG_ERR, r, ! "proxy connect to %s port %s failed", hbuf, pbuf); } ap_kill_timeout(r); Index: apache13/src/modules/standard/mod_access.c diff -c apache13/src/modules/standard/mod_access.c:1.1.1.4 apache13/src/modules/standard/mod_access.c:1.18 *** apache13/src/modules/standard/mod_access.c:1.1.1.4 Wed Jan 31 21:27:03 2001 --- apache13/src/modules/standard/mod_access.c Wed Jan 31 22:37:33 2001 *************** *** 74,80 **** T_ALL, T_IP, T_HOST, ! T_FAIL }; typedef struct { --- 74,83 ---- T_ALL, T_IP, T_HOST, ! T_FAIL, ! #ifdef INET6 ! T_IP6, ! #endif }; typedef struct { *************** *** 82,90 **** union { char *from; struct { ! unsigned long net; ! unsigned long mask; } ip; } x; enum allowdeny_type type; } allowdeny; --- 85,99 ---- union { char *from; struct { ! struct in_addr net; ! struct in_addr mask; } ip; + #ifdef INET6 + struct { + struct in6_addr net6; + struct in6_addr mask6; + } ip6; + #endif } x; enum allowdeny_type type; } allowdeny; *************** *** 167,256 **** } else if ((s = strchr(where, '/'))) { ! unsigned long mask; ! a->type = T_IP; /* trample on where, we won't be using it any more */ *s++ = '\0'; ! if (!is_ip(where) ! || (a->x.ip.net = ap_inet_addr(where)) == INADDR_NONE) { 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)) { a->type = T_FAIL; ! return "syntax error in mask portion of network/netmask"; } ! /* is it in /a.b.c.d form? */ ! if (strchr(s, '.')) { ! mask = ap_inet_addr(s); ! if (mask == INADDR_NONE) { 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); ! } ! a->x.ip.mask = mask; ! a->x.ip.net = (a->x.ip.net & mask); /* 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 */ ! int shift; ! char *t; ! int octet; ! ! a->type = T_IP; ! /* parse components */ ! s = where; ! a->x.ip.net = 0; ! a->x.ip.mask = 0; ! shift = 24; ! while (*s) { ! t = s; ! if (!ap_isdigit(*t)) { a->type = T_FAIL; ! return "invalid ip address"; } ! while (ap_isdigit(*t)) { ! ++t; ! } ! if (*t == '.') { ! *t++ = 0; ! } ! else if (*t) { a->type = T_FAIL; ! return "invalid ip address"; } ! if (shift < 0) { ! return "invalid ip address, only 4 octets allowed"; } ! octet = atoi(s); ! if (octet < 0 || octet > 255) { ! a->type = T_FAIL; ! return "each octet must be between 0 and 255 inclusive"; } - a->x.ip.net |= octet << shift; - a->x.ip.mask |= 0xFFUL << shift; - s = t; - shift -= 8; } - a->x.ip.net = ntohl(a->x.ip.net); - a->x.ip.mask = ntohl(a->x.ip.mask); } else { ! a->type = T_HOST; } return NULL; --- 176,405 ---- } else if ((s = strchr(where, '/'))) { ! struct addrinfo hints, *resnet, *resmask; ! struct sockaddr_storage net, mask; ! int error; ! char *p; ! int justdigits; ! a->type = T_FAIL; /*just in case*/ /* trample on where, we won't be using it any more */ *s++ = '\0'; + + justdigits = 0; + for (p = s; *p; p++) { + if (!isdigit(*p)) + break; + } + if (!*p) + justdigits++; ! memset(&hints, 0, sizeof(hints)); ! hints.ai_family = PF_UNSPEC; ! hints.ai_socktype = SOCK_STREAM; /*dummy*/ ! #ifdef AI_NUMERICHOST ! hints.ai_flags = AI_NUMERICHOST; /*don't resolve*/ ! #endif ! resnet = NULL; ! error = getaddrinfo(where, NULL, &hints, &resnet); ! if (error || !resnet) { ! if (resnet) ! freeaddrinfo(resnet); a->type = T_FAIL; return "syntax error in network portion of network/netmask"; } + if (resnet->ai_next) { + freeaddrinfo(resnet); + a->type = T_FAIL; + return "network/netmask resolved to multiple addresses"; + } + memcpy(&net, resnet->ai_addr, resnet->ai_addrlen); + freeaddrinfo(resnet); ! switch (net.ss_family) { ! case AF_INET: ! a->type = T_IP; ! a->x.ip.net.s_addr = ((struct sockaddr_in *)&net)->sin_addr.s_addr; ! break; ! #ifdef INET6 ! case AF_INET6: ! a->type = T_IP6; ! memcpy(&a->x.ip6.net6, &((struct sockaddr_in6 *)&net)->sin6_addr, ! sizeof(a->x.ip6.net6)); ! break; ! #endif ! default: a->type = T_FAIL; ! return "unknown address family for network"; } ! ! if (!justdigits) { ! memset(&hints, 0, sizeof(hints)); ! hints.ai_family = PF_UNSPEC; ! hints.ai_socktype = SOCK_STREAM; /*dummy*/ ! #ifdef AI_NUMERICHOST ! hints.ai_flags = AI_NUMERICHOST; /*don't resolve*/ ! #endif ! resmask = NULL; ! error = getaddrinfo(s, NULL, &hints, &resmask); ! if (error || !resmask) { ! if (resmask) ! freeaddrinfo(resmask); a->type = T_FAIL; return "syntax error in mask portion of network/netmask"; } ! if (resmask->ai_next) { ! freeaddrinfo(resmask); a->type = T_FAIL; ! return "network/netmask resolved to multiple addresses"; } ! memcpy(&mask, resmask->ai_addr, resmask->ai_addrlen); ! freeaddrinfo(resmask); ! ! if (net.ss_family != mask.ss_family) { a->type = T_FAIL; ! return "network/netmask resolved to different address family"; } ! ! switch (a->type) { ! case T_IP: ! a->x.ip.mask.s_addr = ! ((struct sockaddr_in *)&mask)->sin_addr.s_addr; ! break; ! #ifdef INET6 ! case T_IP6: ! memcpy(&a->x.ip6.mask6, ! &((struct sockaddr_in6 *)&mask)->sin6_addr, ! sizeof(a->x.ip6.mask6)); ! break; ! #endif } ! } else { ! int mask; ! mask = atoi(s); ! switch (a->type) { ! case T_IP: ! if (mask < 0 || 32 < mask) { ! a->type = T_FAIL; ! return "netmask out of range"; ! } ! a->x.ip.mask.s_addr = htonl(0xFFFFFFFFUL << (32 - mask)); ! break; ! #ifdef INET6 ! case T_IP6: ! { ! int i; ! if (mask < 0 || 128 < mask) { ! a->type = T_FAIL; ! return "netmask out of range"; ! } ! for (i = 0; i < mask / 8; i++) { ! a->x.ip6.mask6.s6_addr[i] = 0xff; ! } ! if (mask % 8) ! a->x.ip6.mask6.s6_addr[i] = 0xff << (8 - (mask % 8)); ! break; ! } ! #endif } } } else { ! struct addrinfo hints, *res; ! struct sockaddr_storage ss; ! int error; ! ! a->type = T_FAIL; /*just in case*/ ! ! /* First, try using the old apache code to match */ ! /* legacy syntax for ip addrs: a.b.c. ==> a.b.c.0/24 for example */ ! if (ap_isdigit(*where) && is_ip(where)) { ! int shift; ! char *t; ! int octet; ! ! a->type = T_IP; ! /* parse components */ ! s = where; ! a->x.ip.net.s_addr = 0; ! a->x.ip.mask.s_addr = 0; ! shift = 24; ! while (*s) { ! t = s; ! if (!ap_isdigit(*t)) { ! a->type = T_FAIL; ! return "invalid ip address"; ! } ! while (ap_isdigit(*t)) { ! ++t; ! } ! if (*t == '.') { ! *t++ = 0; ! } ! else if (*t) { ! a->type = T_FAIL; ! return "invalid ip address"; ! } ! if (shift < 0) { ! return "invalid ip address, only 4 octets allowed"; ! } ! octet = atoi(s); ! if (octet < 0 || octet > 255) { ! 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.mask.s_addr |= 0xFFUL << shift; ! s = t; ! shift -= 8; ! } ! 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); ! ! return NULL; ! } ! ! /* IPv4/v6 numeric address */ ! memset(&hints, 0, sizeof(hints)); ! hints.ai_family = PF_UNSPEC; ! hints.ai_socktype = SOCK_STREAM; /*dummy*/ ! #ifdef AI_NUMERICHOST ! hints.ai_flags = AI_NUMERICHOST; /*don't resolve*/ ! #endif ! res = NULL; ! error = getaddrinfo(where, NULL, &hints, &res); ! if (error || !res) { ! if (res) ! freeaddrinfo(res); ! a->type = T_HOST; ! return NULL; ! } ! if (res->ai_next) { ! freeaddrinfo(res); ! a->type = T_FAIL; ! return "network/netmask resolved to multiple addresses"; ! } ! memcpy(&ss, res->ai_addr, res->ai_addrlen); ! freeaddrinfo(res); ! ! switch (ss.ss_family) { ! case AF_INET: ! a->type = T_IP; ! a->x.ip.net.s_addr = ((struct sockaddr_in *)&ss)->sin_addr.s_addr; ! memset(&a->x.ip.mask, 0xff, sizeof(a->x.ip.mask)); ! break; ! #ifdef INET6 ! case AF_INET6: ! a->type = T_IP6; ! memcpy(&a->x.ip6.net6, &((struct sockaddr_in6 *)&ss)->sin6_addr, ! sizeof(a->x.ip6.net6)); ! memset(&a->x.ip6.mask6, 0xff, sizeof(a->x.ip6.mask6)); ! break; ! #endif ! default: ! a->type = T_FAIL; ! return "unknown address family for network"; ! } } return NULL; *************** *** 315,326 **** return 1; case T_IP: ! if (ap[i].x.ip.net != INADDR_NONE ! && (r->connection->remote_addr.sin_addr.s_addr ! & ap[i].x.ip.mask) == ap[i].x.ip.net) { ! return 1; } break; case T_HOST: if (!gothost) { --- 464,526 ---- return 1; case T_IP: ! if (ap[i].x.ip.net.s_addr == INADDR_NONE) ! break; ! switch (r->connection->remote_addr.ss_family) { ! case AF_INET: ! if ((((struct sockaddr_in *)&r->connection->remote_addr)->sin_addr.s_addr ! & ap[i].x.ip.mask.s_addr) == ap[i].x.ip.net.s_addr) { ! return 1; ! } ! break; ! #ifdef INET6 ! case AF_INET6: ! if (!IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)&r->connection->remote_addr)->sin6_addr)) /*XXX*/ ! break; ! if ((*(ap_uint32_t *)&((struct sockaddr_in6 *)&r->connection->remote_addr)->sin6_addr.s6_addr[12] ! & ap[i].x.ip.mask.s_addr) == ap[i].x.ip.net.s_addr) { ! return 1; ! } ! break; ! #endif ! } ! break; ! ! #ifdef INET6 ! case T_IP6: ! { ! struct in6_addr masked; ! int j; ! if (IN6_IS_ADDR_UNSPECIFIED(&ap[i].x.ip6.net6)) ! break; ! switch (r->connection->remote_addr.ss_family) { ! case AF_INET: ! if (!IN6_IS_ADDR_V4MAPPED(&ap[i].x.ip6.net6)) /*XXX*/ ! break; ! memset(&masked, 0, sizeof(masked)); ! masked.s6_addr[10] = masked.s6_addr[11] = 0xff; ! memcpy(&masked.s6_addr[12], ! &((struct sockaddr_in *)&r->connection->remote_addr)->sin_addr.s_addr, ! sizeof(struct sockaddr_in)); ! for (j = 0; j < sizeof(struct in6_addr); j++) ! masked.s6_addr[j] &= ap[i].x.ip6.mask6.s6_addr[j]; ! if (memcmp(&masked, &ap[i].x.ip6.net6, sizeof(masked)) == 0) ! return 1; ! break; ! case AF_INET6: ! memset(&masked, 0, sizeof(masked)); ! memcpy(&masked, ! &((struct sockaddr_in6 *)&r->connection->remote_addr)->sin6_addr, ! sizeof(masked)); ! for (j = 0; j < sizeof(struct in6_addr); j++) ! masked.s6_addr[j] &= ap[i].x.ip6.mask6.s6_addr[j]; ! if (memcmp(&masked, &ap[i].x.ip6.net6, sizeof(masked)) == 0) ! return 1; ! break; } break; + } + #endif case T_HOST: if (!gothost) { Index: apache13/src/modules/standard/mod_unique_id.c diff -c apache13/src/modules/standard/mod_unique_id.c:1.1.1.5 apache13/src/modules/standard/mod_unique_id.c:1.10 *** apache13/src/modules/standard/mod_unique_id.c:1.1.1.5 Wed Jan 31 21:27:06 2001 --- apache13/src/modules/standard/mod_unique_id.c Wed Jan 31 22:37:34 2001 *************** *** 67,80 **** #include "http_config.h" #include "http_log.h" #include "multithread.h" #ifdef MULTITHREAD #error sorry this module does not support multithreaded servers yet #endif typedef struct { unsigned int stamp; ! unsigned int in_addr; unsigned int pid; unsigned short counter; } unique_id_rec; --- 67,92 ---- #include "http_config.h" #include "http_log.h" #include "multithread.h" + #include "sa_len.h" #ifdef MULTITHREAD #error sorry this module does not support multithreaded servers yet #endif + /*#define SHORT_UNIQUE_ID*/ + typedef struct { unsigned int stamp; ! union { ! struct in_addr in; ! #ifdef INET6 ! # ifdef SHORT_UNIQUE_ID ! ap_uint32_t in6; ! # else ! struct in6_addr in6; ! # endif ! #endif ! } addr; unsigned int pid; unsigned short counter; } unique_id_rec; *************** *** 144,150 **** * this shouldn't be a problem till year 2106. */ ! static unsigned global_in_addr; static APACHE_TLS unique_id_rec cur_unique_id; --- 156,162 ---- * this shouldn't be a problem till year 2106. */ ! static struct sockaddr_storage global_addr; static APACHE_TLS unique_id_rec cur_unique_id; *************** *** 164,170 **** #define MAXHOSTNAMELEN 256 #endif char str[MAXHOSTNAMELEN + 1]; ! struct hostent *hent; #ifndef NO_GETTIMEOFDAY struct timeval tv; #endif --- 176,183 ---- #define MAXHOSTNAMELEN 256 #endif char str[MAXHOSTNAMELEN + 1]; ! struct addrinfo hints, *res, *res0; ! int error; #ifndef NO_GETTIMEOFDAY struct timeval tv; #endif *************** *** 174,181 **** */ unique_id_rec_offset[0] = XtOffsetOf(unique_id_rec, stamp); unique_id_rec_size[0] = sizeof(cur_unique_id.stamp); ! unique_id_rec_offset[1] = XtOffsetOf(unique_id_rec, in_addr); ! unique_id_rec_size[1] = sizeof(cur_unique_id.in_addr); unique_id_rec_offset[2] = XtOffsetOf(unique_id_rec, pid); unique_id_rec_size[2] = sizeof(cur_unique_id.pid); unique_id_rec_offset[3] = XtOffsetOf(unique_id_rec, counter); --- 187,194 ---- */ unique_id_rec_offset[0] = XtOffsetOf(unique_id_rec, stamp); unique_id_rec_size[0] = sizeof(cur_unique_id.stamp); ! unique_id_rec_offset[1] = XtOffsetOf(unique_id_rec, addr); ! unique_id_rec_size[1] = sizeof(cur_unique_id.addr); unique_id_rec_offset[2] = XtOffsetOf(unique_id_rec, pid); unique_id_rec_size[2] = sizeof(cur_unique_id.pid); unique_id_rec_offset[3] = XtOffsetOf(unique_id_rec, counter); *************** *** 201,217 **** } str[sizeof(str) - 1] = '\0'; ! if ((hent = gethostbyname(str)) == NULL) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, s, ! "mod_unique_id: unable to gethostbyname(\"%s\")", str); exit(1); } ! global_in_addr = ((struct in_addr *) hent->h_addr_list[0])->s_addr; ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, s, ! "mod_unique_id: using ip addr %s", ! inet_ntoa(*(struct in_addr *) hent->h_addr_list[0])); /* * If the server is pummelled with restart requests we could possibly end --- 214,257 ---- } str[sizeof(str) - 1] = '\0'; ! memset(&hints, 0, sizeof(hints)); ! hints.ai_family = PF_UNSPEC; ! error = getaddrinfo(str, NULL, &hints, &res0); ! if (error) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, s, ! "mod_unique_id: getaddrinfo failed for \"%s\" (%s)", str, ! gai_strerror(error)); exit(1); } ! error = 1; ! for (res = res0; res; res = res->ai_next) { ! switch (res->ai_family) { ! case AF_INET: ! #ifdef INET6 ! case AF_INET6: ! #endif ! memcpy(&global_addr, res->ai_addr, res->ai_addrlen); ! error = 0; ! break; ! } ! } ! freeaddrinfo(res0); ! if (error) { ! ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, s, ! "mod_unique_id: no known AF found for \"%s\"", str); ! exit(1); ! } + getnameinfo((struct sockaddr *)&global_addr, + #ifndef SIN6_LEN + SA_LEN((struct sockaddr *)&global_addr), + #else + global_addr.ss_len, + #endif + str, sizeof(str), NULL, 0, NI_NUMERICHOST); ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, s, ! "mod_unique_id: using ip addr %s", str); /* * If the server is pummelled with restart requests we could possibly end *************** *** 270,276 **** "oh no! pids are greater than 32-bits! I'm broken!"); } ! cur_unique_id.in_addr = global_in_addr; /* * If we use 0 as the initial counter we have a little less protection --- 310,332 ---- "oh no! pids are greater than 32-bits! I'm broken!"); } ! memset(&cur_unique_id.addr, 0, sizeof(cur_unique_id.addr)); ! switch (global_addr.ss_family) { ! case AF_INET: ! cur_unique_id.addr.in = ((struct sockaddr_in *)&global_addr)->sin_addr; ! break; ! #ifdef INET6 ! case AF_INET6: ! #ifdef SHORT_UNIQUE_ID ! cur_unique_id.addr.in6 = ! ((struct sockaddr_in6 *)&global_addr)->sin6_addr.s6_addr32[3]; ! #else ! cur_unique_id.addr.in6 = ! ((struct sockaddr_in6 *)&global_addr)->sin6_addr; ! #endif ! break; ! #endif ! } /* * If we use 0 as the initial counter we have a little less protection Index: apache13/src/os/win32/MakeModuleMak.mak diff -c /dev/null apache13/src/os/win32/MakeModuleMak.mak:1.1.1.2 *** /dev/null Fri Mar 9 22:18:26 2001 --- apache13/src/os/win32/MakeModuleMak.mak Sat Oct 14 00:44:44 2000 *************** *** 0 **** --- 1,195 ---- + # Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 + # ** DO NOT EDIT ** + + # TARGTYPE "Win32 (x86) Console Application" 0x0103 + + !IF "$(CFG)" == "" + CFG=MakeModuleMak - Win32 Debug + !MESSAGE No configuration specified. Defaulting to MakeModuleMak - Win32\ + Debug. + !ENDIF + + !IF "$(CFG)" != "MakeModuleMak - Win32 Release" && "$(CFG)" !=\ + "MakeModuleMak - Win32 Debug" + !MESSAGE Invalid configuration "$(CFG)" specified. + !MESSAGE You can specify a configuration when running NMAKE on this makefile + !MESSAGE by defining the macro CFG on the command line. For example: + !MESSAGE + !MESSAGE NMAKE /f "MakeModuleMak.mak" CFG="MakeModuleMak - Win32 Debug" + !MESSAGE + !MESSAGE Possible choices for configuration are: + !MESSAGE + !MESSAGE "MakeModuleMak - Win32 Release" (based on\ + "Win32 (x86) Console Application") + !MESSAGE "MakeModuleMak - Win32 Debug" (based on\ + "Win32 (x86) Console Application") + !MESSAGE + !ERROR An invalid configuration is specified. + !ENDIF + + !IF "$(OS)" == "Windows_NT" + NULL= + !ELSE + NULL=nul + !ENDIF + ################################################################################ + # Begin Project + RSC=rc.exe + CPP=bcc32.exe + + !IF "$(CFG)" == "MakeModuleMak - Win32 Release" + + # PROP BASE Use_MFC 0 + # PROP BASE Use_Debug_Libraries 0 + # PROP BASE Output_Dir "Release" + # PROP BASE Intermediate_Dir "Release" + # PROP BASE Target_Dir "" + # PROP Use_MFC 0 + # PROP Use_Debug_Libraries 0 + # PROP Output_Dir "Release" + # PROP Intermediate_Dir "Release" + # PROP Target_Dir "" + OUTDIR=.\Release + INTDIR=.\Release + + ALL : "$(OUTDIR)\MakeModuleMak.exe" + + CLEAN : + -@erase "$(INTDIR)\MakeModuleMak.obj" + -@erase "$(OUTDIR)\MakeModuleMak.exe" + + "$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + + # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c + # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c + CPP_PROJ=-s /ML -w-8057 -w-8008 -w-8066 /O2 -D"WIN32" -D"NDEBUG" -D"_CONSOLE"\ + /Fp"$(INTDIR)/MakeModuleMak.pch" /YX -o"$(INTDIR)/$&.obj" /c + CPP_OBJS=.\Release/ + CPP_SBRS=.\. + # ADD BASE RSC /l 0x809 /d "NDEBUG" + # ADD RSC /l 0x809 /d "NDEBUG" + BSC32=bscmake.exe + # ADD BASE BSC32 /nologo + # ADD BSC32 /nologo + BSC32_FLAGS=/nologo /o"$(OUTDIR)/MakeModuleMak.bsc" + BSC32_SBRS= \ + + LINK32=link.exe + # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib /nologo /subsystem:console /incremental:no\ + /pdb:"$(OUTDIR)/MakeModuleMak.pdb" /machine:I386\ + /out:"$(OUTDIR)/MakeModuleMak.exe" + LINK32_OBJS= \ + "$(INTDIR)\MakeModuleMak.obj" + + "$(OUTDIR)\MakeModuleMak.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) + << + + !ELSEIF "$(CFG)" == "MakeModuleMak - Win32 Debug" + + # PROP BASE Use_MFC 0 + # PROP BASE Use_Debug_Libraries 1 + # PROP BASE Output_Dir "Debug" + # PROP BASE Intermediate_Dir "Debug" + # PROP BASE Target_Dir "" + # PROP Use_MFC 0 + # PROP Use_Debug_Libraries 1 + # PROP Output_Dir "Debug" + # PROP Intermediate_Dir "Debug" + # PROP Target_Dir "" + OUTDIR=.\Debug + INTDIR=.\Debug + + ALL : "$(OUTDIR)\MakeModuleMak.exe" + + CLEAN : + -@erase "$(INTDIR)\MakeModuleMak.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(OUTDIR)\MakeModuleMak.exe" + -@erase "$(OUTDIR)\MakeModuleMak.ilk" + -@erase "$(OUTDIR)\MakeModuleMak.pdb" + + "$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + + # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c + # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c + CPP_PROJ=-s /MLd -w-8057 -w-8008 -w-8066 /Gm -v /Od -D"WIN32" -D"_DEBUG" -D"_CONSOLE"\ + /Fp"$(INTDIR)/MakeModuleMak.pch" /YX -o"$(INTDIR)/$&.obj" /c + CPP_OBJS=.\Debug/ + CPP_SBRS=.\. + # ADD BASE RSC /l 0x809 /d "_DEBUG" + # ADD RSC /l 0x809 /d "_DEBUG" + BSC32=bscmake.exe + # ADD BASE BSC32 /nologo + # ADD BSC32 /nologo + BSC32_FLAGS=/nologo /o"$(OUTDIR)/MakeModuleMak.bsc" + BSC32_SBRS= \ + + LINK32=link.exe + # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 + # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 + LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib /nologo /subsystem:console /incremental:yes\ + /pdb:"$(OUTDIR)/MakeModuleMak.pdb" /debug /machine:I386\ + /out:"$(OUTDIR)/MakeModuleMak.exe" + LINK32_OBJS= \ + "$(INTDIR)\MakeModuleMak.obj" + + "$(OUTDIR)\MakeModuleMak.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) + << + + !ENDIF + + .c.obj: + $(CPP) $(CPP_PROJ) $< + + .cpp.obj: + $(CPP) $(CPP_PROJ) $< + + .cxx.obj: + $(CPP) $(CPP_PROJ) $< + + .c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + + .cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + + .cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + + ################################################################################ + # Begin Target + + # Name "MakeModuleMak - Win32 Release" + # Name "MakeModuleMak - Win32 Debug" + + !IF "$(CFG)" == "MakeModuleMak - Win32 Release" + + !ELSEIF "$(CFG)" == "MakeModuleMak - Win32 Debug" + + !ENDIF + + ################################################################################ + # Begin Source File + + SOURCE_1=.\MakeModuleMak.cpp + + "$(INTDIR)\MakeModuleMak.obj" : $(SOURCE_0) "$(INTDIR)" + + + # End Source File + # End Target + # End Project + ################################################################################ Index: apache13/src/os/win32/installer/README.TXT diff -c /dev/null apache13/src/os/win32/installer/README.TXT:1.1.1.1 *** /dev/null Fri Mar 9 22:18:26 2001 --- apache13/src/os/win32/installer/README.TXT Fri Oct 2 13:30:37 1998 *************** *** 0 **** --- 1,6 ---- + Read the Apache for Windows how to release document at + + http://dev.apache.org/how-to-release-win32.html + + for details of how to use this IS2 configuration file and + the installer DLL to build an Apache release. Index: apache13/src/os/win32/installer/apache.iwz diff -c /dev/null apache13/src/os/win32/installer/apache.iwz:1.1.1.4 *** /dev/null Fri Mar 9 22:18:26 2001 --- apache13/src/os/win32/installer/apache.iwz Tue Aug 24 13:20:59 1999 *************** *** 0 **** --- 1,995 ---- + + [InstallShield Wizard] + iDate=1 + iTime=1 + Flag=fe000000 + ISX.EXE Size=630784 + ISX.EXE Date=10:43:52 24/2/1998 + ISX.EXE Ver=2.0.0.143 + SETUP.EXE Size=45312 + SETUP.EXE Date=9:53:32 18/1/1997 + SETUP.EXE Ver=3.0.111.0 + SETUP.INS Size=70160 + SETUP.INS Date=13:16:56 11/2/1998 + SETUP.INS Ver=Not available + _INST16.EX_ Size=282766 + _INST16.EX_ Date=9:56:04 18/1/1997 + _INST16.EX_ Ver=Not available + _INST32I.EX_ Size=320411 + _INST32I.EX_ Date=10:04:08 18/1/1997 + _INST32I.EX_ Ver=Not available + ISDEPEND.INI Size=320411 + ISDEPEND.INI Date=10:04:08 18/1/1997 + ISDEPEND.INI Ver=Not available + SWDEPEND.INI Size=320411 + SWDEPEND.INI Date=10:04:08 18/1/1997 + SWDEPEND.INI Ver=Not available + ICOMP.EXE Size=119808 + ICOMP.EXE Date=14:05:10 15/1/1996 + ICOMP.EXE Ver=3.00.062 + SPLIT.EXE Size=90624 + SPLIT.EXE Date=14:09:36 15/1/1996 + SPLIT.EXE Ver=3.00.060 + PACKLIST.EXE Size=87552 + PACKLIST.EXE Date=14:10:30 15/1/1996 + PACKLIST.EXE Ver=3.00.060 + Version=2.02 + DevTool=Generic Windows + Platform=Win32 + DisksDir=apache\650MB\ + TabsVisit=1111001110000111100011 + LangNum=451 + LangDir=LANG\ENG\ + + [VisualDesign] + AppName=Apache + AppExe= + AppExeFile= + Version=1.3.7 dev + Company=Apache Group + Title=Apache Web Server 1.3.7 dev + TitleType=1 + BackgrndBmp= + BackgrndAlign=4 + Backgrnd=1 + BackgrndColor=10 + Uninstall=1 + Silent=1 + SmsMode=0 + + [Types] + Types=3 + Type1Components=6 + Type1Name=Custom + Type1ComponentList=1 3 4 6 5 2 + Type2Components=5 + Type2Name=Typical + Type2ComponentList=1 3 4 6 5 + Type3Components=2 + Type3Name=Compact + Type3ComponentList=1 6 + + [Components] + Components=6 + Component1Groups=6 + Component1Name=Application Files + Component1Description=Application files needed to run the application + Component1GroupList=1 3 24 25 4 35 + Component2Groups=17 + Component2Name=Source Code + Component2Description=Source code for Apache and support tools + Component2GroupList=10 11 12 13 14 15 16 17 18 19 20 21 22 23 31 32 34 + Component3Groups=6 + Component3Name=Apache Manual + Component3Description=Apache documentation + Component3GroupList=5 6 7 8 9 36 + Component4Groups=1 + Component4Name=Additional Modules + Component4Description=Apache modules to extend the server + Component4GroupList=2 + Component5Groups=2 + Component5Name=Icons + Component5Description=Icons for directory indexes + Component5GroupList=27 33 + Component6Groups=4 + Component6Name=Required Directories + Component6Description= + Component6GroupList=26 28 29 30 + + [Groups] + Groups=36 + Group1Size=346325 + Group1Files=9 + Group1Name=Program Executables + Group1Dir= + Group1Update=0 + Group1TargetOS=-1 + Group1File1=C:\Apache\Apache.exe + Group1File2=C:\Apache\ApacheCore.dll + Group1File3=C:\Apache\Announcement + Group1File4=C:\Apache\ABOUT_APACHE + Group1File5=C:\Apache\KEYS + Group1File6=C:\Apache\LICENSE + Group1File7=C:\Apache\README + Group1File8=C:\apache\Makefile.tmpl + Group1File9=C:\apache\README-NT.TXT + Group2Size=133120 + Group2Files=10 + Group2Name=Additional Modules + Group2Dir=\modules + Group2Update=0 + Group2TargetOS=-1 + Group2File1=C:\Apache\modules\ApacheModuleDigest.dll + Group2File2=C:\Apache\modules\ApacheModuleCERNMeta.dll + Group2File3=C:\Apache\modules\ApacheModuleAuthAnon.dll + Group2File4=C:\Apache\modules\ApacheModuleExpires.dll + Group2File5=C:\Apache\modules\ApacheModuleHeaders.dll + Group2File6=C:\Apache\modules\ApacheModuleProxy.dll + Group2File7=C:\Apache\modules\ApacheModuleSpeling.dll + Group2File8=C:\Apache\modules\ApacheModuleStatus.dll + Group2File9=C:\Apache\modules\ApacheModuleUserTrack.dll + Group2File10=C:\apache\modules\ApacheModuleRewrite.dll + Group3Size=49860 + Group3Files=6 + Group3Name=Configuration Files + Group3Dir=\.tmp + Group3Update=0 + Group3TargetOS=-1 + Group3File1=C:\Apache\conf\httpd.conf-dist-win + Group3File2=C:\Apache\conf\access.conf-dist-win + Group3File3=C:\Apache\conf\magic + Group3File4=C:\Apache\conf\mime.types + Group3File5=C:\Apache\conf\srm.conf-dist-win + Group3File6=C:\apache\conf\highperformance.conf-dist + Group4Size=3999 + Group4Files=2 + Group4Name=Initial Document Root Files + Group4Dir=\.tmp + Group4Update=1 + Group4TargetOS=-1 + Group4File1=C:\Apache\htdocs\index.html + Group4File2=C:\apache\htdocs\apache_pb.gif + Group5Size=295033 + Group5Files=34 + Group5Name=Manual + Group5Dir=\htdocs\manual + Group5Update=0 + Group5TargetOS=-1 + Group5File1=C:\apache\htdocs\manual\custom-error.html + Group5File2=C:\apache\htdocs\manual\content-negotiation.html + Group5File3=C:\apache\htdocs\manual\cgi_path.html + Group5File4=C:\apache\htdocs\manual\dns-caveats.html + Group5File5=C:\apache\htdocs\manual\dso.html + Group5File6=C:\apache\htdocs\manual\ebcdic.html + Group5File7=C:\apache\htdocs\manual\env.html + Group5File8=C:\apache\htdocs\manual\footer.html + Group5File9=C:\apache\htdocs\manual\handler.html + Group5File10=C:\apache\htdocs\manual\header.html + Group5File11=C:\apache\htdocs\manual\index.html + Group5File12=C:\apache\htdocs\manual\install.html + Group5File13=C:\apache\htdocs\manual\invoking.html + Group5File14=C:\apache\htdocs\manual\keepalive.html + Group5File15=C:\apache\htdocs\manual\LICENSE + Group5File16=C:\apache\htdocs\manual\location.html + Group5File17=C:\apache\htdocs\manual\man-template.html + Group5File18=C:\apache\htdocs\manual\multilogs.html + Group5File19=C:\apache\htdocs\manual\new_features_1_0.html + Group5File20=C:\apache\htdocs\manual\new_features_1_1.html + Group5File21=C:\apache\htdocs\manual\new_features_1_2.html + Group5File22=C:\apache\htdocs\manual\new_features_1_3.html + Group5File23=C:\apache\htdocs\manual\process-model.html + Group5File24=C:\apache\htdocs\manual\sections.html + Group5File25=C:\apache\htdocs\manual\sourcereorg.html + Group5File26=C:\apache\htdocs\manual\stopping.html + Group5File27=C:\apache\htdocs\manual\suexec.html + Group5File28=C:\apache\htdocs\manual\unixware.html + Group5File29=C:\apache\htdocs\manual\upgrading_to_1_3.html + Group5File30=C:\apache\htdocs\manual\windows.html + Group5File31=C:\apache\htdocs\manual\bind.html + Group5File32=C:\apache\htdocs\manual\suexec_1_2.html + Group5File33=C:\apache\htdocs\manual\install-tpf.html + Group5File34=C:\apache\htdocs\manual\readme-tpf.html + Group6Size=42478 + Group6Files=8 + Group6Name=images + Group6Dir=[Manual]\images + Group6Update=0 + Group6TargetOS=-1 + Group6File1=C:\Apache\htdocs\manual\images\custom_errordocs.gif + Group6File2=C:\Apache\htdocs\manual\images\home.gif + Group6File3=C:\Apache\htdocs\manual\images\index.gif + Group6File4=C:\Apache\htdocs\manual\images\sub.gif + Group6File5=C:\apache\htdocs\manual\images\mod_rewrite_fig1.fig + Group6File6=C:\apache\htdocs\manual\images\mod_rewrite_fig1.gif + Group6File7=C:\apache\htdocs\manual\images\mod_rewrite_fig2.fig + Group6File8=C:\apache\htdocs\manual\images\mod_rewrite_fig2.gif + Group7Size=329371 + Group7Files=22 + Group7Name=misc + Group7Dir=[Manual]\misc + Group7Update=0 + Group7TargetOS=-1 + Group7File1=C:\Apache\htdocs\manual\misc\API.html + Group7File2=C:\Apache\htdocs\manual\misc\client_block_api.html + Group7File3=C:\Apache\htdocs\manual\misc\compat_notes.html + Group7File4=C:\Apache\htdocs\manual\misc\custom_errordocs.html + Group7File5=C:\Apache\htdocs\manual\misc\descriptors.html + Group7File6=C:\Apache\htdocs\manual\misc\FAQ.html + Group7File7=C:\Apache\htdocs\manual\misc\fin_wait_2.html + Group7File8=C:\Apache\htdocs\manual\misc\footer.html + Group7File9=C:\Apache\htdocs\manual\misc\header.html + Group7File10=C:\Apache\htdocs\manual\misc\howto.html + Group7File11=C:\Apache\htdocs\manual\misc\index.html + Group7File12=C:\Apache\htdocs\manual\misc\known_client_problems.html + Group7File13=C:\Apache\htdocs\manual\misc\nopgp.html + Group7File14=C:\Apache\htdocs\manual\misc\perf-bsd44.html + Group7File15=C:\Apache\htdocs\manual\misc\perf-dec.html + Group7File16=C:\Apache\htdocs\manual\misc\perf-hp.html + Group7File17=C:\Apache\htdocs\manual\misc\perf-tuning.html + Group7File18=C:\Apache\htdocs\manual\misc\perf.html + Group7File19=C:\Apache\htdocs\manual\misc\security_tips.html + Group7File20=C:\Apache\htdocs\manual\misc\vif-info.html + Group7File21=C:\Apache\htdocs\manual\misc\windoz_keepalive.html + Group7File22=C:\apache\htdocs\manual\misc\HTTP_Features.tsv + Group8Size=558131 + Group8Files=48 + Group8Name=mod + Group8Dir=[Manual]\mod + Group8Update=0 + Group8TargetOS=-1 + Group8File1=C:\Apache\htdocs\manual\mod\core.html + Group8File2=C:\Apache\htdocs\manual\mod\directive-dict.html + Group8File3=C:\Apache\htdocs\manual\mod\directives.html + Group8File4=C:\Apache\htdocs\manual\mod\footer.html + Group8File5=C:\Apache\htdocs\manual\mod\header.html + Group8File6=C:\Apache\htdocs\manual\mod\index.html + Group8File7=C:\Apache\htdocs\manual\mod\mod_access.html + Group8File8=C:\Apache\htdocs\manual\mod\mod_actions.html + Group8File9=C:\Apache\htdocs\manual\mod\mod_alias.html + Group8File10=C:\Apache\htdocs\manual\mod\mod_asis.html + Group8File11=C:\Apache\htdocs\manual\mod\mod_auth.html + Group8File12=C:\Apache\htdocs\manual\mod\mod_auth_anon.html + Group8File13=C:\Apache\htdocs\manual\mod\mod_auth_db.html + Group8File14=C:\Apache\htdocs\manual\mod\mod_auth_dbm.html + Group8File15=C:\Apache\htdocs\manual\mod\mod_autoindex.html + Group8File16=C:\Apache\htdocs\manual\mod\mod_browser.html + Group8File17=C:\Apache\htdocs\manual\mod\mod_cern_meta.html + Group8File18=C:\Apache\htdocs\manual\mod\mod_cgi.html + Group8File19=C:\Apache\htdocs\manual\mod\mod_cookies.html + Group8File20=C:\Apache\htdocs\manual\mod\mod_digest.html + Group8File21=C:\Apache\htdocs\manual\mod\mod_dir.html + Group8File22=C:\Apache\htdocs\manual\mod\mod_dld.html + Group8File23=C:\Apache\htdocs\manual\mod\mod_dll.html + Group8File24=C:\Apache\htdocs\manual\mod\mod_env.html + Group8File25=C:\Apache\htdocs\manual\mod\mod_example.html + Group8File26=C:\Apache\htdocs\manual\mod\mod_expires.html + Group8File27=C:\Apache\htdocs\manual\mod\mod_headers.html + Group8File28=C:\Apache\htdocs\manual\mod\mod_imap.html + Group8File29=C:\Apache\htdocs\manual\mod\mod_include.html + Group8File30=C:\Apache\htdocs\manual\mod\mod_info.html + Group8File31=C:\Apache\htdocs\manual\mod\mod_isapi.html + Group8File32=C:\Apache\htdocs\manual\mod\mod_log_agent.html + Group8File33=C:\Apache\htdocs\manual\mod\mod_log_common.html + Group8File34=C:\Apache\htdocs\manual\mod\mod_log_config.html + Group8File35=C:\Apache\htdocs\manual\mod\mod_log_referer.html + Group8File36=C:\Apache\htdocs\manual\mod\mod_mime.html + Group8File37=C:\Apache\htdocs\manual\mod\mod_mime_magic.html + Group8File38=C:\Apache\htdocs\manual\mod\mod_negotiation.html + Group8File39=C:\Apache\htdocs\manual\mod\mod_proxy.html + Group8File40=C:\Apache\htdocs\manual\mod\mod_rewrite.html + Group8File41=C:\Apache\htdocs\manual\mod\mod_setenvif.html + Group8File42=C:\Apache\htdocs\manual\mod\mod_so.html + Group8File43=C:\Apache\htdocs\manual\mod\mod_speling.html + Group8File44=C:\Apache\htdocs\manual\mod\mod_status.html + Group8File45=C:\Apache\htdocs\manual\mod\mod_unique_id.html + Group8File46=C:\Apache\htdocs\manual\mod\mod_userdir.html + Group8File47=C:\Apache\htdocs\manual\mod\mod_usertrack.html + Group8File48=C:\apache\htdocs\manual\mod\mod_mmap_static.html + Group9Size=112629 + Group9Files=13 + Group9Name=vhosts + Group9Dir=[Manual]\vhosts + Group9Update=0 + Group9TargetOS=-1 + Group9File1=C:\Apache\htdocs\manual\vhosts\details.html + Group9File2=C:\Apache\htdocs\manual\vhosts\details_1_2.html + Group9File3=C:\Apache\htdocs\manual\vhosts\examples.html + Group9File4=C:\Apache\htdocs\manual\vhosts\fd-limits.html + Group9File5=C:\Apache\htdocs\manual\vhosts\footer.html + Group9File6=C:\Apache\htdocs\manual\vhosts\header.html + Group9File7=C:\Apache\htdocs\manual\vhosts\host.html + Group9File8=C:\Apache\htdocs\manual\vhosts\index.html + Group9File9=C:\Apache\htdocs\manual\vhosts\ip-based.html + Group9File10=C:\Apache\htdocs\manual\vhosts\name-based.html + Group9File11=C:\Apache\htdocs\manual\vhosts\vhosts-in-depth.html + Group9File12=C:\Apache\htdocs\manual\vhosts\virtual-host.html + Group9File13=C:\apache\htdocs\manual\vhosts\mass.html + Group10Size=523748 + Group10Files=19 + Group10Name=src + Group10Dir=\src + Group10Update=0 + Group10TargetOS=-1 + Group10File1=C:\Apache\src\.gdbinit + Group10File2=C:\Apache\src\Apache.dsp + Group10File3=C:\Apache\src\Apache.mak + Group10File4=C:\Apache\src\ApacheCore.def + Group10File5=C:\Apache\src\ApacheCore.dsp + Group10File6=C:\Apache\src\ApacheCore.mak + Group10File7=C:\Apache\src\buildmark.c + Group10File8=C:\Apache\src\CHANGES + Group10File9=C:\Apache\src\Configuration.tmpl + Group10File10=C:\Apache\src\Configure + Group10File11=C:\Apache\src\INSTALL + Group10File12=C:\Apache\src\Makefile.nt + Group10File13=C:\Apache\src\Makefile.tmpl + Group10File14=C:\Apache\src\PORTING + Group10File15=C:\Apache\src\README + Group10File16=C:\Apache\src\README.EBCDIC + Group10File17=C:\apache\src\BUILD.NOTES + Group10File18=C:\apache\src\Makefile_win32.txt + Group10File19=C:\apache\src\Makefile_win32_debug.txt + Group11Size=92924 + Group11Files=10 + Group11Name=ap + Group11Dir=[src]\ap + Group11Update=0 + Group11TargetOS=-1 + Group11File1=C:\Apache\src\ap\ap.dsp + Group11File2=C:\Apache\src\ap\ap.mak + Group11File3=C:\Apache\src\ap\ap_cpystrn.c + Group11File4=C:\Apache\src\ap\ap_execve.c + Group11File5=C:\Apache\src\ap\ap_signal.c + Group11File6=C:\Apache\src\ap\ap_slack.c + Group11File7=C:\Apache\src\ap\ap_snprintf.c + Group11File8=C:\Apache\src\ap\Makefile.tmpl + Group11File9=C:\apache\src\ap\ap_fnmatch.c + Group11File10=C:\apache\src\ap\ap_md5c.c + Group12Size=255397 + Group12Files=29 + Group12Name=include + Group12Dir=[src]\include + Group12Update=0 + Group12TargetOS=-1 + Group12File1=C:\Apache\src\include\alloc.h + Group12File2=C:\Apache\src\include\ap.h + Group12File3=C:\Apache\src\include\buff.h + Group12File4=C:\Apache\src\include\conf.h + Group12File5=C:\Apache\src\include\explain.h + Group12File6=C:\Apache\src\include\fnmatch.h + Group12File7=C:\Apache\src\include\hsregex.h + Group12File8=C:\Apache\src\include\httpd.h + Group12File9=C:\Apache\src\include\http_config.h + Group12File10=C:\Apache\src\include\http_conf_globals.h + Group12File11=C:\Apache\src\include\http_core.h + Group12File12=C:\Apache\src\include\http_log.h + Group12File13=C:\Apache\src\include\http_main.h + Group12File14=C:\Apache\src\include\http_protocol.h + Group12File15=C:\Apache\src\include\http_request.h + Group12File16=C:\Apache\src\include\http_vhost.h + Group12File17=C:\Apache\src\include\ap_md5.h + Group12File18=C:\Apache\src\include\multithread.h + Group12File19=C:\Apache\src\include\rfc1413.h + Group12File20=C:\Apache\src\include\scoreboard.h + Group12File21=C:\Apache\src\include\util_date.h + Group12File22=C:\Apache\src\include\util_md5.h + Group12File23=C:\Apache\src\include\util_script.h + Group12File24=C:\apache\src\include\compat.h + Group12File25=C:\apache\src\include\util_uri.h + Group12File26=C:\apache\src\include\ap_compat.h + Group12File27=C:\apache\src\include\ap_config.h + Group12File28=C:\apache\src\include\ap_ctype.h + Group12File29=C:\apache\src\include\ap_mmn.h + Group13Size=789788 + Group13Files=22 + Group13Name=main + Group13Dir=[src]\main + Group13Update=0 + Group13TargetOS=-1 + Group13File1=C:\apache\src\main\alloc.c + Group13File2=C:\apache\src\main\buff.c + Group13File3=C:\apache\src\main\gen_test_char.c + Group13File4=C:\apache\src\main\gen_test_char.dsp + Group13File5=C:\apache\src\main\gen_test_char.mak + Group13File6=C:\apache\src\main\gen_uri_delims.c + Group13File7=C:\apache\src\main\gen_uri_delims.dsp + Group13File8=C:\apache\src\main\gen_uri_delims.mak + Group13File9=C:\apache\src\main\http_config.c + Group13File10=C:\apache\src\main\http_core.c + Group13File11=C:\apache\src\main\http_log.c + Group13File12=C:\apache\src\main\http_main.c + Group13File13=C:\apache\src\main\http_protocol.c + Group13File14=C:\apache\src\main\http_request.c + Group13File15=C:\apache\src\main\http_vhost.c + Group13File16=C:\apache\src\main\Makefile.tmpl + Group13File17=C:\apache\src\main\rfc1413.c + Group13File18=C:\apache\src\main\util.c + Group13File19=C:\apache\src\main\util_date.c + Group13File20=C:\apache\src\main\util_md5.c + Group13File21=C:\apache\src\main\util_script.c + Group13File22=C:\apache\src\main\util_uri.c + Group14Size=895 + Group14Files=1 + Group14Name=modules + Group14Dir=[src]\modules + Group14Update=0 + Group14TargetOS=-1 + Group14File1=C:\Apache\src\modules\README + Group15Size=48416 + Group15Files=3 + Group15Name=example + Group15Dir=[modules]\example + Group15Update=0 + Group15TargetOS=-1 + Group15File1=C:\Apache\src\modules\example\Makefile.tmpl + Group15File2=C:\Apache\src\modules\example\mod_example.c + Group15File3=C:\Apache\src\modules\example\README + Group16Size=13194 + Group16Files=2 + Group16Name=experimental + Group16Dir=[modules]\experimental + Group16Update=0 + Group16TargetOS=-1 + Group16File1=C:\Apache\src\modules\experimental\Makefile.tmpl + Group16File2=C:\Apache\src\modules\experimental\mod_mmap_static.c + Group17Size=69 + Group17Files=1 + Group17Name=extra + Group17Dir=[modules]\extra + Group17Update=0 + Group17TargetOS=-1 + Group17File1=C:\Apache\src\modules\extra\Makefile.tmpl + Group18Size=205708 + Group18Files=11 + Group18Name=proxy + Group18Dir=[modules]\proxy + Group18Update=0 + Group18TargetOS=-1 + Group18File1=C:\apache\src\modules\proxy\ApacheModuleProxy.dsp + Group18File2=C:\apache\src\modules\proxy\ApacheModuleProxy.mak + Group18File3=C:\apache\src\modules\proxy\Makefile.libdir + Group18File4=C:\apache\src\modules\proxy\Makefile.tmpl + Group18File5=C:\apache\src\modules\proxy\mod_proxy.c + Group18File6=C:\apache\src\modules\proxy\mod_proxy.h + Group18File7=C:\apache\src\modules\proxy\proxy_cache.c + Group18File8=C:\apache\src\modules\proxy\proxy_connect.c + Group18File9=C:\apache\src\modules\proxy\proxy_ftp.c + Group18File10=C:\apache\src\modules\proxy\proxy_http.c + Group18File11=C:\apache\src\modules\proxy\proxy_util.c + Group19Size=863524 + Group19Files=36 + Group19Name=standard + Group19Dir=[modules]\standard + Group19Update=0 + Group19TargetOS=-1 + Group19File1=C:\apache\src\modules\standard\Makefile.tmpl + Group19File2=C:\apache\src\modules\standard\mod_access.c + Group19File3=C:\apache\src\modules\standard\mod_actions.c + Group19File4=C:\apache\src\modules\standard\mod_alias.c + Group19File5=C:\apache\src\modules\standard\mod_asis.c + Group19File6=C:\apache\src\modules\standard\mod_auth.c + Group19File7=C:\apache\src\modules\standard\mod_auth_anon.c + Group19File8=C:\apache\src\modules\standard\mod_auth_db.c + Group19File9=C:\apache\src\modules\standard\mod_auth_db.module + Group19File10=C:\apache\src\modules\standard\mod_auth_dbm.c + Group19File11=C:\apache\src\modules\standard\mod_autoindex.c + Group19File12=C:\apache\src\modules\standard\mod_cern_meta.c + Group19File13=C:\apache\src\modules\standard\mod_cgi.c + Group19File14=C:\apache\src\modules\standard\mod_digest.c + Group19File15=C:\apache\src\modules\standard\mod_dir.c + Group19File16=C:\apache\src\modules\standard\mod_env.c + Group19File17=C:\apache\src\modules\standard\mod_expires.c + Group19File18=C:\apache\src\modules\standard\mod_headers.c + Group19File19=C:\apache\src\modules\standard\mod_imap.c + Group19File20=C:\apache\src\modules\standard\mod_include.c + Group19File21=C:\apache\src\modules\standard\mod_info.c + Group19File22=C:\apache\src\modules\standard\mod_log_agent.c + Group19File23=C:\apache\src\modules\standard\mod_log_config.c + Group19File24=C:\apache\src\modules\standard\mod_log_referer.c + Group19File25=C:\apache\src\modules\standard\mod_mime.c + Group19File26=C:\apache\src\modules\standard\mod_mime_magic.c + Group19File27=C:\apache\src\modules\standard\mod_negotiation.c + Group19File28=C:\apache\src\modules\standard\mod_rewrite.c + Group19File29=C:\apache\src\modules\standard\mod_rewrite.h + Group19File30=C:\apache\src\modules\standard\mod_setenvif.c + Group19File31=C:\apache\src\modules\standard\mod_so.c + Group19File32=C:\apache\src\modules\standard\mod_speling.c + Group19File33=C:\apache\src\modules\standard\mod_status.c + Group19File34=C:\apache\src\modules\standard\mod_unique_id.c + Group19File35=C:\apache\src\modules\standard\mod_userdir.c + Group19File36=C:\apache\src\modules\standard\mod_usertrack.c + Group20Size=170796 + Group20Files=25 + Group20Name=regex + Group20Dir=[src]\regex + Group20Update=0 + Group20TargetOS=-1 + Group20File1=C:\Apache\src\regex\cclass.h + Group20File2=C:\Apache\src\regex\cname.h + Group20File3=C:\Apache\src\regex\COPYRIGHT + Group20File4=C:\Apache\src\regex\debug.c + Group20File5=C:\Apache\src\regex\engine.c + Group20File6=C:\Apache\src\regex\engine.ih + Group20File7=C:\Apache\src\regex\main.c + Group20File8=C:\Apache\src\regex\Makefile.tmpl + Group20File9=C:\Apache\src\regex\mkh + Group20File10=C:\Apache\src\regex\README + Group20File11=C:\Apache\src\regex\regcomp.c + Group20File12=C:\Apache\src\regex\regcomp.ih + Group20File13=C:\Apache\src\regex\regerror.c + Group20File14=C:\Apache\src\regex\regerror.ih + Group20File15=C:\Apache\src\regex\regex.3 + Group20File16=C:\Apache\src\regex\regex.7 + Group20File17=C:\Apache\src\regex\regex.dsp + Group20File18=C:\Apache\src\regex\regex.mak + Group20File19=C:\Apache\src\regex\regex2.h + Group20File20=C:\Apache\src\regex\regexec.c + Group20File21=C:\Apache\src\regex\regfree.c + Group20File22=C:\Apache\src\regex\split.c + Group20File23=C:\Apache\src\regex\tests + Group20File24=C:\Apache\src\regex\utils.h + Group20File25=C:\Apache\src\regex\WHATSNEW + Group21Size=210232 + Group21Files=28 + Group21Name=support + Group21Dir=[src]\support + Group21Update=0 + Group21TargetOS=-1 + Group21File1=C:\apache\src\support\ab.c + Group21File2=C:\apache\src\support\apachectl + Group21File3=C:\apache\src\support\apxs.8 + Group21File4=C:\apache\src\support\apxs.pl + Group21File5=C:\apache\src\support\dbmmanage + Group21File6=C:\apache\src\support\dbmmanage.1 + Group21File7=C:\apache\src\support\htdigest.1 + Group21File8=C:\apache\src\support\htdigest.c + Group21File9=C:\apache\src\support\htpasswd.1 + Group21File10=C:\apache\src\support\htpasswd.c + Group21File11=C:\apache\src\support\httpd.8 + Group21File12=C:\apache\src\support\log_server_status + Group21File13=C:\apache\src\support\logresolve.8 + Group21File14=C:\apache\src\support\logresolve.c + Group21File15=C:\apache\src\support\logresolve.pl + Group21File16=C:\apache\src\support\Makefile.tmpl + Group21File17=C:\apache\src\support\phf_abuse_log.cgi + Group21File18=C:\apache\src\support\rotatelogs.8 + Group21File19=C:\apache\src\support\rotatelogs.c + Group21File20=C:\apache\src\support\split-logfile + Group21File21=C:\apache\src\support\suexec.8 + Group21File22=C:\apache\src\support\suexec.c + Group21File23=C:\apache\src\support\suexec.h + Group21File24=C:\apache\src\support\httpd.exp + Group21File25=C:\apache\src\support\htpasswd.dsp + Group21File26=C:\apache\src\support\htpasswd.mak + Group21File27=C:\apache\src\support\ab.8 + Group21File28=C:\apache\src\support\apachectl.8 + Group22Size=0 + Group22Files=0 + Group22Name=os + Group22Dir=[src]\os + Group22Update=0 + Group22TargetOS=-1 + Group23Size=210812 + Group23Files=46 + Group23Name=win32 + Group23Dir=[os]\win32 + Group23Update=0 + Group23TargetOS=-1 + Group23File1=C:\apache\src\os\win32\ApacheModuleAuthAnon.dsp + Group23File2=C:\apache\src\os\win32\ApacheModuleAuthAnon.mak + Group23File3=C:\apache\src\os\win32\ApacheModuleCERNMeta.dsp + Group23File4=C:\apache\src\os\win32\ApacheModuleCERNMeta.mak + Group23File5=C:\apache\src\os\win32\ApacheModuleDigest.dsp + Group23File6=C:\apache\src\os\win32\ApacheModuleDigest.mak + Group23File7=C:\apache\src\os\win32\ApacheModuleExpires.dsp + Group23File8=C:\apache\src\os\win32\ApacheModuleExpires.mak + Group23File9=C:\apache\src\os\win32\ApacheModuleHeaders.dsp + Group23File10=C:\apache\src\os\win32\ApacheModuleHeaders.mak + Group23File11=C:\apache\src\os\win32\ApacheModuleInfo.dsp + Group23File12=C:\apache\src\os\win32\ApacheModuleInfo.mak + Group23File13=C:\apache\src\os\win32\ApacheModuleRewrite.dsp + Group23File14=C:\apache\src\os\win32\ApacheModuleRewrite.mak + Group23File15=C:\apache\src\os\win32\ApacheModuleSpeling.dsp + Group23File16=C:\apache\src\os\win32\ApacheModuleSpeling.mak + Group23File17=C:\apache\src\os\win32\ApacheModuleStatus.dsp + Group23File18=C:\apache\src\os\win32\ApacheModuleStatus.mak + Group23File19=C:\apache\src\os\win32\ApacheModuleUserTrack.dsp + Group23File20=C:\apache\src\os\win32\ApacheModuleUserTrack.mak + Group23File21=C:\apache\src\os\win32\ApacheOS.dsp + Group23File22=C:\apache\src\os\win32\ApacheOS.mak + Group23File23=C:\apache\src\os\win32\getopt.c + Group23File24=C:\apache\src\os\win32\getopt.h + Group23File25=C:\apache\src\os\win32\main_win32.c + Group23File26=C:\apache\src\os\win32\MakeModuleMak.cpp + Group23File27=C:\apache\src\os\win32\MakeModuleMak.mak + Group23File28=C:\apache\src\os\win32\mod_dll.c + Group23File29=C:\apache\src\os\win32\mod_isapi.c + Group23File30=C:\apache\src\os\win32\Module.mak.tmpl + Group23File31=C:\apache\src\os\win32\modules.c + Group23File32=C:\apache\src\os\win32\multithread.c + Group23File33=C:\apache\src\os\win32\os.c + Group23File34=C:\apache\src\os\win32\os.h + Group23File35=C:\apache\src\os\win32\passwd.c + Group23File36=C:\apache\src\os\win32\passwd.h + Group23File37=C:\apache\src\os\win32\readdir.c + Group23File38=C:\apache\src\os\win32\readdir.h + Group23File39=C:\apache\src\os\win32\registry.c + Group23File40=C:\apache\src\os\win32\registry.h + Group23File41=C:\apache\src\os\win32\service.c + Group23File42=C:\apache\src\os\win32\service.h + Group23File43=C:\apache\src\os\win32\util_win32.c + Group23File44=C:\apache\src\os\win32\apache.ico + Group23File45=C:\apache\src\os\win32\apache.rc + Group23File46=C:\apache\src\os\win32\resource.h + Group24Size=84480 + Group24Files=1 + Group24Name=Installer DLL + Group24Dir= + Group24Update=0 + Group24TargetOS=-1 + Group24File1=C:\Apache\install.dll + Group25Size=254005 + Group25Files=1 + Group25Name=Shared DLLs + Group25Dir= + Group25Update=0 + Group25TargetOS=-1 + Group25File1=C:\Apache\MSVCRT.DLL + Group26Size=0 + Group26Files=0 + Group26Name=logs + Group26Dir=\logs + Group26Update=0 + Group26TargetOS=-1 + Group27Size=37127 + Group27Files=76 + Group27Name=icons + Group27Dir=\icons + Group27Update=1 + Group27TargetOS=-1 + Group27File1=C:\apache\icons\a.gif + Group27File2=C:\apache\icons\alert.black.gif + Group27File3=C:\apache\icons\alert.red.gif + Group27File4=C:\apache\icons\apache_pb.gif + Group27File5=C:\apache\icons\back.gif + Group27File6=C:\apache\icons\ball.gray.gif + Group27File7=C:\apache\icons\ball.red.gif + Group27File8=C:\apache\icons\binary.gif + Group27File9=C:\apache\icons\binhex.gif + Group27File10=C:\apache\icons\blank.gif + Group27File11=C:\apache\icons\bomb.gif + Group27File12=C:\apache\icons\box1.gif + Group27File13=C:\apache\icons\box2.gif + Group27File14=C:\apache\icons\broken.gif + Group27File15=C:\apache\icons\burst.gif + Group27File16=C:\apache\icons\c.gif + Group27File17=C:\apache\icons\comp.blue.gif + Group27File18=C:\apache\icons\comp.gray.gif + Group27File19=C:\apache\icons\compressed.gif + Group27File20=C:\apache\icons\continued.gif + Group27File21=C:\apache\icons\dir.gif + Group27File22=C:\apache\icons\down.gif + Group27File23=C:\apache\icons\dvi.gif + Group27File24=C:\apache\icons\f.gif + Group27File25=C:\apache\icons\folder.gif + Group27File26=C:\apache\icons\folder.open.gif + Group27File27=C:\apache\icons\folder.sec.gif + Group27File28=C:\apache\icons\forward.gif + Group27File29=C:\apache\icons\generic.gif + Group27File30=C:\apache\icons\generic.red.gif + Group27File31=C:\apache\icons\generic.sec.gif + Group27File32=C:\apache\icons\hand.right.gif + Group27File33=C:\apache\icons\hand.up.gif + Group27File34=C:\apache\icons\icon.sheet.gif + Group27File35=C:\apache\icons\image1.gif + Group27File36=C:\apache\icons\image2.gif + Group27File37=C:\apache\icons\image3.gif + Group27File38=C:\apache\icons\index.gif + Group27File39=C:\apache\icons\layout.gif + Group27File40=C:\apache\icons\left.gif + Group27File41=C:\apache\icons\link.gif + Group27File42=C:\apache\icons\movie.gif + Group27File43=C:\apache\icons\p.gif + Group27File44=C:\apache\icons\patch.gif + Group27File45=C:\apache\icons\pdf.gif + Group27File46=C:\apache\icons\pie0.gif + Group27File47=C:\apache\icons\pie1.gif + Group27File48=C:\apache\icons\pie2.gif + Group27File49=C:\apache\icons\pie3.gif + Group27File50=C:\apache\icons\pie4.gif + Group27File51=C:\apache\icons\pie5.gif + Group27File52=C:\apache\icons\pie6.gif + Group27File53=C:\apache\icons\pie7.gif + Group27File54=C:\apache\icons\pie8.gif + Group27File55=C:\apache\icons\portal.gif + Group27File56=C:\apache\icons\ps.gif + Group27File57=C:\apache\icons\quill.gif + Group27File58=C:\apache\icons\README + Group27File59=C:\apache\icons\right.gif + Group27File60=C:\apache\icons\screw1.gif + Group27File61=C:\apache\icons\screw2.gif + Group27File62=C:\apache\icons\script.gif + Group27File63=C:\apache\icons\sound1.gif + Group27File64=C:\apache\icons\sound2.gif + Group27File65=C:\apache\icons\sphere1.gif + Group27File66=C:\apache\icons\sphere2.gif + Group27File67=C:\apache\icons\tar.gif + Group27File68=C:\apache\icons\tex.gif + Group27File69=C:\apache\icons\text.gif + Group27File70=C:\apache\icons\transfer.gif + Group27File71=C:\apache\icons\unknown.gif + Group27File72=C:\apache\icons\up.gif + Group27File73=C:\apache\icons\uu.gif + Group27File74=C:\apache\icons\uuencoded.gif + Group27File75=C:\apache\icons\world1.gif + Group27File76=C:\apache\icons\world2.gif + Group28Size=0 + Group28Files=0 + Group28Name=conf + Group28Dir=\conf + Group28Update=0 + Group28TargetOS=-1 + Group29Size=2326 + Group29Files=1 + Group29Name=htdocs + Group29Dir=\htdocs + Group29Update=0 + Group29TargetOS=-1 + Group29File1=C:\apache\htdocs\apache_pb.gif + Group30Size=0 + Group30Files=0 + Group30Name=cgi-bin + Group30Dir=\cgi-bin + Group30Update=0 + Group30TargetOS=-1 + Group31Size=37002 + Group31Files=2 + Group31Name=installer + Group31Dir=[win32]\installer + Group31Update=0 + Group31TargetOS=-1 + Group31File1=C:\apache\src\os\win32\installer\apache.iwz + Group31File2=C:\apache\src\os\win32\installer\README.TXT + Group32Size=30356 + Group32Files=4 + Group32Name=installdll + Group32Dir=[installer]\installdll + Group32Update=0 + Group32TargetOS=-1 + Group32File1=C:\apache\src\os\win32\installer\installdll\install.c + Group32File2=C:\apache\src\os\win32\installer\installdll\install.def + Group32File3=C:\apache\src\os\win32\installer\installdll\install.dsp + Group32File4=C:\apache\src\os\win32\installer\installdll\install.mak + Group33Size=8247 + Group33Files=33 + Group33Name=small + Group33Dir=[icons]\small + Group33Update=0 + Group33TargetOS=-1 + Group33File1=C:\apache\icons\small\back.gif + Group33File2=C:\apache\icons\small\binary.gif + Group33File3=C:\apache\icons\small\binhex.gif + Group33File4=C:\apache\icons\small\blank.gif + Group33File5=C:\apache\icons\small\broken.gif + Group33File6=C:\apache\icons\small\burst.gif + Group33File7=C:\apache\icons\small\comp1.gif + Group33File8=C:\apache\icons\small\comp2.gif + Group33File9=C:\apache\icons\small\compressed.gif + Group33File10=C:\apache\icons\small\continued.gif + Group33File11=C:\apache\icons\small\dir.gif + Group33File12=C:\apache\icons\small\dir2.gif + Group33File13=C:\apache\icons\small\forward.gif + Group33File14=C:\apache\icons\small\generic.gif + Group33File15=C:\apache\icons\small\generic2.gif + Group33File16=C:\apache\icons\small\generic3.gif + Group33File17=C:\apache\icons\small\image.gif + Group33File18=C:\apache\icons\small\image2.gif + Group33File19=C:\apache\icons\small\index.gif + Group33File20=C:\apache\icons\small\movie.gif + Group33File21=C:\apache\icons\small\rainbow.gif + Group33File22=C:\apache\icons\small\README.txt + Group33File23=C:\apache\icons\small\sound.gif + Group33File24=C:\apache\icons\small\sound2.gif + Group33File25=C:\apache\icons\small\tar.gif + Group33File26=C:\apache\icons\small\text.gif + Group33File27=C:\apache\icons\small\transfer.gif + Group33File28=C:\apache\icons\small\unknown.gif + Group33File29=C:\apache\icons\small\uu.gif + Group33File30=C:\apache\icons\small\key.gif + Group33File31=C:\apache\icons\small\patch.gif + Group33File32=C:\apache\icons\small\ps.gif + Group33File33=C:\apache\icons\small\doc.gif + Group34Size=21478 + Group34Files=8 + Group34Name=test + Group34Dir=[installdll]\test + Group34Update=0 + Group34TargetOS=-1 + Group34File1=C:\apache\src\os\win32\installer\installdll\test\resource.h + Group34File2=C:\apache\src\os\win32\installer\installdll\test\test.c + Group34File3=C:\apache\src\os\win32\installer\installdll\test\test.def + Group34File4=C:\apache\src\os\win32\installer\installdll\test\test.dsp + Group34File5=C:\apache\src\os\win32\installer\installdll\test\test.h + Group34File6=C:\apache\src\os\win32\installer\installdll\test\test.ico + Group34File7=C:\apache\src\os\win32\installer\installdll\test\test.mak + Group34File8=C:\apache\src\os\win32\installer\installdll\test\test.rc + Group35Size=58368 + Group35Files=1 + Group35Name=bin + Group35Dir=\bin + Group35Update=0 + Group35TargetOS=-1 + Group35File1=C:\apache\bin\htpasswd.exe + Group36Size=7223 + Group36Files=1 + Group36Name=search + Group36Dir=[manual]\search + Group36Update=0 + Group36TargetOS=-1 + Group36File1=C:\apache\htdocs\manual\search\manual-index.cgi + + [Sequence] + DestinationLocationDir=\Apache Group\Apache + SelectProgramFolderName=Apache Web Server + LicenseAgreement=1 + LicenseAgreementFile=C:\Apache\LICENSE + ReadMeFileBrowser=1 + ReadMeFileBrowserFile=C:\apache\WARNING-NT.TXT + DestinationLocation=1 + SetupType=1 + CustomSetup=1 + SelectProgramFolder=1 + ProgressBar=1 + SetupComplete=1 + SetupCompleteExec= + SetupCompleteExecParam= + SetupCompleteExecReadme=[Program Executables]\README-NT.TXT + + [RegEntries] + Reg1Path=HKEY_CLASSES_ROOT + Reg1Val1Type=0 + Reg1Val1Name=(Default) + Reg1Val1Data=(value not set) + Reg1Vals=1 + Reg2Path=HKEY_CURRENT_USER + Reg2Val1Type=0 + Reg2Val1Name=(Default) + Reg2Val1Data=(value not set) + Reg2Vals=1 + Reg3Path=HKEY_LOCAL_MACHINE + Reg3Val1Type=0 + Reg3Val1Name=(Default) + Reg3Val1Data=(value not set) + Reg3Vals=1 + Reg4Path=HKEY_USERS + Reg4Val1Type=0 + Reg4Val1Name=(Default) + Reg4Val1Data=(value not set) + Reg4Vals=1 + Reg5Path=HKEY_CURRENT_CONFIG + Reg5Val1Type=0 + Reg5Val1Name=(Default) + Reg5Val1Data=(value not set) + Reg5Vals=1 + Reg6Path=HKEY_DYN_DATA + Reg6Val1Type=0 + Reg6Val1Name=(Default) + Reg6Val1Data=(value not set) + Reg6Vals=1 + Reg7Path=HKEY_LOCAL_MACHINE\SOFTWARE + Reg7Val1Type=0 + Reg7Val1Name=(Default) + Reg7Val1Data=(value not set) + Reg7Vals=1 + Reg8Path=HKEY_LOCAL_MACHINE\SOFTWARE\Apache Group + Reg8Val1Type=0 + Reg8Val1Name=(Default) + Reg8Val1Data=(value not set) + Reg8Vals=1 + Reg9Path=HKEY_LOCAL_MACHINE\SOFTWARE\Apache Group\Apache + Reg9Val1Type=0 + Reg9Val1Name=(Default) + Reg9Val1Data=(value not set) + Reg9Vals=1 + Reg10Path=HKEY_LOCAL_MACHINE\SOFTWARE\Apache Group\Apache\1.3.7 dev + Reg10Val1Type=0 + Reg10Val1Name=(Default) + Reg10Val1Data=(value not set) + Reg10Val2Type=0 + Reg10Val2Name=ServerRoot + Reg10Val2Data= + Reg10Vals=2 + Regs=10 + + [Registry] + Reg1Path=HKEY_LOCAL_MACHINE\SOFTWARE + Reg2Path=HKEY_LOCAL_MACHINE\SOFTWARE\Apache Group + Reg3Path=HKEY_LOCAL_MACHINE\SOFTWARE\Apache Group\Apache + Reg4Path=HKEY_LOCAL_MACHINE\SOFTWARE\Apache Group\Apache\1.3.7 dev + Reg5Path=HKEY_LOCAL_MACHINE\SOFTWARE\Apache Group\Apache\1.3.7 dev + Reg5ValName=ServerRoot + Reg5ValType=0 + Reg5ValData= + Regs=5 + + [Icons] + Icons=5 + Icon1Param=-d "" -s + Icon1Cmd=[Program Executables]\Apache.exe + Icon1Description=Start Apache as console app + Icon1WorkingDir=[Program Executables] + Icon1IconFile=[Program Executables]\Apache.exe + Icon1RealFile=C:\Apache\Apache.exe + Icon1WhichIcon=0 + Icon1KeyVirtual=0 + Icon1KeyFlags=0 + Icon1StartMenu=0 + Icon1Window=0 + Icon2Param= + Icon2Cmd=[Manual]\index.html + Icon2Description=Apache Documentation + Icon2WorkingDir=[Manual] + Icon2IconFile= + Icon2RealFile=C:\Apache\htdocs\manual\index.html + Icon2WhichIcon=0 + Icon2KeyVirtual=0 + Icon2KeyFlags=0 + Icon2StartMenu=0 + Icon2Window=0 + Icon3Param=-d "" -i + Icon3Cmd=[Program Executables]\Apache.exe + Icon3Description=Install Apache as Service (NT only) + Icon3WorkingDir=[Program Executables] + Icon3IconFile= + Icon3RealFile=C:\Apache\Apache.exe + Icon3WhichIcon=0 + Icon3KeyVirtual=0 + Icon3KeyFlags=0 + Icon3StartMenu=0 + Icon3Window=0 + Icon4Param=-d "" -u + Icon4Cmd=[Program Executables]\Apache.exe + Icon4Description=Uninstall Apache Service (NT only) + Icon4WorkingDir=[Program Executables] + Icon4IconFile= + Icon4RealFile=C:\Apache\Apache.exe + Icon4WhichIcon=0 + Icon4KeyVirtual=0 + Icon4KeyFlags=0 + Icon4StartMenu=0 + Icon4Window=0 + Icon5Param=-d "" -k shutdown + Icon5Cmd=[Program Executables]\Apache.exe + Icon5Description=Shutdown Apache console app + Icon5WorkingDir=[Program Executables] + Icon5IconFile= + Icon5RealFile=C:\Apache\Apache.exe + Icon5WhichIcon=0 + Icon5KeyVirtual=0 + Icon5KeyFlags=0 + Icon5StartMenu=0 + Icon5Window=0 + + [VisualBasic] + PRJFile= + + [Ext] + Ext1Dlg=Setup Complete + Ext1Param1=[Installer DLL]\install.dll + Ext1Param2=BeforeExit + Ext1Op=DLL + + [Temp Files] + File1=C:\Apache\install.dll + + [Autoexec] + PathDir= + ShareLocks= + ShareFiles= + Command= + + [CopyToFloppy] + DriveOption=Path for a 1 File Installation. + DestinationPath= + DestinationPathOneFile=C:\ + Password= Index: apache13/src/os/win32/installer/installdll/install.c diff -c /dev/null apache13/src/os/win32/installer/installdll/install.c:1.1.1.3 *** /dev/null Fri Mar 9 22:18:26 2001 --- apache13/src/os/win32/installer/installdll/install.c Tue Aug 24 13:21:00 1999 *************** *** 0 **** --- 1,666 ---- + /* Apache Installer */ + + /* + * 26/06/97 PCS 1.000 Initial version + * 22/02/98 PCS 1.001 Used the excellent NTemacs to apply proper formating + * 04/05/98 PCS 1.002 Copy conf files to *.conf.default, then to *.conf + * 16/02/99 PCS 1.003 Add logging to "install.log" in the installed directory + */ + + #define VERSION ( "1.003 " __DATE__ " " __TIME__ ) + + #include + #include + #include + #include + #include + + #include "conf.h" + #include "ap.h" + + #ifdef strftime + #undef strftime + #endif + + #define AP_WIN32ERROR 1 + + /* Global to store the instance handle */ + HINSTANCE hInstance = NULL; + + static char *szLogFilename = NULL; + static FILE *fpLog = NULL; + + void LogMessage(char *fmt, ...) + { + char buf[4000]; + va_list ap; + struct tm *tms; + time_t nowtime; + char *bp = buf; + int rv; + int free = sizeof(buf); + + if (!fpLog) { + return; + } + + nowtime = time(NULL); + tms = localtime(&nowtime); + rv = strftime(bp, free, "%c", tms); + bp += rv; + free -= rv; + if (free) { + *bp++ = ' '; + free--; + } + + va_start(ap, fmt); + rv = ap_vsnprintf(bp, free, fmt, ap); + va_end(ap); + + free -= rv; + + fprintf(fpLog, "%s\n", buf); + } + + /* + * MessageBox_error() is a helper function to display an error in a + * message box, optionally including a Win32 error message. If + * the "opt" argument is value AP_WIN32ERROR then get the last Win32 + * error (with GetLastError()) and add it on to the end of + * the output string. The output string is given as a printf-format + * and replacement arguments. The hWnd, title and mb_opt fields are + * passed on to the Win32 MessageBox() call. + */ + + int MessageBox_error(HWND hWnd, int opt, char *title, + int mb_opt, char *fmt, ...) + { + char buf[1000]; + va_list ap; + int free = sizeof(buf); /* Number of bytes free in the buffer */ + int rv; + char *p; + + va_start(ap, fmt); + rv = ap_vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + + free -= rv; + + if (opt & AP_WIN32ERROR && free > 3) { + /* We checked in the "if" that we have enough space in buf for + * at least three extra characters. + */ + p = buf + strlen(buf); + *p++ = '\r'; + *p++ = '\r'; + *p++ = '('; + free -= 3; + /* NB: buf is now not null terminated */ + + /* Now put the error message straight into buf. This function + * takes the free buffer size as the 6th argument. + */ + rv = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + GetLastError(), + 0, + p, + free, + NULL); + + if (rv == 0) { + /* FormatMessage failed, so get rid of the "\r\r(" we just placed + * in the buffer, since there is no system error message. + */ + p -= 3; + *p = '\0'; + free += 3; + } else { + free -= rv; + p += rv; + + /* Strip any trailing \r or \n characters to make it look nice on + * the screen. + */ + while (*(p-1) == '\r' || *(p-1) == '\n') + p--, free++; + *p = '\0'; + + /* Append a trailing ) */ + if (free >= 1) { + *p++ = ')'; + *p++ = '\0'; + } + } + } + + for (p = buf; *p; p++) { + if (*p == '\n' || *p == '\r') { + *p = ' '; + } + } + LogMessage("MSG %s", buf); + + return MessageBox(hWnd, buf, title, mb_opt); + } + + int OpenLog(HWND hwnd, char *dir, char *fn) + { + szLogFilename = malloc(strlen(dir) + 1 + strlen(fn) + 1); + sprintf(szLogFilename, "%s\\%s", dir, fn); + + if ((fpLog = fopen(szLogFilename, "a+")) == NULL) { + MessageBox_error(hwnd, + AP_WIN32ERROR, + "Installation Problem", + MB_OK | MB_ICONSTOP, + "Cannot open log file %s", szLogFilename); + return -1; + } + return 0; + } + + void CloseLog(void) + { + if (fpLog) { + fclose(fpLog); + } + } + + /* + * The next few functions handle expanding the @@ServerRoot@@ type + * sequences found in the distribution files. The main entry point + * is expandFile(), which is given a file to expand and the filename + * to write the expanded file it. It reads a line at a time, and + * if the line includes an "@@" sequence, calls expandLine() to + * expand the sequences. + * + * expandLine() looks for @@ sequences in the line, and when it finds + * one, looks for a corresponding entry in the replaceTable[]. If it + * finds one it writes the replacement value from the table into + * an output string. + * + * The helper function appendText() is used when expanding strings. It + * is called to copy text into an output buffer. If the output buffer + * is not big enough, it is expanded. This function also ensures that + * the output buffer is null terminated after each append operation. + * + * A table is used of values to replace, rather than just hardcoding + * the functionality, so we could replace additional values in the + * future. We also take care to ensure that the expanded line can be + * arbitrary length (though at the moment the lines read from the + * configuration files can only be up to 2000 characters). + */ + + /* + * Table of items to replace. The "value" elements are filled in at runtime + * by FillInReplaceTable(). Note that the "tmpl" element is case + * sensitive. + */ + + typedef struct { + char *tmpl; + char *value; + } REPLACEITEM; + typedef REPLACEITEM *REPLACETABLE; + + REPLACEITEM replaceHttpd[] = { + { "@@ServerRoot@@", NULL }, /* ServerRoot directory (i.e. install dir) */ + { NULL, NULL } + }; + + /* + * A relatively intelligent version of strcat, that expands the destination + * buffer if needed. + * + * On entry, ppBuf points to the output buffer, pnPos points to the offset + * of the current position within that buffer, and pnSize points to the + * current size of *ppBuf. pSrc points to the string to copy into the buffer, + * and nToCopy gives the number of characters to copy from pSrc. + * + * On exit, *ppBuf, *pnPos and *pnSize may have been updated if the output + * buffer needed to be expanded. The output buffer will be null terminated. + * Returns 0 on success, -1 on error. Does not report errors to the user. + */ + + int appendText(char **ppBuf, int *pnPos, int *pnSize, char *pSrc, int nToCopy) + { + char *pBuf = *ppBuf; /* output buffer */ + int nPos = *pnPos; /* current offset into pBuf */ + int nSize = *pnSize; /* current size of pBuf */ + + while (nPos + nToCopy >= nSize) { + /* Not enough space, double size of output buffer. Note we use + * >= not > so that we have enough space for the NULL character + * in the output buffer */ + char *pBufNew; + + pBufNew = realloc(pBuf, nSize * 2); + if (!pBufNew) + return -1; + nSize *= 2; + + /* Update the max size and buffer pointer */ + *pnSize = nSize; + *ppBuf = pBuf = pBufNew; + } + + /* Ok, now we have enough space, copy the stuff */ + + strncpy(pBuf+nPos, pSrc, nToCopy); + nPos += nToCopy; + *pnPos = nPos; /* update current position */ + pBuf[nPos] = '\0'; /* append trailing NULL */ + + return 0; + } + + /* + * Expand all the sequences in an input line. Returns a pointer to the + * expanded line. The caller should free the returned data. + * The replaceTable argument is a table of sequences to expand. + * + * Returns NULL on error. Does not report errors to the user. + */ + + char *expandLine(char *in, REPLACETABLE replaceTable) + { + REPLACEITEM *item; + char *pos; /* current position in input buffer */ + char *outbuf; /* output buffer */ + int outbuf_size; /* current size of output buffer */ + int outbuf_position; /* current position in output buffer */ + char *start; /* position to copy from in input buffer */ + + /* Create an initial output buffer. Guess that twice the input size + * is a good length, after expansion. Don't worry if we need more + * though, appendText() will expand as needed. + */ + outbuf_size = strlen(in) * 2; + outbuf_position = 0; + outbuf = malloc(outbuf_size); + if (!outbuf) + return NULL; + + start = in; /* mark the start of uncopied data */ + pos = in; /* current position in input buffer */ + + while (1) { + + /* Look for '@@' sequence, or end of input */ + if (*pos && !(*pos == '@' && *(pos+1) == '@')) { + pos++; + continue; + } + + if (!*pos) { + /* End of input string, copy the uncopied data */ + if (appendText(&outbuf, &outbuf_position, &outbuf_size, + start, pos-start) < 0) { + return NULL; + } + break; + } + + /* Found first @ of a possible token to replace. Look for end + * of the token + */ + for (item = replaceTable; item->tmpl; ++item) { + if (!strncmp(pos, item->tmpl, strlen(item->tmpl))) + break; + } + + if (item->tmpl) { + /* Found match. First copy the uncopied data from the input + * buffer (start through to pos-1), then copy the expanded + * value. */ + if (appendText(&outbuf, &outbuf_position, &outbuf_size, + start, pos-start) < 0) { + return NULL; + } + if (appendText(&outbuf, &outbuf_position, &outbuf_size, + item->value, strlen(item->value)) < 0) { + return NULL; + } + + /* Update current position to skip over the input buffer + * @@...@@ sequence, and update the "start" pointer to uncopied + * data + */ + pos += strlen(item->tmpl); + start = pos; + } + else { + /* The sequence did not exist in the replace table, so copy + * it as-is to the output. + */ + pos++; + } + } + + return outbuf; + } + + /* + * Some options to determine how we copy a file. Apart from OPT_NONE, these should + * be OR'able + */ + + typedef enum { + OPT_NONE = 0, + OPT_OVERWRITE = 1, /* Always overwrite destination file */ + OPT_EXPAND = 2, /* Expand any @@...@@ tokens in replaceHttpd */ + OPT_DELETESOURCE = 4, /* Delete the source file after the copy */ + OPT_SILENT = 8, /* Don't tell use about failures */ + } options_t; + + /* + * Copy a file, expanding sequences from the replaceTable argument. + * Returns 0 on success, -1 on error. Reports errors to user. + */ + #define MAX_INPUT_LINE 2000 + int WINAPI ExpandConfFile(HWND hwnd, LPSTR szInst, LPSTR szinFile, LPSTR szoutFile, REPLACETABLE replaceTable, options_t options) + { + char inFile[_MAX_PATH]; + char outFile[_MAX_PATH]; + char inbuf[MAX_INPUT_LINE]; + FILE *infp; + FILE *outfp; + + ap_snprintf(inFile, sizeof(inFile), "%s\\%s", szInst, szinFile); + ap_snprintf(outFile, sizeof(outFile), "%s\\%s", szInst, szoutFile); + + if (!(infp = fopen(inFile, "r"))) { + MessageBox_error(hwnd, + AP_WIN32ERROR, + "Installation Problem", + MB_OK | MB_ICONSTOP, + "Cannot read file %s", inFile); + return -1; + } + if (! (options & OPT_OVERWRITE)) { + /* Overwrite not allowed if file does not exist */ + if ((outfp = fopen(outFile, "r"))) { + if (! (options & OPT_SILENT)) { + MessageBox_error(hwnd, + 0, + "File not overwritten", + MB_OK | MB_ICONWARNING, + "Preserving existing file %s.\r\r" + "The new version of this file has been left in %s", + outFile, inFile); + } + fclose(outfp); + fclose(infp); + return 0; + } + /* To get here, output file does not exist */ + } + if (!(outfp = fopen(outFile, "w"))) { + MessageBox_error(hwnd, + AP_WIN32ERROR, + "Installation Problem", + MB_OK | MB_ICONSTOP, + "Cannot write to file %s", outFile); + fclose(infp); + return -1; + } + + while (fgets(inbuf, MAX_INPUT_LINE, infp)) { + char *pos; + char *outbuf; + + /* Quickly look to see if this line contains any + * @@ tokens. If it doesn't, we don't need to bother + * called expandLine() or taking a copy of the input + * buffer. + */ + if (options & OPT_EXPAND) { + for (pos = inbuf; *pos; ++pos) + if (*pos == '@' && *(pos+1) == '@') + break; + } + + if (options & OPT_EXPAND && *pos) { + /* The input line contains at least one '@@' sequence, so + * call expandLine() to expand any sequences we know about. + */ + outbuf = expandLine(inbuf, replaceTable); + if (outbuf == NULL) { + fclose(infp); + fclose(outfp); + MessageBox_error(hwnd, + 0, + "Installation Problem", + MB_OK|MB_ICONSTOP, + "An error occurred during installation"); + return -1; + } + } + else { + outbuf = NULL; + } + + /* If outbuf is NULL, we did not need to expand sequences, so + * just output the contents of the input buffer. + */ + fwrite(outbuf ? outbuf : inbuf, 1, + strlen(outbuf ? outbuf : inbuf), outfp); + + if (outbuf) + free(outbuf); + } + fclose(infp); + fclose(outfp); + + LogMessage("COPY: expanded %s to %s", inFile, outFile); + + if (options & OPT_DELETESOURCE) { + unlink(inFile); + LogMessage("COPY: deleted file %s", inFile); + } + + return 0; + } + + int FillInReplaceTable(HWND hwnd, REPLACETABLE table, char *szInst) + { + REPLACEITEM *item; + for (item = table; item->tmpl; ++item) { + if (!strcmp(item->tmpl, "@@ServerRoot@@")) { + char *p; + + #if NEED_SHORT_PATHS + int len; + len = GetShortPathName(szInst, NULL, 0); + if (len > 0) { + item->value = (char*)malloc(len+1); + GetShortPathName(szInst, item->value, len); + } + #else + if ((item->value = strdup(szInst)) == NULL) + return -1; + #endif + for (p = item->value; *p; p++) + if (*p == '\\') *p = '/'; + + LogMessage("FillInReplaceTable tmpl=%s value=%s", item->tmpl, item->value); + + continue; + } + #if NEED_FQDN + if (!strcmp(item->tmpl, "FQDN")) { + item->value = GetHostName(hwnd); + continue; + } + #endif + } + return 0; + } + + /* + * actionTable[] contains things we do when this DLL is called by InstallShield + * during the install. It is like a simple script, without us having to + * worry about parsing, error checking, etc. + * + * Each item in the table is of type ACTIONITEM. The first element is the action + * to perform (e.g. CMD_COPY). The second and third elements are filenames + * (e.g. for CMD_COPY, the first filename is the source and the second filename + * is the destination). The final element of ACTIONITEM is a set of options + * which apply to the current "command". For example, OPT_EXPAND on a CMD_COPY + * line, tells the copy function to expand @@ServerRoot@@ tokens found in the + * source file. + * + * The contents of this table are performed in order, top to bottom. This lets + * us expand the files to the *.conf.default names, then copy to *.conf only + * if the corresponding *.conf file does not already exist. If it does exist, + * it is not overwritten. + * + * Return 1 on success, 0 on error. + */ + + typedef enum { + CMD_COPY = 0, + CMD_RMDIR, + CMD_RM, + CMD_END + } cmd_t; + + typedef struct { + cmd_t command; + char *in; + char *out; + options_t options; + } ACTIONITEM; + typedef ACTIONITEM *ACTIONTABLE; + + ACTIONITEM actionTable[] = { + /* + * Installation of the configuraton files. These are installed into the ".tmp" + * directory by the installer. We first move them to conf\*.default (overwriting + * any *.default file from a previous install). The *.conf-dist-win files + * are also expanded for any @@...@@ tokens. Then we copy the conf\*.default + * file to corresponding conf\* file, unless that would overwrite an existing file. + */ + { CMD_COPY, ".tmp\\mime.types", "conf\\mime.types.default", + OPT_OVERWRITE|OPT_DELETESOURCE }, + { CMD_COPY, ".tmp\\magic", "conf\\magic.default", + OPT_OVERWRITE|OPT_DELETESOURCE }, + { CMD_COPY, ".tmp\\httpd.conf-dist-win", "conf\\httpd.conf.default", + OPT_OVERWRITE|OPT_EXPAND|OPT_DELETESOURCE }, + { CMD_COPY, ".tmp\\srm.conf-dist-win", "conf\\srm.conf.default", + OPT_OVERWRITE|OPT_EXPAND|OPT_DELETESOURCE }, + { CMD_COPY, ".tmp\\access.conf-dist-win", "conf\\access.conf.default", + OPT_OVERWRITE|OPT_EXPAND|OPT_DELETESOURCE }, + + /* Now copy to the 'live' files, unless they already exist */ + { CMD_COPY, "conf\\httpd.conf.default", "conf\\httpd.conf", OPT_NONE }, + { CMD_COPY, "conf\\srm.conf.default", "conf\\srm.conf", OPT_NONE }, + { CMD_COPY, "conf\\access.conf.default", "conf\\access.conf", OPT_NONE }, + { CMD_COPY, "conf\\magic.default", "conf\\magic", OPT_NONE }, + { CMD_COPY, "conf\\mime.types.default", "conf\\mime.types", OPT_NONE }, + + { CMD_COPY, ".tmp\\highperformance.conf-dist", "conf\\highperformance.conf-dist", + OPT_EXPAND|OPT_OVERWRITE|OPT_DELETESOURCE }, + + { CMD_RMDIR, ".tmp", NULL }, + + { CMD_END, NULL, NULL, OPT_NONE } + }; + + /* + * BeforeExit() is the DLL call from InstallShield. The arguments and + * return value as defined by the installer. We are only interested + * in the install directory, szInst. Return 0 on error and 1 on + * success (!?). + */ + + CHAR WINAPI BeforeExit(HWND hwnd, LPSTR szSrcDir, LPSTR szSupport, LPSTR szInst, LPSTR szRes) + { + ACTIONITEM *pactionItem; + int end = 0; + + OpenLog(hwnd, szInst, "install.log"); + LogMessage("STARTED %s", VERSION); + LogMessage("src=%s support=%s inst=%s", + szSrcDir, szSupport, szInst); + + FillInReplaceTable(hwnd, replaceHttpd, szInst); + + pactionItem = actionTable; + while (!end) { + + LogMessage("command=%d 1in=%s out=%s options=%d", + pactionItem->command, + pactionItem->in ? pactionItem->in : "NULL", + pactionItem->out ? pactionItem->out : "NULL", + pactionItem->options); + + switch(pactionItem->command) { + case CMD_END: + end = 1; + break; + case CMD_COPY: + if (ExpandConfFile(hwnd, szInst, + pactionItem->in, + pactionItem->out, + replaceHttpd, + pactionItem->options) < 0) { + /* Error has already been reported to the user */ + return 0; + } + break; + case CMD_RM: { + char inFile[MAX_INPUT_LINE]; + + ap_snprintf(inFile, sizeof(inFile), "%s\\%s", szInst, pactionItem->in); + if (unlink(inFile) < 0 && !(pactionItem->options & OPT_SILENT)) { + MessageBox_error(hwnd, AP_WIN32ERROR, "Error during configuration", + MB_ICONHAND, + "Could not remove file %s", + inFile); + return 0; + } + LogMessage("RM: deleted file %s", inFile); + break; + } + case CMD_RMDIR: { + char inFile[MAX_INPUT_LINE]; + + ap_snprintf(inFile, sizeof(inFile), "%s\\%s", szInst, pactionItem->in); + if (rmdir(inFile) < 0) { + MessageBox_error(hwnd, AP_WIN32ERROR, "Error during configuration", + MB_ICONHAND, + "Could not delete temporary directory %s", + inFile); + return 0; + } + LogMessage("RMDIR: deleted directory %s", inFile); + break; + } + default: + MessageBox_error(hwnd, 0, "Error during configuration", + MB_ICONHAND, + "An error has occurred during configuration\r" + "(Error: unknown command %d)", (int)pactionItem->command); + end = 1; + break; + } + pactionItem++; + } + + LogMessage("FINISHED OK"); + CloseLog(); + + return 1; + } + + + BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved) + { + if (fdwReason == DLL_PROCESS_ATTACH) + hInstance = hInstDLL; + return TRUE; + } Index: apache13/src/os/win32/installer/installdll/install.def diff -c /dev/null apache13/src/os/win32/installer/installdll/install.def:1.1.1.1 *** /dev/null Fri Mar 9 22:18:26 2001 --- apache13/src/os/win32/installer/installdll/install.def Fri Oct 2 13:30:37 1998 *************** *** 0 **** --- 1,6 ---- + LIBRARY INSTALL + DESCRIPTION 'Installer DLL For Apache' + + EXPORTS + BeforeExit @1 + DllMain @2 Index: apache13/src/os/win32/installer/installdll/install.dsp diff -c /dev/null apache13/src/os/win32/installer/installdll/install.dsp:1.1.1.3 *** /dev/null Fri Mar 9 22:18:26 2001 --- apache13/src/os/win32/installer/installdll/install.dsp Sat Oct 14 00:44:58 2000 *************** *** 0 **** --- 1,103 ---- + # Microsoft Developer Studio Project File - Name="install" - Package Owner=<4> + # Microsoft Developer Studio Generated Build File, Format Version 6.00 + # ** DO NOT EDIT ** + + # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + + CFG=install - Win32 Debug + !MESSAGE This is not a valid makefile. To build this project using NMAKE, + !MESSAGE use the Export Makefile command and run + !MESSAGE + !MESSAGE NMAKE /f "install.mak". + !MESSAGE + !MESSAGE You can specify a configuration when running NMAKE + !MESSAGE by defining the macro CFG on the command line. For example: + !MESSAGE + !MESSAGE NMAKE /f "install.mak" CFG="install - Win32 Debug" + !MESSAGE + !MESSAGE Possible choices for configuration are: + !MESSAGE + !MESSAGE "install - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") + !MESSAGE "install - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") + !MESSAGE + + # Begin Project + # PROP AllowPerConfigDependencies 0 + # PROP Scc_ProjName "" + # PROP Scc_LocalPath "" + CPP=cl.exe + MTL=midl.exe + RSC=rc.exe + + !IF "$(CFG)" == "install - Win32 Release" + + # PROP BASE Use_MFC 0 + # PROP BASE Use_Debug_Libraries 0 + # PROP BASE Output_Dir "Release" + # PROP BASE Intermediate_Dir "Release" + # PROP BASE Target_Dir "" + # PROP Use_MFC 0 + # PROP Use_Debug_Libraries 0 + # PROP Output_Dir "Release" + # PROP Intermediate_Dir "Release" + # PROP Ignore_Export_Lib 0 + # PROP Target_Dir "" + # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c + # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\os\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c + # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 + # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 + # ADD BASE RSC /l 0x809 /d "NDEBUG" + # ADD RSC /l 0x809 /d "NDEBUG" + BSC32=bscmake.exe + # ADD BASE BSC32 /nologo + # ADD BSC32 /nologo + LINK32=link.exe + # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 + # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:windows /dll /map /machine:I386 + + !ELSEIF "$(CFG)" == "install - Win32 Debug" + + # PROP BASE Use_MFC 0 + # PROP BASE Use_Debug_Libraries 1 + # PROP BASE Output_Dir "Debug" + # PROP BASE Intermediate_Dir "Debug" + # PROP BASE Target_Dir "" + # PROP Use_MFC 0 + # PROP Use_Debug_Libraries 1 + # PROP Output_Dir "Debug" + # PROP Intermediate_Dir "Debug" + # PROP Ignore_Export_Lib 0 + # PROP Target_Dir "" + # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c + # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c + # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 + # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 + # ADD BASE RSC /l 0x809 /d "_DEBUG" + # ADD RSC /l 0x809 /d "_DEBUG" + BSC32=bscmake.exe + # ADD BASE BSC32 /nologo + # ADD BSC32 /nologo + LINK32=link.exe + # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept + # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /pdbtype:sept + + !ENDIF + + # Begin Target + + # Name "install - Win32 Release" + # Name "install - Win32 Debug" + # Begin Source File + + SOURCE=..\..\..\..\ap\ap_snprintf.c + # End Source File + # Begin Source File + + SOURCE=.\install.c + # End Source File + # Begin Source File + + SOURCE=.\install.def + # End Source File + # End Target + # End Project Index: apache13/src/os/win32/installer/installdll/install.mak diff -c /dev/null apache13/src/os/win32/installer/installdll/install.mak:1.1.1.4 *** /dev/null Fri Mar 9 22:18:27 2001 --- apache13/src/os/win32/installer/installdll/install.mak Wed Jan 31 21:27:10 2001 *************** *** 0 **** --- 1,283 ---- + # Microsoft Developer Studio Generated NMAKE File, Based on install.dsp + !IF "$(CFG)" == "" + CFG=install - Win32 Debug + !MESSAGE No configuration specified. Defaulting to install - Win32 Debug. + !ENDIF + + !IF "$(CFG)" != "install - Win32 Release" && "$(CFG)" !=\ + "install - Win32 Debug" + !MESSAGE Invalid configuration "$(CFG)" specified. + !MESSAGE You can specify a configuration when running NMAKE + !MESSAGE by defining the macro CFG on the command line. For example: + !MESSAGE + !MESSAGE NMAKE /f "install.mak" CFG="install - Win32 Debug" + !MESSAGE + !MESSAGE Possible choices for configuration are: + !MESSAGE + !MESSAGE "install - Win32 Release" (based on\ + "Win32 (x86) Dynamic-Link Library") + !MESSAGE "install - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") + !MESSAGE + !ERROR An invalid configuration is specified. + !ENDIF + + !IF "$(OS)" == "Windows_NT" + NULL= + !ELSE + NULL=nul + !ENDIF + + CPP=cl.exe + MTL=midl.exe + RSC=rc.exe + + !IF "$(CFG)" == "install - Win32 Release" + + OUTDIR=.\Release + INTDIR=.\Release + # Begin Custom Macros + OutDir=.\Release + # End Custom Macros + + !IF "$(RECURSE)" == "0" + + ALL : "$(OUTDIR)\install.dll" + + !ELSE + + ALL : "$(OUTDIR)\install.dll" + + !ENDIF + + CLEAN : + -@erase "$(INTDIR)\ap_snprintf.obj" + -@erase "$(INTDIR)\install.obj" + -@erase "$(INTDIR)\vc50.idb" + -@erase "$(OUTDIR)\install.dll" + -@erase "$(OUTDIR)\install.exp" + -@erase "$(OUTDIR)\install.lib" + -@erase "$(OUTDIR)\install.map" + + "$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + + CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\..\..\..\include" /I\ + "..\..\..\..\os\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"$(INTDIR)\\"\ + /Fd"$(INTDIR)\\" /FD /c + CPP_OBJS=.\Release/ + CPP_SBRS=. + MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 + BSC32=bscmake.exe + BSC32_FLAGS=/nologo /o"$(OUTDIR)\install.bsc" + BSC32_SBRS= \ + + LINK32=link.exe + LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:windows /dll\ + /incremental:no /pdb:"$(OUTDIR)\install.pdb" /map:"$(INTDIR)\install.map"\ + /machine:I386 /def:".\install.def" /out:"$(OUTDIR)\install.dll"\ + /implib:"$(OUTDIR)\install.lib" + DEF_FILE= \ + ".\install.def" + LINK32_OBJS= \ + "$(INTDIR)\ap_snprintf.obj" \ + "$(INTDIR)\install.obj" + + "$(OUTDIR)\install.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) + << + + !ELSEIF "$(CFG)" == "install - Win32 Debug" + + OUTDIR=.\Debug + INTDIR=.\Debug + # Begin Custom Macros + OutDir=.\Debug + # End Custom Macros + + !IF "$(RECURSE)" == "0" + + ALL : "$(OUTDIR)\install.dll" + + !ELSE + + ALL : "$(OUTDIR)\install.dll" + + !ENDIF + + CLEAN : + -@erase "$(INTDIR)\ap_snprintf.obj" + -@erase "$(INTDIR)\install.obj" + -@erase "$(INTDIR)\vc50.idb" + -@erase "$(INTDIR)\vc50.pdb" + -@erase "$(OUTDIR)\install.dll" + -@erase "$(OUTDIR)\install.exp" + -@erase "$(OUTDIR)\install.ilk" + -@erase "$(OUTDIR)\install.lib" + -@erase "$(OUTDIR)\install.map" + -@erase "$(OUTDIR)\install.pdb" + + "$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + + CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /D "WIN32"\ + /D "_DEBUG" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + CPP_OBJS=.\Debug/ + CPP_SBRS=. + MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 + BSC32=bscmake.exe + BSC32_FLAGS=/nologo /o"$(OUTDIR)\install.bsc" + BSC32_SBRS= \ + + LINK32=link.exe + LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:windows /dll\ + /incremental:yes /pdb:"$(OUTDIR)\install.pdb" /map:"$(INTDIR)\install.map"\ + /debug /machine:I386 /def:".\install.def" /out:"$(OUTDIR)\install.dll"\ + /implib:"$(OUTDIR)\install.lib" /pdbtype:sept + DEF_FILE= \ + ".\install.def" + LINK32_OBJS= \ + "$(INTDIR)\ap_snprintf.obj" \ + "$(INTDIR)\install.obj" + + "$(OUTDIR)\install.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) + << + + !ENDIF + + .c{$(CPP_OBJS)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< + << + + .cpp{$(CPP_OBJS)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< + << + + .cxx{$(CPP_OBJS)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< + << + + .c{$(CPP_SBRS)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< + << + + .cpp{$(CPP_SBRS)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< + << + + .cxx{$(CPP_SBRS)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< + << + + + !IF "$(CFG)" == "install - Win32 Release" || "$(CFG)" ==\ + "install - Win32 Debug" + SOURCE=..\..\..\..\ap\ap_snprintf.c + + !IF "$(CFG)" == "install - Win32 Release" + + DEP_CPP_AP_SN=\ + "..\..\..\..\include\ap.h"\ + "..\..\..\..\include\ap_alloc.h"\ + "..\..\..\..\include\ap_config.h"\ + "..\..\..\..\include\ap_ctype.h"\ + "..\..\..\..\include\ap_mmn.h"\ + "..\..\..\..\include\buff.h"\ + "..\..\..\..\include\hsregex.h"\ + "..\..\..\..\include\httpd.h"\ + "..\..\..\..\include\util_uri.h"\ + "..\..\os.h"\ + "..\..\readdir.h"\ + + NODEP_CPP_AP_SN=\ + "..\..\..\..\include\ap_config_auto.h"\ + "..\..\..\..\include\ebcdic.h"\ + "..\..\..\..\include\sfio.h"\ + + + "$(INTDIR)\ap_snprintf.obj" : $(SOURCE) $(DEP_CPP_AP_SN) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + + !ELSEIF "$(CFG)" == "install - Win32 Debug" + + DEP_CPP_AP_SN=\ + "..\..\..\..\include\ap.h"\ + "..\..\..\..\include\ap_alloc.h"\ + "..\..\..\..\include\ap_config.h"\ + "..\..\..\..\include\ap_ctype.h"\ + "..\..\..\..\include\ap_mmn.h"\ + "..\..\..\..\include\buff.h"\ + "..\..\..\..\include\hsregex.h"\ + "..\..\..\..\include\httpd.h"\ + "..\..\..\..\include\util_uri.h"\ + "..\..\os.h"\ + "..\..\readdir.h"\ + + NODEP_CPP_AP_SN=\ + "..\..\..\..\include\ap_config_auto.h"\ + "..\..\..\..\include\ebcdic.h"\ + "..\..\..\..\include\os.h"\ + "..\..\..\..\include\sfio.h"\ + + + "$(INTDIR)\ap_snprintf.obj" : $(SOURCE) $(DEP_CPP_AP_SN) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + + !ENDIF + + SOURCE=.\install.c + + !IF "$(CFG)" == "install - Win32 Release" + + DEP_CPP_INSTA=\ + "..\..\..\..\include\ap.h"\ + "..\..\..\..\include\ap_config.h"\ + "..\..\..\..\include\ap_ctype.h"\ + "..\..\..\..\include\ap_mmn.h"\ + "..\..\..\..\include\conf.h"\ + "..\..\..\..\include\hsregex.h"\ + "..\..\os.h"\ + + NODEP_CPP_INSTA=\ + "..\..\..\..\include\ap_config_auto.h"\ + + + "$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTA) "$(INTDIR)" + + + !ELSEIF "$(CFG)" == "install - Win32 Debug" + + DEP_CPP_INSTA=\ + "..\..\..\..\include\ap.h"\ + "..\..\..\..\include\ap_config.h"\ + "..\..\..\..\include\ap_ctype.h"\ + "..\..\..\..\include\ap_mmn.h"\ + "..\..\..\..\include\conf.h"\ + "..\..\..\..\include\hsregex.h"\ + "..\..\os.h"\ + + NODEP_CPP_INSTA=\ + "..\..\..\..\include\ap_config_auto.h"\ + "..\..\..\..\include\os.h"\ + + + "$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTA) "$(INTDIR)" + + + !ENDIF + + + !ENDIF + Index: apache13/src/support/ab.c diff -c apache13/src/support/ab.c:1.1.1.8 apache13/src/support/ab.c:1.13 *** apache13/src/support/ab.c:1.1.1.8 Wed Jan 31 21:27:11 2001 --- apache13/src/support/ab.c Wed Jan 31 22:37:40 2001 *************** *** 140,145 **** --- 140,147 ---- #include #endif + #include "sa_len.h" + #endif /* NO_APACHE_INCLUDES */ /* ------------------- DEFINITIONS -------------------------- */ *************** *** 195,201 **** auth[1024], /* optional (basic/uuencoded) * authentification */ hdrs[4096]; /* optional arbitrary headers */ ! int port = 80; /* port number */ int use_html = 0; /* use html in the report */ char *tablestring; --- 197,203 ---- auth[1024], /* optional (basic/uuencoded) * authentification */ hdrs[4096]; /* optional arbitrary headers */ ! char *port = "80"; /* port number */ int use_html = 0; /* use html in the report */ char *tablestring; *************** *** 227,233 **** struct data *stats; /* date for each request */ fd_set readbits, writebits; /* bits for select */ ! struct sockaddr_in server; /* server addr structure */ #ifndef BEOS #define ab_close(s) close(s) --- 229,235 ---- struct data *stats; /* date for each request */ fd_set readbits, writebits; /* bits for select */ ! struct sockaddr_storage server; /* server addr structure */ #ifndef BEOS #define ab_close(s) close(s) *************** *** 332,338 **** printf("\r \r"); printf("Server Software: %s\n", servername); printf("Server Hostname: %s\n", hostname); ! printf("Server Port: %d\n", port); printf("\n"); printf("Document Path: %s\n", path); printf("Document Length: %d bytes\n", doclen); --- 334,340 ---- printf("\r \r"); printf("Server Software: %s\n", servername); printf("Server Hostname: %s\n", hostname); ! printf("Server Port: %s\n", port); printf("\n"); printf("Document Path: %s\n", path); printf("Document Length: %d bytes\n", doclen); *************** *** 531,544 **** c->cbx = 0; c->gotheader = 0; ! c->fd = socket(AF_INET, SOCK_STREAM, 0); if (c->fd < 0) err("socket"); nonblock(c->fd); gettimeofday(&c->start, 0); ! if (connect(c->fd, (struct sockaddr *) & server, sizeof(server)) < 0) { if (errno == EINPROGRESS) { c->state = STATE_CONNECTING; FD_SET(c->fd, &writebits); --- 533,551 ---- c->cbx = 0; c->gotheader = 0; ! c->fd = socket(server.ss_family, SOCK_STREAM, 0); if (c->fd < 0) err("socket"); nonblock(c->fd); gettimeofday(&c->start, 0); ! #ifndef SIN6_LEN ! if (connect(c->fd, (struct sockaddr *) & server, SA_LEN((struct sockaddr*)&server)) < 0) ! #else ! if (connect(c->fd, (struct sockaddr *) &server, server.ss_len) < 0) ! #endif ! { if (errno == EINPROGRESS) { c->state = STATE_CONNECTING; FD_SET(c->fd, &writebits); *************** *** 772,785 **** } { ! /* get server information */ ! struct hostent *he; ! he = gethostbyname(hostname); ! if (!he) ! err("bad hostname"); ! server.sin_family = he->h_addrtype; ! server.sin_port = htons(port); ! server.sin_addr.s_addr = ((unsigned long *) (he->h_addr_list[0]))[0]; } con = malloc(concurrency * sizeof(struct connection)); --- 779,795 ---- } { ! /* get server information */ ! struct addrinfo hints, *res; ! int error; ! ! memset(&hints, 0, sizeof(hints)); ! hints.ai_family = PF_UNSPEC; ! error = getaddrinfo(hostname, port, &hints, &res); ! if (error) ! err("bad hostname"); ! memcpy(&server, res->ai_addr, res->ai_addrlen); ! freeaddrinfo(res); } con = malloc(concurrency * sizeof(struct connection)); *************** *** 954,960 **** *cp = '\0'; strcpy(hostname, h); if (p != NULL) ! port = atoi(p); return 0; } --- 964,970 ---- *cp = '\0'; strcpy(hostname, h); if (p != NULL) ! port = strdup(p); return 0; } *************** *** 1131,1133 **** --- 1141,1147 ---- exit(0); } + + #ifdef NEED_GETADDRINFO + #include "../main/getaddrinfo.c" + #endif Index: apache13/src/support/logresolve.c diff -c apache13/src/support/logresolve.c:1.1.1.4 apache13/src/support/logresolve.c:1.13 *** apache13/src/support/logresolve.c:1.1.1.4 Sat Oct 14 00:49:25 2000 --- apache13/src/support/logresolve.c Wed Nov 8 02:28:30 2000 *************** *** 54,60 **** #endif /* BEOS */ #endif /* !MPE && !WIN32*/ ! static void cgethost(struct in_addr ipnum, char *string, int check); static int getline(char *s, int n); static void stats(FILE *output); --- 54,62 ---- #endif /* BEOS */ #endif /* !MPE && !WIN32*/ ! #include "sa_len.h" ! ! static void cgethost(struct sockaddr *sa, char *string, int check); static int getline(char *s, int n); static void stats(FILE *output); *************** *** 91,97 **** */ struct nsrec { ! struct in_addr ipnum; char *hostname; int noname; struct nsrec *next; --- 93,99 ---- */ struct nsrec { ! struct sockaddr_storage addr; char *hostname; int noname; struct nsrec *next; *************** *** 122,138 **** * IP numbers with their IP number as hostname, setting noname flag */ ! static void cgethost (struct in_addr ipnum, char *string, int check) { struct nsrec **current, *new; - struct hostent *hostdata; char *name; ! current = &nscache[((ipnum.s_addr + (ipnum.s_addr >> 8) + ! (ipnum.s_addr >> 16) + (ipnum.s_addr >> 24)) % BUCKETS)]; - while (*current != NULL && ipnum.s_addr != (*current)->ipnum.s_addr) current = &(*current)->next; if (*current == NULL) { cachesize++; --- 124,171 ---- * IP numbers with their IP number as hostname, setting noname flag */ ! static void cgethost (struct sockaddr *sa, char *string, int check) { + ap_uint32_t hashval; + struct sockaddr_in *sin; + #ifdef INET6 + struct sockaddr_in6 *sin6; + #endif struct nsrec **current, *new; char *name; + char hostnamebuf[MAXHOSTNAMELEN]; + + switch (sa->sa_family) { + case AF_INET: + hashval = ((struct sockaddr_in *)sa)->sin_addr.s_addr; + break; + #ifdef INET6 + case AF_INET6: + hashval = *(ap_uint32_t *)&((struct sockaddr_in6 *)sa)->sin6_addr.s6_addr[12]; + break; + #endif + default: + hashval = 0; + break; + } + + current = &nscache[((hashval + (hashval >> 8) + + (hashval >> 16) + (hashval >> 24)) % BUCKETS)]; ! while (*current) { ! #ifndef SIN6_LEN ! if (SA_LEN(sa) == SA_LEN((struct sockaddr *)&(*current)->addr) ! && memcmp(sa, &(*current)->addr, SA_LEN(sa)) == 0) ! #else ! if (sa->sa_len == (*current)->addr.ss_len ! && memcmp(sa, &(*current)->addr, sa->sa_len) == 0) ! #endif ! { ! break; ! } current = &(*current)->next; + } if (*current == NULL) { cachesize++; *************** *** 145,189 **** *current = new; new->next = NULL; ! new->ipnum = ipnum; ! hostdata = gethostbyaddr((const char *) &ipnum, sizeof(struct in_addr), ! AF_INET); ! if (hostdata == NULL) { ! if (h_errno > MAX_ERR) ! errors[UNKNOWN_ERR]++; ! else ! errors[h_errno]++; ! new->noname = h_errno; ! name = strdup(inet_ntoa(ipnum)); ! } ! else { ! new->noname = 0; ! name = strdup(hostdata->h_name); ! if (check) { ! if (name == NULL) { ! perror("strdup"); ! fprintf(stderr, "Insufficient memory\n"); ! exit(1); ! } ! hostdata = gethostbyname(name); ! if (hostdata != NULL) { ! char **hptr; ! ! for (hptr = hostdata->h_addr_list; *hptr != NULL; hptr++) ! if (((struct in_addr *) (*hptr))->s_addr == ipnum.s_addr) ! break; ! if (*hptr == NULL) ! hostdata = NULL; ! } ! if (hostdata == NULL) { ! fprintf(stderr, "Bad host: %s != %s\n", name, ! inet_ntoa(ipnum)); ! new->noname = NO_REVERSE; ! free(name); ! name = strdup(inet_ntoa(ipnum)); ! errors[NO_REVERSE]++; } } } new->hostname = name; --- 178,232 ---- *current = new; new->next = NULL; ! #ifndef SIN6_LEN ! memcpy(&new->addr, sa, SA_LEN(sa)); ! #else ! memcpy(&new->addr, sa, sa->sa_len); ! #endif ! new->noname = getnameinfo(sa, ! #ifndef SIN6_LEN ! SA_LEN(sa), ! #else ! sa->sa_len, ! #endif ! hostnamebuf, sizeof(hostnamebuf), NULL, 0, 0); ! name = strdup(hostnamebuf); ! if (check) { ! struct addrinfo hints, *res; ! int error; ! memset(&hints, 0, sizeof(hints)); ! hints.ai_family = PF_UNSPEC; ! error = getaddrinfo(hostnamebuf, NULL, &hints, &res); ! if (!error) { ! while (res) { ! #ifndef SIN6_LEN ! if (SA_LEN(sa) == res->ai_addrlen ! && memcmp(sa, res->ai_addr, SA_LEN(sa)) == 0) ! #else ! if (sa->sa_len == res->ai_addrlen ! && memcmp(sa, res->ai_addr, sa->sa_len) == 0) ! #endif ! { ! break; ! } ! res = res->ai_next; } + if (!res) + error++; + } + if (error) { + getnameinfo(sa, + #ifndef SIN6_LEN + SA_LEN(sa), + #else + sa->sa_len, + #endif + hostnamebuf, sizeof(hostnamebuf), NULL, 0, NI_NUMERICHOST); + fprintf(stderr, "Bad host: %s != %s\n", name, hostnamebuf); + new->noname = NO_REVERSE; + free(name); + name = strdup(hostnamebuf); } } new->hostname = name; *************** *** 211,216 **** --- 254,260 ---- char *ipstring; struct nsrec *current; char *errstring[MAX_ERR + 3]; + char hostnamebuf[MAXHOSTNAMELEN]; for (i = 0; i < MAX_ERR + 3; i++) errstring[i] = "Unknown error"; *************** *** 242,248 **** for (i = 0; i < BUCKETS; i++) for (current = nscache[i]; current != NULL; current = current->next) { ! ipstring = inet_ntoa(current->ipnum); if (current->noname == 0) fprintf(output, " %3d %15s - %s\n", i, ipstring, current->hostname); --- 286,299 ---- for (i = 0; i < BUCKETS; i++) for (current = nscache[i]; current != NULL; current = current->next) { ! getnameinfo((struct sockaddr *)¤t->addr, ! #ifndef SIN6_LEN ! SA_LEN((struct sockaddr *)¤t->addr), ! #else ! current->addr.ss_len, ! #endif ! hostnamebuf, sizeof(hostnamebuf), NULL, 0, NI_NUMERICHOST); ! ipstring = hostnamebuf; if (current->noname == 0) fprintf(output, " %3d %15s - %s\n", i, ipstring, current->hostname); *************** *** 276,284 **** int main (int argc, char *argv[]) { - struct in_addr ipnum; char *bar, hoststring[MAXDNAME + 1], line[MAXLINE], *statfile; int i, check; #ifdef WIN32 WSADATA wsaData; --- 327,336 ---- int main (int argc, char *argv[]) { char *bar, hoststring[MAXDNAME + 1], line[MAXLINE], *statfile; int i, check; + struct addrinfo hints, *res; + int error; #ifdef WIN32 WSADATA wsaData; *************** *** 322,329 **** bar = strchr(line, ' '); if (bar != NULL) *bar = '\0'; ! ipnum.s_addr = inet_addr(line); ! if (ipnum.s_addr == 0xffffffffu) { if (bar != NULL) *bar = ' '; puts(line); --- 374,383 ---- bar = strchr(line, ' '); if (bar != NULL) *bar = '\0'; ! memset(&hints, 0, sizeof(hints)); ! hints.ai_family = PF_UNSPEC; ! error = getaddrinfo(line, NULL, &hints, &res); ! if (error) { if (bar != NULL) *bar = ' '; puts(line); *************** *** 333,343 **** resolves++; ! cgethost(ipnum, hoststring, check); if (bar != NULL) printf("%s %s\n", hoststring, bar + 1); else puts(hoststring); } #ifdef WIN32 --- 387,398 ---- resolves++; ! cgethost(res->ai_addr, hoststring, check); if (bar != NULL) printf("%s %s\n", hoststring, bar + 1); else puts(hoststring); + freeaddrinfo(res); } #ifdef WIN32 *************** *** 358,360 **** --- 413,423 ---- return (0); } + + #ifdef NEED_GETADDRINFO + #include "../main/getaddrinfo.c" + #endif + + #ifdef NEED_GETNAMEINFO + #include "../main/getnameinfo.c" + #endif