diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-12-22 03:29:13 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-12-22 03:29:13 +0000 |
commit | c685da080d7d6ef4da40968519030fcf518289f4 (patch) | |
tree | 3d3c481aab15688149f43911b9e9fa5b610d15b9 /usr.sbin/pstat/pstat.c | |
parent | b9e51bce4b9f1693731b39bfbb2873af2e60d83c (diff) |
Deal with _POSIX_SAVED_IDS when relinquishing privileges
Diffstat (limited to 'usr.sbin/pstat/pstat.c')
-rw-r--r-- | usr.sbin/pstat/pstat.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c index e1910895f99..8dd039749da 100644 --- a/usr.sbin/pstat/pstat.c +++ b/usr.sbin/pstat/pstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pstat.c,v 1.6 1996/11/24 23:42:11 millert Exp $ */ +/* $OpenBSD: pstat.c,v 1.7 1996/12/22 03:29:03 deraadt Exp $ */ /* $NetBSD: pstat.c,v 1.27 1996/10/23 22:50:06 cgd Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 from: static char sccsid[] = "@(#)pstat.c 8.9 (Berkeley) 2/16/94"; #else -static char *rcsid = "$OpenBSD: pstat.c,v 1.6 1996/11/24 23:42:11 millert Exp $"; +static char *rcsid = "$OpenBSD: pstat.c,v 1.7 1996/12/22 03:29:03 deraadt Exp $"; #endif #endif /* not lint */ @@ -208,8 +208,10 @@ main(argc, argv) * Discard setgid privileges if not the running kernel so that bad * guys can't print interesting stuff from kernel memory. */ - if (nlistf != NULL || memf != NULL) + if (nlistf != NULL || memf != NULL) { + (void)setegid(getgid()); (void)setgid(getgid()); + } if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, buf)) == 0) errx(1, "kvm_openfiles: %s", buf); |