From 555f04a7fc6f15c066c92de09bcbef109ef65264 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 9 Jun 2006 18:54:36 +0000 Subject: [PATCH] Do not open /var/etc/inetd.conf twice for writing. Apparently some patch has snuck in, it doesnt appear to affect anything at the moment other than reflection. --- etc/inc/filter.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 6bd6032c2d..9f01ea47bd 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -725,7 +725,7 @@ function filter_nat_rules_generate() { $natrules .= "# NAT Inbound Redirects\n"; if(!isset($config['system']['disablenatreflection'])) { - $fd = fopen("/var/etc/inetd.conf","w"); + $inetd_fd = fopen("/var/etc/inetd.conf","w"); /* start redirects on port 19000 of localhost */ $starting_localhost_port = 18999; } @@ -902,13 +902,13 @@ function filter_nat_rules_generate() { case "tcp/udp": $protocol = "{ tcp udp }"; - fwrite($fd, "{$starting_localhost_port}\tstream\ttcp/udp\tnowait/0\tnobody\t/usr/bin/nc nc -w 20 {$target} {$loc_pt}\n"); + fwrite($inetd_fd, "{$starting_localhost_port}\tstream\ttcp/udp\tnowait/0\tnobody\t/usr/bin/nc nc -w 20 {$target} {$loc_pt}\n"); $natrules .= "rdr on \${$ifname_real} proto {$protocol} from any to {$extaddr} port { {$x} } -> 127.0.0.1 port {$starting_localhost_port}\n"; break; case "tcp": case "udp": $protocol = $rule['protocol']; - fwrite($fd, "{$starting_localhost_port}\tstream\t{$protocol}\tnowait/0\tnobody\t/usr/bin/nc nc -w 20 {$target} {$loc_pt}\n"); + fwrite($inetd_fd, "{$starting_localhost_port}\tstream\t{$protocol}\tnowait/0\tnobody\t/usr/bin/nc nc -w 20 {$target} {$loc_pt}\n"); $natrules .= "rdr on \${$ifname_real} proto {$protocol} from any to {$extaddr} port { {$x} } -> 127.0.0.1 port {$starting_localhost_port}\n"; break; default: @@ -931,7 +931,7 @@ function filter_nat_rules_generate() { } if(!isset($config['system']['disablenatreflection'])) { - fclose($fd); + fclose($inetd_fd); $helpers = trim(exec("/bin/ps ax | /usr/bin/grep inetd | /usr/bin/grep -v grep | /usr/bin/grep 127")); if(!$helpers) mwexec("/usr/sbin/inetd -wW -R 0 -a 127.0.0.1 /var/etc/inetd.conf"); @@ -1691,7 +1691,7 @@ EOD; $natrules .= "# NAT Inbound Redirects\n"; if(!isset($config['system']['disablenatreflection'])) { - $fd = fopen("/var/etc/inetd.conf","w"); + //$fd = fopen("/var/etc/inetd.conf","w"); /* start redirects on port 19000 of localhost */ $starting_localhost_port = 18999; }