httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject [PATCH] catch a bad vhost config
Date Thu, 11 Mar 2004 20:57:20 GMT
By uncommenting just one line from the default config you can get to 
this misconfiguration:

NameVirtualHost *:80
<VirtualHost _default_:443>
</VirtualHost>

which is not handled properly by the vhost code - httpd serves requests
with c->base_server == NULL, httpd -tS segfaults, etc.

The check below in vhost.c:remove_unused_name_vhosts seems to be the
cause: it stops traversing default_list if it finds any _default_ vhost,
so the bogus ipaddr_chain structure further on is never removed; I don't
see what this check is for.

--- server/vhost.c	11 Mar 2004 19:46:35 -0000	1.85
+++ server/vhost.c	11 Mar 2004 20:34:20 -0000
@@ -500,12 +500,6 @@
                          ic->sar->virthost, ic->sar->host_port);
             *pic = ic->next;
         }
-        else if (ic->names == NULL) {
-            /* if server != NULL and names == NULL then we're done
-             * looking at NameVirtualHosts
-             */
-            break;
-        }
         else {
             pic = &ic->next;
         }

with this applied the bogus ipaddr_chain is found and removed:

[Thu Mar 11 20:36:38 2004] [warn] NameVirtualHost *:80 has no VirtualHosts

and everything seems to work fine.  I'm not really familiar with this
code - any comments?

joe

Mime
View raw message