$NetBSD: patch-ac,v 1.6 2002/08/10 13:43:09 fredb Exp $ --- src/wwwoffled.c.orig Sun Jun 23 06:02:35 2002 +++ src/wwwoffled.c @@ -279,8 +279,7 @@ if(uid!=-1 || gid!=-1) PrintMessage(Inform,"Running with uid=%d, gid=%d.",geteuid(),getegid()); - - /* Bind the HTTP proxy sockets. */ + /* Bind the HTTP proxy socket(s). */ #if USE_IPV6 if(ConfigString(Bind_IPv6)) @@ -291,40 +290,33 @@ } #endif -#if USE_IPV6 - if(http_fd[1]!=-1 && ConfigString(Bind_IPv4) && ConfigString(Bind_IPv6) && - !strcmp(ConfigString(Bind_IPv6),"0:0:0:0:0:0:0:0") && !strcmp(ConfigString(Bind_IPv4),"0.0.0.0")) - PrintMessage(Inform,"Not creating HTTP IPv4 server socket on all addresses since IPv6 one is bound to all addresses."); - else + if(ConfigString(Bind_IPv4)) { -#endif - if(ConfigString(Bind_IPv4)) + http_fd[0]=OpenServerSocket(ConfigString(Bind_IPv4),ConfigInteger(HTTP_Port)); + if(http_fd[0]==-1) { - http_fd[0]=OpenServerSocket(ConfigString(Bind_IPv4),ConfigInteger(HTTP_Port)); - if(http_fd[0]==-1) - { #if USE_IPV6 + if(http_fd[1]!=-1 && ConfigString(Bind_IPv4) && !strcmp(ConfigString(Bind_IPv4),"0.0.0.0") && + ConfigString(Bind_IPv6) && !strcmp(ConfigString(Bind_IPv6),"0:0:0:0:0:0:0:0")) + PrintMessage(Warning,"Cannot create HTTP IPv4 server socket (but the IPv6 one might accept IPv4 connections)."); + else PrintMessage(Fatal,"Cannot create HTTP IPv4 server socket."); #else - PrintMessage(Fatal,"Cannot create HTTP server socket."); + PrintMessage(Fatal,"Cannot create HTTP server socket."); #endif - } } -#if USE_IPV6 } -#endif if(http_fd[0]==-1 && http_fd[1]==-1) { #if USE_IPV6 - PrintMessage(Fatal,"Neither IPv4 or IPv6 HTTP socket could be bound."); + PrintMessage(Fatal,"The IPv4 and IPv6 HTTP sockets were not bound; are they disabled in the config file?"); #else - PrintMessage(Fatal,"The HTTP socket could not be bound."); + PrintMessage(Fatal,"The HTTP socket was not bound; are they disabled in the config file?"); #endif } - - /* Bind the WWWOFFLE control sockets. */ + /* Bind the WWWOFFLE control socket(s). */ #if USE_IPV6 if(ConfigString(Bind_IPv6)) @@ -335,35 +327,29 @@ } #endif -#if USE_IPV6 - if(wwwoffle_fd[1]!=-1 && ConfigString(Bind_IPv4) && ConfigString(Bind_IPv6) && - !strcmp(ConfigString(Bind_IPv6),"0:0:0:0:0:0:0:0") && !strcmp(ConfigString(Bind_IPv4),"0.0.0.0")) - PrintMessage(Inform,"Not creating WWWOFFLE IPv4 server socket on all addresses since IPv6 one is bound to all addresses."); - else + if(ConfigString(Bind_IPv4)) { -#endif - if(ConfigString(Bind_IPv4)) + wwwoffle_fd[0]=OpenServerSocket(ConfigString(Bind_IPv4),ConfigInteger(WWWOFFLE_Port)); + if(wwwoffle_fd[0]==-1) { - wwwoffle_fd[0]=OpenServerSocket(ConfigString(Bind_IPv4),ConfigInteger(WWWOFFLE_Port)); - if(wwwoffle_fd[0]==-1) - { #if USE_IPV6 + if(wwwoffle_fd[1]!=-1 && ConfigString(Bind_IPv4) && !strcmp(ConfigString(Bind_IPv4),"0.0.0.0") && + ConfigString(Bind_IPv6) && !strcmp(ConfigString(Bind_IPv6),"0:0:0:0:0:0:0:0")) + PrintMessage(Warning,"Cannot create WWWOFFLE IPv4 server socket (but the IPv6 one might accept IPv4 connections)."); + else PrintMessage(Fatal,"Cannot create WWWOFFLE IPv4 server socket."); #else - PrintMessage(Fatal,"Cannot create WWWOFFLE server socket."); + PrintMessage(Fatal,"Cannot create WWWOFFLE server socket."); #endif - } } -#if USE_IPV6 } -#endif if(wwwoffle_fd[0]==-1 && wwwoffle_fd[1]==-1) { #if USE_IPV6 - PrintMessage(Fatal,"Neither IPv4 or IPv6 WWWOFFLE socket could be bound."); + PrintMessage(Fatal,"The IPv4 and IPv6 WWWOFFLE sockets were not bound; are they disabled in the config file?"); #else - PrintMessage(Fatal,"The WWWOFFLE socket could not be bound."); + PrintMessage(Fatal,"The WWWOFFLE socket was not bound; are they disabled in the config file?"); #endif }