diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2005-05-03 01:01:16 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2005-05-03 01:01:16 +0000 |
commit | 6e3d4669e24109b707ee132715b0e72c4f4049ab (patch) | |
tree | 35cdb910d7fd60d0b1c36c4322665398cb0ea552 /usr.sbin/traceroute | |
parent | d7a12bc06a5691c87253eb610bad11c519521e3a (diff) |
more setres[ug]id; ok deraadt@
Diffstat (limited to 'usr.sbin/traceroute')
-rw-r--r-- | usr.sbin/traceroute/traceroute.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c index 7edd4530ed5..f2046dd54a7 100644 --- a/usr.sbin/traceroute/traceroute.c +++ b/usr.sbin/traceroute/traceroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traceroute.c,v 1.62 2005/03/01 16:13:29 markus Exp $ */ +/* $OpenBSD: traceroute.c,v 1.63 2005/05/03 01:01:13 djm Exp $ */ /* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */ /*- @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)traceroute.c 8.1 (Berkeley) 6/6/93";*/ #else -static char rcsid[] = "$OpenBSD: traceroute.c,v 1.62 2005/03/01 16:13:29 markus Exp $"; +static char rcsid[] = "$OpenBSD: traceroute.c,v 1.63 2005/05/03 01:01:13 djm Exp $"; #endif #endif /* not lint */ @@ -307,6 +307,7 @@ main(int argc, char *argv[]) u_int8_t ttl; char *ep; long l; + uid_t uid; if ((s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0) err(5, "icmp socket"); @@ -314,8 +315,9 @@ main(int argc, char *argv[]) err(5, "raw socket"); /* revoke privs */ - seteuid(getuid()); - setuid(getuid()); + uid = getuid(); + if (setresuid(uid, uid, uid) == -1) + err(1, "setresuid"); (void) sysctl(mib, sizeof(mib)/sizeof(mib[0]), &max_ttl, &size, NULL, 0); |