>Synopsis: httpd.conf duplicate location detection fails
>Category: httpd
>Environment:
System : OpenBSD 6.5
Details : OpenBSD 6.5-stable (GENERIC.MP) #3: Fri Aug 9 13:24:06
CEST 2019
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
Architecture: OpenBSD.amd64
Machine : amd64
>Description:
>How-To-Repeat:
1. Within httpd.conf, inside an arbitrary 'server' configuration
section, define some location:
location "/foobar" { block }
2. Define the same location again. So you get:
location "/foobar" { block }
location "/foobar" { block }
3. Start up httpd:
# httpd -vvd
4. httpd starts normally even though we would expect the duplicate
location to be detected and the server startup being aborted.
>Fix:
Apply the following patch to /usr/src/usr.sbin/httpd/parse.y
and recompile.
@@ -564,7 +564,8 @@
TAILQ_FOREACH(s, conf->sc_servers, srv_entry) {
if ((s->srv_conf.flags & SRVFLAG_LOCATION) &&
- s->srv_conf.id == srv_conf->id &&
+ s->srv_conf.parent_id ==
+ srv_conf->parent_id &&
strcmp(s->srv_conf.location,
srv_conf->location) == 0)
break;