summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2016-03-19 00:11:49 +0000
committerderaadt <deraadt@openbsd.org>2016-03-19 00:11:49 +0000
commitd44429206e51af0a04813710f68a3dfb285f2151 (patch)
treecdc0901679c6255acfc9de29aafafeb9e40c2854
parent+.Xr ipsec.conf 5 , (diff)
downloadwireguard-openbsd-d44429206e51af0a04813710f68a3dfb285f2151.tar.xz
wireguard-openbsd-d44429206e51af0a04813710f68a3dfb285f2151.zip
if -a is specified, allow "dns" in pledge requests.
problem noticed by Raf Czlonka
-rw-r--r--usr.bin/w/w.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index 596b2b48194..d8d736238ea 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: w.c,v 1.60 2015/10/23 03:26:24 deraadt Exp $ */
+/* $OpenBSD: w.c,v 1.61 2016/03/19 00:11:49 deraadt Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -112,9 +112,6 @@ main(int argc, char *argv[])
char *memf, *nlistf, *p, *x;
char buf[HOST_NAME_MAX+1], errbuf[_POSIX2_LINE_MAX];
- if (pledge("stdio tty rpath ps vminfo", NULL) == -1)
- err(1, "pledge");
-
/* Are we w(1) or uptime(1)? */
p = __progname;
if (*p == '-')
@@ -158,6 +155,14 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
+ if (nflag == 0) {
+ if (pledge("stdio tty rpath dns ps vminfo", NULL) == -1)
+ err(1, "pledge");
+ } else {
+ if (pledge("stdio tty rpath ps vminfo", NULL) == -1)
+ err(1, "pledge");
+ }
+
if (nlistf == NULL && memf == NULL) {
if ((kd = kvm_openfiles(nlistf, memf, NULL, KVM_NO_FILES,
errbuf)) == NULL)