diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2005-07-04 01:54:12 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2005-07-04 01:54:12 +0000 |
commit | 111f17112e935f1768e0da7a24ee15f428f61872 (patch) | |
tree | b1f09cb1f6a1931201c21470d665ce24d382e1b5 /usr.bin/msgs/msgs.c | |
parent | f1530fb5e1f6818aafdfeef038b0b7a755aa35e0 (diff) |
make these use setres[ug]id for simple privilege dropping;
ok deraadt@ millert@ moritz@
Diffstat (limited to 'usr.bin/msgs/msgs.c')
-rw-r--r-- | usr.bin/msgs/msgs.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/msgs/msgs.c b/usr.bin/msgs/msgs.c index 66091e883cb..d16e6fa93e4 100644 --- a/usr.bin/msgs/msgs.c +++ b/usr.bin/msgs/msgs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msgs.c,v 1.29 2004/10/02 04:14:39 deraadt Exp $ */ +/* $OpenBSD: msgs.c,v 1.30 2005/07/04 01:54:10 djm Exp $ */ /* $NetBSD: msgs.c,v 1.7 1995/09/28 06:57:40 tls Exp $ */ /*- @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)msgs.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$OpenBSD: msgs.c,v 1.29 2004/10/02 04:14:39 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: msgs.c,v 1.30 2005/07/04 01:54:10 djm Exp $"; #endif #endif /* not lint */ @@ -173,8 +173,11 @@ main(int argc, char *argv[]) #endif time(&t); - seteuid(uid = getuid()); - setuid(uid); + uid = getuid(); + if (setresuid(uid, uid, uid) == -1) { + perror("setresuid"); + exit(1); + } ruptible = (signal(SIGINT, SIG_IGN) == SIG_DFL); if (ruptible) signal(SIGINT, SIG_DFL); |