diff --git a/ChangeLog b/ChangeLog index a79c611..da9a6fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ UNRELEASED * More tests added * Fix confusing error message with -g and IPv6 addresses (#58, reported by Axel Beckert) + * Allow option '-f' also for non-root (since setuid privileges are dropped) 2014-03-08 David Schweikert * Version 3.9 diff --git a/src/fping.c b/src/fping.c index 03e98b0..b6f320e 100644 --- a/src/fping.c +++ b/src/fping.c @@ -369,7 +369,8 @@ int main( int argc, char **argv ) s = open_ping_socket(); if((uid = getuid())) { - seteuid( getuid() ); + /* drop privileges */ + setuid( getuid() ); } prog = argv[0]; @@ -509,27 +510,8 @@ int main( int argc, char **argv ) exit( 0 ); case 'f': -#ifdef ENABLE_F_OPTION filename = optarg; - generate_flag = 0; break; -#else - if( getuid() ) - { - printf( "%s: this option can only be used by root.\n", argv[0] ); - printf( "%s: fping will read from stdin by default.\n", argv[0] ); - exit( 3 ); - - }/* IF */ - else - { - filename = optarg; - generate_flag = 0; - - }/* ELSE */ - - break; -#endif /* ENABLE_F_OPTION */ case 'g': /* use IP list generation */