From fe2bae3b747530a37cbe37247aa1d974f15f51a6 Mon Sep 17 00:00:00 2001 From: Alexander Marx Date: Mon, 9 Dec 2013 09:33:21 +0100 Subject: [PATCH] Firewall: Fix BETA8 - It was not possible to delete single services from servicegroups --- html/cgi-bin/fwhosts.cgi | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi index ed42404b38..7f4b63c904 100755 --- a/html/cgi-bin/fwhosts.cgi +++ b/html/cgi-bin/fwhosts.cgi @@ -1030,20 +1030,18 @@ if ($fwhostsettings{'ACTION'} eq 'delgrpservice') if($customservicegrp{$key}[0].",".$customservicegrp{$key}[1].",".$customservicegrp{$key}[2].",".$customservicegrp{$key}[3] eq $fwhostsettings{'delsrvfromgrp'}) { #decrease count from source service - if ($customservicegrp{$key}[2] eq 'TCP' || $customservicegrp{$key}[2] eq 'UDP'|| $customservicegrp{$key}[2] eq 'ICMP'){ - foreach my $key1 (sort keys %customservice){ - if($customservice{$key1}[0] eq $customservicegrp{$key}[2]){ - $customservice{$key1}[4]--; - last; - } + foreach my $key1 (sort keys %customservice){ + if($customservice{$key1}[0] eq $customservicegrp{$key}[2]){ + $customservice{$key1}[4]--; + last; } - &General::writehasharray("$configsrv", \%customservice); } $grpname=$customservicegrp{$key}[0]; $grpremark=$customservicegrp{$key}[1]; delete $customservicegrp{$key}; } } + &General::writehasharray("$configsrv", \%customservice); &General::writehasharray("$configsrvgrp", \%customservicegrp); &General::firewall_config_changed(); if ($fwhostsettings{'updatesrvgrp'} eq 'on'){ @@ -1732,7 +1730,7 @@ sub viewtableservicegrp &General::readhasharray("$configsrvgrp", \%customservicegrp); &General::readhasharray("$configsrv", \%customservice); my $number= keys %customservicegrp; - foreach my $key (sort { ncmp($customservicegrp{$a}[0],$customservicegrp{$b}[0]) } keys %customservicegrp){ + foreach my $key (sort { ncmp($customservicegrp{$a}[0],$customservicegrp{$b}[0]) } sort { ncmp($customservicegrp{$a}[2],$customservicegrp{$b}[2]) }keys %customservicegrp){ $count++; if ($helper ne $customservicegrp{$key}[0]){ $delflag=0; @@ -1793,8 +1791,8 @@ sub viewtableservicegrp print""; } print""; - if($customservicegrp{$key}[2] eq 'TCP' || $customservicegrp{$key}[2] eq 'UDP' || $customservicegrp{$key}[2] eq 'ICMP'){ - print ""; + if($protocol eq 'TCP' || $protocol eq 'UDP' || $protocol eq 'ICMP'){ + print ""; }else{ print ""; } @@ -1854,8 +1852,6 @@ sub checksubnet sub checkservicegroup { &General::readhasharray("$configsrvgrp", \%customservicegrp); - - #check name if ( ! &validhostname($fwhostsettings{'SRVGRP_NAME'})) { @@ -1911,7 +1907,6 @@ sub get_name return "$network" if ($val eq $defaultNetworks{$network}{'NAME'}); } } - sub deletefromgrp { my $target=shift; @@ -2124,8 +2119,8 @@ sub getipforgroup } } } - -sub decrease { +sub decrease +{ my $grp=$_[0]; &General::readhasharray("$confignet", \%customnetwork); &General::readhasharray("$confighost", \%customhost); -- 2.39.5