summaryrefslogtreecommitdiff
path: root/usr.sbin/trpt/trpt.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-22 03:29:13 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-22 03:29:13 +0000
commitc685da080d7d6ef4da40968519030fcf518289f4 (patch)
tree3d3c481aab15688149f43911b9e9fa5b610d15b9 /usr.sbin/trpt/trpt.c
parentb9e51bce4b9f1693731b39bfbb2873af2e60d83c (diff)
Deal with _POSIX_SAVED_IDS when relinquishing privileges
Diffstat (limited to 'usr.sbin/trpt/trpt.c')
-rw-r--r--usr.sbin/trpt/trpt.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/trpt/trpt.c b/usr.sbin/trpt/trpt.c
index 7f5769884cf..3bab7298bd0 100644
--- a/usr.sbin/trpt/trpt.c
+++ b/usr.sbin/trpt/trpt.c
@@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)trpt.c 5.14 (Berkeley) 7/1/91";*/
-static char rcsid[] = "$Id: trpt.c,v 1.3 1996/06/03 18:06:18 deraadt Exp $";
+static char rcsid[] = "$Id: trpt.c,v 1.4 1996/12/22 03:29:10 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -167,8 +167,10 @@ main(argc, argv)
* Discard setgid priviledges if not the running kernel so that bad
* guys can't print interesting stuff from kernel memory.
*/
- if (!strcmp(core, _PATH_KMEM) || !strcmp(system, _PATH_UNIX))
+ if (!strcmp(core, _PATH_KMEM) || !strcmp(system, _PATH_UNIX)) {
+ setegid(getgid());
setgid(getgid());
+ }
if (nlist(system, nl) < 0 || !nl[0].n_value) {
fprintf(stderr, "trpt: %s: no namelist\n", system);