-/* $OpenBSD: who.c,v 1.27 2015/10/21 16:06:57 millert Exp $ */
+/* $OpenBSD: who.c,v 1.28 2018/08/08 22:55:14 deraadt Exp $ */
/* $NetBSD: who.c,v 1.4 1994/12/07 04:28:49 jtc Exp $ */
/*
setlocale(LC_ALL, "");
- if (pledge("stdio rpath getpw", NULL) == -1)
+ if (pledge("stdio unveil rpath getpw", NULL) == -1)
err(1, "pledge");
if ((mytty = ttyname(0))) {
if (show_labels)
output_labels();
+ if (unveil(_PATH_UTMP, "r") == -1)
+ err(1, "unveil");
switch (argc) {
case 0: /* who */
+ if (pledge("stdio rpath getpw", NULL) == -1)
+ err(1, "pledge");
ufp = file(_PATH_UTMP);
if (only_current_term) {
}
break;
case 1: /* who utmp_file */
+ if (unveil(*argv, "r") == -1)
+ err(1, "unveil");
+ if (pledge("stdio rpath getpw", NULL) == -1)
+ err(1, "pledge");
ufp = file(*argv);
if (only_current_term) {
}
break;
case 2: /* who am i */
+ if (pledge("stdio rpath getpw", NULL) == -1)
+ err(1, "pledge");
ufp = file(_PATH_UTMP);
who_am_i(ufp);
break;