summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Marie <semarie@cvs.openbsd.org>2020-08-27 15:20:32 +0000
committerSebastien Marie <semarie@cvs.openbsd.org>2020-08-27 15:20:32 +0000
commit94bcca4fbf7479ac39513381ea7ca7f39753e71a (patch)
tree81ad927d511e10711d2278cac332c56396f0a1ff
parent439c0db90580c9f62a7365071eb643fbf579a533 (diff)
unveil(_PATH_DEV, "r") when -T or -u is used: who(1) is using stat(2) for determining the status of the tty
ok deraadt@
-rw-r--r--usr.bin/who/who.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/who/who.c b/usr.bin/who/who.c
index 02cfb420543..a625d440582 100644
--- a/usr.bin/who/who.c
+++ b/usr.bin/who/who.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: who.c,v 1.28 2018/08/08 22:55:14 deraadt Exp $ */
+/* $OpenBSD: who.c,v 1.29 2020/08/27 15:20:31 semarie Exp $ */
/* $NetBSD: who.c,v 1.4 1994/12/07 04:28:49 jtc Exp $ */
/*
@@ -124,6 +124,10 @@ main(int argc, char *argv[])
if (unveil(_PATH_UTMP, "r") == -1)
err(1, "unveil");
+ if (show_term || show_idle) {
+ if (unveil(_PATH_DEV, "r") == -1)
+ err(1, "unveil");
+ }
switch (argc) {
case 0: /* who */
if (pledge("stdio rpath getpw", NULL) == -1)