From: Alexander Marx Date: Tue, 13 Aug 2013 14:00:32 +0000 (+0200) Subject: Forward Firewall: BUG: when creating a new group in firewall-groups with the same... X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=commitdiff_plain;h=f195a8d763c82635bc1458bd9cd8d13cf45c95a2 Forward Firewall: BUG: when creating a new group in firewall-groups with the same name as an existing group, the line "no rule defined" was added. BUG: THe line "no rules defined" is now "no entries in this group". --- diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi index dec649bdd..92c2d38b9 100755 --- a/html/cgi-bin/fwhosts.cgi +++ b/html/cgi-bin/fwhosts.cgi @@ -543,6 +543,8 @@ if ($fwhostsettings{'ACTION'} eq 'savegrp') &General::readhasharray("$confighost", \%customhost); #check name if (!&validhostname($grp)){$errormessage.=$Lang::tr{'fwhost err name'};} + #check existing name + if (!checkgroup(\%customgrp,$grp) && $fwhostsettings{'update'} ne 'on'){$errormessage.=$Lang::tr{'fwhost err grpexist'};} #check remark if ($rem ne '' && !&validremark($rem) && $fwhostsettings{'update'} ne 'on'){ $errormessage.=$Lang::tr{'fwhost err remark'}; @@ -1490,7 +1492,7 @@ sub viewtablegrp my $delflag; if (!keys %customgrp) { - print "
$Lang::tr{'fwhost empty'}"; + print "
$Lang::tr{'fwhost err emptytable'}"; }else{ foreach my $key (sort { ncmp($customgrp{$a}[0],$customgrp{$b}[0]) } sort { ncmp ($customgrp{$a}[2],$customgrp{$b}[2]) } keys %customgrp){ $count++; @@ -1506,7 +1508,7 @@ sub viewtablegrp } } $number=1; - if ($customgrp{$key}[2] eq "none"){$customgrp{$key}[2]=$Lang::tr{'fwhost empty'};} + if ($customgrp{$key}[2] eq "none"){$customgrp{$key}[2]=$Lang::tr{'fwhost err emptytable'};} $grpname=$customgrp{$key}[0]; $remark="$customgrp{$key}[1]"; if($count gt 2){ print"";} @@ -1536,7 +1538,7 @@ sub viewtablegrp }else{ print "$customgrp{$key}[2]"; } - if ($ip eq '' && $customgrp{$key}[2] ne $Lang::tr{'fwhost empty'}){ + if ($ip eq '' && $customgrp{$key}[2] ne $Lang::tr{'fwhost err emptytable'}){ print "$Lang::tr{'fwhost deleted'}$customgrp{$key}[3]
"; }else{ my ($colip,$colsub) = split("/",$ip); @@ -1681,6 +1683,17 @@ sub checkname return 1; } +sub checkgroup +{ + my %hash=%{(shift)}; + my $name=shift; + foreach my $key (keys %hash) { + if($hash{$key}[0] eq $name){ + return 0; + } + } + return 1; +} sub checkip { diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index d26287139..279bfaab2 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -1,4 +1,4 @@ -%tr = ( +%tr = ( %tr, 'Act as' => 'Konfiguriert als', @@ -1019,6 +1019,7 @@ 'fwhost err addr' => 'IP-Adresse oder Subnetzmaske ungültig', 'fwhost err addrgrp' => 'Bitte Gruppennamen angeben', 'fwhost err empty' => 'Bitte alle Felder ausfüllen', +'fwhost err emptytable' => 'Keine Einträge in Gruppe', 'fwhost err groupempty' => 'Die gewählte Gruppe ist leer', 'fwhost err grpexist' => 'Die Gruppe existiert bereits', 'fwhost err hostexist' => 'Ein Host mit diesem Namen existiert bereits', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 63d1e9358..4ca450c52 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -1,4 +1,4 @@ -%tr = ( +%tr = ( %tr, 'Act as' => 'Act as:', @@ -1044,6 +1044,7 @@ 'fwhost err addr' => 'Invalid IP address or subnet', 'fwhost err addrgrp' => 'Please provide a group name', 'fwhost err empty' => 'Please fill in all input fields', +'fwhost err emptytable' => 'No entries in this group', 'fwhost err groupempty' => 'The selected group is empty', 'fwhost err grpexist' => 'Group already exists', 'fwhost err hostexist' => 'A host with the same name already exists',