summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2018-08-15 14:43:31 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2018-08-15 14:43:31 +0000
commitc53d02337730b21b092f2ff3b8cab7a17f1ccae1 (patch)
tree5683f819ed18dd276239a7393a84d7d187c9787a
parent5c35c24c8724be119bce73803aabbcb8a6d15a1d (diff)
Restore ability to use hostnames to configure ip addresses.
Unveil /etc/{resolv.conf,hosts,services} which keeps it in sync with the kernel bypass for pledge("dns"). OK deraadt pointed out by & OK stsp
-rw-r--r--sbin/ifconfig/ifconfig.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index f36de2829e2..d14bb54e051 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.375 2018/08/12 23:50:31 ccardenas Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.376 2018/08/15 14:43:30 florian Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -749,7 +749,11 @@ main(int argc, char *argv[])
}
if (!found_rulefile) {
- if (unveil("/", "") == -1)
+ if (unveil("/etc/resolv.conf", "r") == -1)
+ err(1, "unveil");
+ if (unveil("/etc/hosts", "r") == -1)
+ err(1, "unveil");
+ if (unveil("/etc/services", "r") == -1)
err(1, "unveil");
if (unveil(NULL, NULL) == -1)
err(1, "unveil");