diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2005-05-03 05:42:06 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2005-05-03 05:42:06 +0000 |
commit | ccea40a793d4d704e3b9ed9dc47d3160081ee0b0 (patch) | |
tree | f96a26e90c44f33b4b87bc600ad9ea764af4c30c /usr.sbin/mrinfo | |
parent | 2629e2054818c659af3208b59cac5865528119ee (diff) |
setresuid; ok deraadt@
Diffstat (limited to 'usr.sbin/mrinfo')
-rw-r--r-- | usr.sbin/mrinfo/mrinfo.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/mrinfo/mrinfo.c b/usr.sbin/mrinfo/mrinfo.c index 05b8ee76132..6c6f0757adc 100644 --- a/usr.sbin/mrinfo/mrinfo.c +++ b/usr.sbin/mrinfo/mrinfo.c @@ -76,7 +76,7 @@ #ifndef lint static char rcsid[] = - "@(#) $OpenBSD: mrinfo.c,v 1.19 2004/02/26 20:48:29 tedu Exp $"; + "@(#) $OpenBSD: mrinfo.c,v 1.20 2005/05/03 05:42:05 djm Exp $"; /* original rcsid: "@(#) Header: mrinfo.c,v 1.6 93/04/08 15:14:16 van Exp (LBL)"; */ @@ -316,6 +316,7 @@ main(int argc, char *argv[]) socklen_t addrlen; struct timeval et; char *host; + uid_t uid; if (geteuid() != 0) { fprintf(stderr, "mrinfo: must be root\n"); @@ -323,8 +324,10 @@ main(int argc, char *argv[]) } init_igmp(); - seteuid(getuid()); - setuid(getuid()); + + uid = getuid(); + if (setresuid(uid, uid, uid) == -1) + err(1, "setresuid"); setlinebuf(stderr); |