Hi people,
httpd needs to pledge `dns' for name resolution to work while loading
the configuration:
# cat /tmp/test.conf
server "default" {
listen on imnotlocal port 80
}
# httpd -dnvf /tmp/test.conf
Abort trap
# dmesg | tail -n1
httpd(18331): syscall 97 "dns"
The issue is that `imnotlocal' is not a hostname that can be looked
up without DNS requests. `localhost' and entries in /etc/hosts work
fine for example. The attached patch adds `dns' to the pledge list
in httpd.c.
--
Gregor
Index: httpd.c
===================================================================
RCS file: /mnt/media/cvs/src/usr.sbin/httpd/httpd.c,v
retrieving revision 1.50
diff -u -p -r1.50 httpd.c
--- httpd.c 23 Nov 2015 20:56:14 -0000 1.50
+++ httpd.c 2 Dec 2015 21:11:49 -0000
@@ -251,7 +251,8 @@ main(int argc, char *argv[])
setproctitle("parent");
log_procinit("parent");
- if (pledge("stdio rpath wpath cpath inet proc ioctl sendfd",
+ /* dns is required for load_config */
+ if (pledge("stdio rpath wpath cpath inet proc ioctl dns sendfd",
NULL) == -1)
fatal("pledge");