diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-12-22 03:00:54 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-12-22 03:00:54 +0000 |
commit | a34740287ce7a6f408b47749029e29e62a63724d (patch) | |
tree | 13f8befc1c6c0e2609a6403023c6c02fb664b6fb /sbin/dmesg/dmesg.c | |
parent | 89eb7cbe0b8c6777a04791593b7b4589ea36938f (diff) |
Deal with _POSIX_SAVED_IDS when relinquishing privileges
Diffstat (limited to 'sbin/dmesg/dmesg.c')
-rw-r--r-- | sbin/dmesg/dmesg.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/dmesg/dmesg.c b/sbin/dmesg/dmesg.c index ad9e1385b67..1782a131b08 100644 --- a/sbin/dmesg/dmesg.c +++ b/sbin/dmesg/dmesg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dmesg.c,v 1.2 1996/06/23 14:30:08 deraadt Exp $ */ +/* $OpenBSD: dmesg.c,v 1.3 1996/12/22 03:00:49 deraadt Exp $ */ /* $NetBSD: dmesg.c,v 1.8 1995/03/18 14:54:49 cgd Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)dmesg.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: dmesg.c,v 1.2 1996/06/23 14:30:08 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: dmesg.c,v 1.3 1996/12/22 03:00:49 deraadt Exp $"; #endif #endif /* not lint */ @@ -105,8 +105,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 (memf != NULL || nlistf != NULL) + if (memf != NULL || nlistf != NULL) { + setegid(getgid()); setgid(getgid()); + } /* Read in kernel message buffer, do sanity checks. */ if ((kd = kvm_open(nlistf, memf, NULL, O_RDONLY, "dmesg")) == NULL) |