summaryrefslogtreecommitdiff
path: root/usr.sbin/traceroute
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2018-10-20 19:55:02 +0000
committerkn <kn@cvs.openbsd.org>2018-10-20 19:55:02 +0000
commit80d29f9adc34f73040ffe8fa9fb9ae3c570bb625 (patch)
tree4a96c246e6913eeaeb52744c0d9d0d7e57a3fbef /usr.sbin/traceroute
parenta4008b0e33eba7d358e6dd5b7f6f9c2dcbd4c75c (diff)
Sync root check from ping
Sync ping.c r1.217 (20.10.2016) to only drop uid/gid if invoked as root. OK sthen
Diffstat (limited to 'usr.sbin/traceroute')
-rw-r--r--usr.sbin/traceroute/traceroute.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c
index 9c8a1ce8e6a..cd02cd9afa0 100644
--- a/usr.sbin/traceroute/traceroute.c
+++ b/usr.sbin/traceroute/traceroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: traceroute.c,v 1.156 2018/10/15 11:31:11 florian Exp $ */
+/* $OpenBSD: traceroute.c,v 1.157 2018/10/20 19:55:01 kn Exp $ */
/* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */
/*
@@ -359,7 +359,7 @@ main(int argc, char *argv[])
/* revoke privs */
ouid = getuid();
- if ((pw = getpwnam(TRACEROUTE_USER)) != NULL) {
+ if (ouid == 0 && (pw = getpwnam(TRACEROUTE_USER)) != NULL) {
uid = pw->pw_uid;
gid = pw->pw_gid;
} else {