tags 454167 + patch thanks Hi, attached is a patch to fix this bug.
Here is some test output: [EMAIL PROTECTED]:test$] ls -l total 0 -rw-r--r-- 1 nion nion 0 2007-12-04 17:05 bar -rw-r--r-- 1 root root 0 2007-12-04 17:05 foo [EMAIL PROTECTED]:test$] sing -L bar example.org SINGing to example.org (208.77.188.166): 16 data bytes 16 bytes from 208.77.188.166: seq=0 ttl=54 TOS=0 time=193.541 ms 16 bytes from 208.77.188.166: seq=1 ttl=54 TOS=0 time=194.210 ms --- example.org sing statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max = 193.541/193.876/194.210 ms [EMAIL PROTECTED]:test$] ls -l bar -rw-r--r-- 1 nion nion 483 2007-12-04 17:05 bar [EMAIL PROTECTED]:test$] sing -L foo example.org SING: fopen -> Permission denied 1 [EMAIL PROTECTED]:test$] ls -l foo -rw-r--r-- 1 root root 0 2007-12-04 17:05 foo [EMAIL PROTECTED]:test$] sing -L baz example.org SINGing to example.org (208.77.188.166): 16 data bytes 16 bytes from 208.77.188.166: seq=0 ttl=54 TOS=0 time=193.656 ms 16 bytes from 208.77.188.166: seq=1 ttl=54 TOS=0 time=194.165 ms --- example.org sing statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max = 193.656/193.910/194.165 ms [EMAIL PROTECTED]:test$] ls -l total 8 -rw-r--r-- 1 nion nion 483 2007-12-04 17:05 bar -rw-r--r-- 1 nion nion 483 2007-12-04 17:05 baz -rw-r--r-- 1 root root 0 2007-12-04 17:05 foo Kind regards Nico -- Nico Golde - http://www.ngolde.de - [EMAIL PROTECTED] - GPG: 0x73647CFF For security reasons, all text in this mail is double-rot13 encrypted.
--- sing-1.1/parser.c 2001-04-18 13:11:08.000000000 +0200 +++ parser.c 2007-12-04 17:07:07.000000000 +0100 @@ -75,6 +75,8 @@ struct protoent *proto; static struct mi_ifaz iface; struct sockaddr_in *aux2; + uid_t user_id; + static struct option options[] = { { "help", 0, 0, 'h' }, @@ -380,8 +382,15 @@ break; case 31: - if ( (packet->logfile = fopen(optarg, "a+")) == NULL ) - go_out_error(1, "fopen"); + user_id = getuid(); + uid_t tmp_id = geteuid(); + + seteuid(user_id); + if ( (packet->logfile = fopen(optarg, "a+")) == NULL ) + go_out_error(1, "fopen"); + + seteuid(tmp_id); + break; case 32: @@ -889,4 +898,4 @@ packet.mac_src[i] = strtol(data, (char **)NULL, 16); return 0; -} \ No newline at end of file +}
pgp06mtCiz0mD.pgp
Description: PGP signature