From 96711574bec47c5ffec3bd26c0b4056e07d2ef0e Mon Sep 17 00:00:00 2001 From: Alexander Marx Date: Thu, 26 Sep 2013 16:18:54 +0200 Subject: [PATCH] Forward Firewall: BUGFIX: when using ICMP services in firewallrules and then changing the service, the rule was broken --- html/cgi-bin/fwhosts.cgi | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi index e7ae946efa..2d4c69f6a5 100755 --- a/html/cgi-bin/fwhosts.cgi +++ b/html/cgi-bin/fwhosts.cgi @@ -177,6 +177,13 @@ if ($fwhostsettings{'ACTION'} eq 'updateservice') $fwhostsettings{'ICMP_TYPES'}='BLANK'; } my $key1 = &General::findhasharraykey(\%customservice); + #find out short ICMP-TYPE + &General::readhasharray("${General::swroot}/fwhosts/icmp-types", \%icmptypes); + foreach my $key (keys %icmptypes){ + if ("$icmptypes{$key}[0] ($icmptypes{$key}[1])" eq $fwhostsettings{'ICMP_TYPES'}){ + $fwhostsettings{'ICMP_TYPES'}=$icmptypes{$key}[0]; + } + } foreach my $i (0 .. 4) { $customservice{$key1}[$i] = "";} $customservice{$key1}[0] = $fwhostsettings{'SRV_NAME'}; $customservice{$key1}[1] = $fwhostsettings{'SRV_PORT'}; @@ -220,15 +227,22 @@ if ($fwhostsettings{'ACTION'} eq 'updateservice') if($count gt 0 && $fwhostsettings{'oldsrvprot'} ne $fwhostsettings{'PROT'} ){ $needrules='on'; } + if($count gt 0 && $fwhostsettings{'oldsrvicmp'} ne $fwhostsettings{'ICMP'} ){ + $needrules='on'; + } $fwhostsettings{'SRV_NAME'} = ''; $fwhostsettings{'SRV_PORT'} = ''; $fwhostsettings{'PROT'} = ''; + $fwhostsettings{'ICMP'} = ''; + $fwhostsettings{'oldsrvicmp'} = ''; }else{ $fwhostsettings{'SRV_NAME'} = $fwhostsettings{'oldsrvname'}; $fwhostsettings{'SRV_PORT'} = $fwhostsettings{'oldsrvport'}; $fwhostsettings{'PROT'} = $fwhostsettings{'oldsrvprot'}; + $fwhostsettings{'ICMP'} = $fwhostsettings{'oldsrvicmp'}; $fwhostsettings{'updatesrv'}= 'on'; } + $fwhostsettings{'updatesrv'} = ''; if($needrules eq 'on'){ &rules; } @@ -1287,6 +1301,7 @@ sub addservice $fwhostsettings{'oldsrvname'} = $fwhostsettings{'SRV_NAME'}; $fwhostsettings{'oldsrvport'} = $fwhostsettings{'SRV_PORT'}; $fwhostsettings{'oldsrvprot'} = $fwhostsettings{'PROT'}; + $fwhostsettings{'oldsrvicmp'} = $fwhostsettings{'ICMP'}; } print<
@@ -1309,9 +1324,12 @@ END &General::readhasharray("${General::swroot}/fwhosts/icmp-types", \%icmptypes); print""; foreach my $key (sort { ncmp($icmptypes{$a}[0],$icmptypes{$b}[0]) }keys %icmptypes){ - print""; + if ($icmptypes{$key}[0] eq $fwhostsettings{'oldsrvicmp'}){ + print""; + }else{ + print""; + } } - print< $Lang::tr{'fwhost port'}: @@ -1325,7 +1343,9 @@ END - + + + END }else{ @@ -1645,7 +1665,8 @@ END
-
+ + END if ($customservice{$key}[4] eq '0') { -- 2.39.5