From: Florian Forster Date: Tue, 29 Sep 2009 16:09:27 +0000 (+0200) Subject: oping: Allow “-f -” even if uid and euid differ. X-Git-Tag: liboping-1.3.3~1 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=c48092b666373785780a33898a3df0e88fe7ab6e;hp=4f3f5ddb4ee94ba634921b6a58726823289cafae;p=liboping.git oping: Allow “-f -” even if uid and euid differ. Thanks to Sebastian for the idea :) --- diff --git a/src/mans/oping.pod b/src/mans/oping.pod index fc8911d..12c3a65 100644 --- a/src/mans/oping.pod +++ b/src/mans/oping.pod @@ -58,9 +58,10 @@ Set the outgoing network device to use. Instead of specifying hostnames on the command line, read them from I. If I is B<->, read from C. -This option is only available if the real user ID (as returned by L) -and the effective user ID (as returned by L) match. This is meant -to avoid security issues when I is installed with the SUID-bit. +If the real user ID (as returned by L) and the effective user ID (as +returned by L) differ, the only argument allowed for this option is +"-" (i.Ee. standard input). This is meant to avoid security issues when +I is installed with the SUID-bit. =back diff --git a/src/oping.c b/src/oping.c index 8419710..3d1eddd 100644 --- a/src/oping.c +++ b/src/oping.c @@ -170,7 +170,7 @@ static int read_options (int argc, char **argv) break; case 'f': - if (is_setuid ()) + if (is_setuid () && (strcmp ("-", optarg) != 0)) { fprintf (stderr, "For security reasons the `-f' option " "is disabled if real and effective "