Allow option '-f' also for non-root (since setuid privileges are dropped)

pull/67/head
David Schweikert 11 years ago
parent d4e0a6c89b
commit 86f0b1e380

@ -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 <david@schweikert.ch>
* Version 3.9

@ -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 */

Loading…
Cancel
Save