diff options
author | 2016-01-02 13:22:52 +0000 | |
---|---|---|
committer | 2016-01-02 13:22:52 +0000 | |
commit | 4088cd90b6e57a79891c769bb12acffb3a83582f (patch) | |
tree | d848da49cf8c1b95619937d2ab0e2be407c27e16 | |
parent | Add dired-find-alternate-file. (diff) | |
download | wireguard-openbsd-4088cd90b6e57a79891c769bb12acffb3a83582f.tar.xz wireguard-openbsd-4088cd90b6e57a79891c769bb12acffb3a83582f.zip |
fixes fuser(1) when invoking with -u: it requires "getpw" promise.
problem reported by Michael Reed m.reed at mykolab dot com.
ok tb@ and benno@ (which as provided near the same diff, but 5min later :p)
-rw-r--r-- | usr.bin/fstat/fstat.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index cc51086a262..281527019f2 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fstat.c,v 1.85 2015/12/30 19:02:12 mestre Exp $ */ +/* $OpenBSD: fstat.c,v 1.86 2016/01/02 13:22:52 semarie Exp $ */ /* * Copyright (c) 2009 Todd C. Miller <Todd.Miller@courtesan.com> @@ -276,7 +276,18 @@ main(int argc, char *argv[]) errx(1, "%s", kvm_geterr(kd)); if (fuser) { - if (sflg) { /* fuser might call kill(2) */ + /* + * fuser + * uflg: need "getpw" + * sflg: need "proc" (might call kill(2)) + */ + if (uflg && sflg) { + if (pledge("stdio rpath getpw proc", NULL) == -1) + err(1, "pledge"); + } else if (uflg) { + if (pledge("stdio rpath getpw", NULL) == -1) + err(1, "pledge"); + } else if (sflg) { if (pledge("stdio rpath proc", NULL) == -1) err(1, "pledge"); } else { @@ -284,6 +295,7 @@ main(int argc, char *argv[]) err(1, "pledge"); } } else { + /* fstat */ if (pledge("stdio rpath getpw", NULL) == -1) err(1, "pledge"); } |