From e28356b92834e75f09756de76e3cb139e9b72e9c Mon Sep 17 00:00:00 2001 From: Alexander Marx Date: Fri, 22 Feb 2013 08:28:48 +0100 Subject: [PATCH 1/1] Forward Firewall: added default option SHOWCOLOR to options and refined default behaviour of firewall in forwardfw.cgi --- html/cgi-bin/forwardfw.cgi | 64 ++++++++++++++++++-------------------- html/cgi-bin/optionsfw.cgi | 1 + 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/html/cgi-bin/forwardfw.cgi b/html/cgi-bin/forwardfw.cgi index f5a775bb4..fd6831460 100755 --- a/html/cgi-bin/forwardfw.cgi +++ b/html/cgi-bin/forwardfw.cgi @@ -342,35 +342,33 @@ if ($fwdfwsettings{'ACTION'} eq 'saverule') } if ($fwdfwsettings{'ACTION'} eq $Lang::tr{'reset'}) { - &General::readhasharray("$configfwdfw", \%configfwdfw); - foreach my $key (sort keys %configfwdfw){ - &checkcounter($configfwdfw{$key}[3],$configfwdfw{$key}[4],,); - &checkcounter($configfwdfw{$key}[5],$configfwdfw{$key}[6],,); - &checkcounter($configfwdfw{$key}[14],$configfwdfw{$key}[15],,); - } - &General::readhasharray("$configinput", \%configinputfw); - foreach my $key (sort keys %configinputfw){ - &checkcounter($configinputfw{$key}[3],$configinputfw{$key}[4],,); - &checkcounter($configinputfw{$key}[5],$configinputfw{$key}[6],,); - &checkcounter($configinputfw{$key}[14],$configinputfw{$key}[15],,); - } - - system("rm ${General::swroot}/forward/config"); - system("rm ${General::swroot}/forward/input"); - &General::writehash("${General::swroot}/forward/settings", \%fwdfwsettings); - unless (-e "${General::swroot}/forward/config") { system("touch ${General::swroot}/forward/config"); } - unless (-e "${General::swroot}/forward/input") { system("touch ${General::swroot}/forward/input"); } - my $MODE1=$fwdfwsettings{'POLICY1'}; - %fwdfwsettings = (); - $fwdfwsettings{'POLICY'}='MODE2'; - $fwdfwsettings{'POLICY1'}=$MODE1; - &General::writehash("${General::swroot}/forward/settings", \%fwdfwsettings); - &reread_rules; - -} -if ($fwdfwsettings{'ACTION'} eq 'resetoutgoing') -{ - &General::readhasharray("$configoutgoing", \%configoutgoingfw); + if($fwdfwsettings{'poltype'} eq 'forward'){ + &General::readhasharray("$configfwdfw", \%configfwdfw); + foreach my $key (sort keys %configfwdfw){ + &checkcounter($configfwdfw{$key}[3],$configfwdfw{$key}[4],,); + &checkcounter($configfwdfw{$key}[5],$configfwdfw{$key}[6],,); + &checkcounter($configfwdfw{$key}[14],$configfwdfw{$key}[15],,); + } + &General::readhasharray("$configinput", \%configinputfw); + foreach my $key (sort keys %configinputfw){ + &checkcounter($configinputfw{$key}[3],$configinputfw{$key}[4],,); + &checkcounter($configinputfw{$key}[5],$configinputfw{$key}[6],,); + &checkcounter($configinputfw{$key}[14],$configinputfw{$key}[15],,); + } + + system("rm ${General::swroot}/forward/config"); + system("rm ${General::swroot}/forward/input"); + &General::writehash("${General::swroot}/forward/settings", \%fwdfwsettings); + unless (-e "${General::swroot}/forward/config") { system("touch ${General::swroot}/forward/config"); } + unless (-e "${General::swroot}/forward/input") { system("touch ${General::swroot}/forward/input"); } + my $MODE1=$fwdfwsettings{'POLICY1'}; + %fwdfwsettings = (); + $fwdfwsettings{'POLICY'}='MODE2'; + $fwdfwsettings{'POLICY1'}=$MODE1; + &General::writehash("${General::swroot}/forward/settings", \%fwdfwsettings); + &reread_rules; + }else{ + &General::readhasharray("$configoutgoing", \%configoutgoingfw); foreach my $key (sort keys %configoutgoingfw){ &checkcounter($configoutgoingfw{$key}[3],$configoutgoingfw{$key}[4],,); &checkcounter($configoutgoingfw{$key}[5],$configoutgoingfw{$key}[6],,); @@ -385,7 +383,7 @@ if ($fwdfwsettings{'ACTION'} eq 'resetoutgoing') $fwdfwsettings{'POLICY1'}='MODE2'; &General::writehash("${General::swroot}/forward/settings", \%fwdfwsettings); &reread_rules; - + } } if ($fwdfwsettings{'ACTION'} eq $Lang::tr{'fwdfw newrule'}) { @@ -598,7 +596,7 @@ print < END - print "$Lang::tr{'outgoing firewall reset'}: "; + print "$Lang::tr{'outgoing firewall reset'}: "; print ""; print"

"; print < -
+ END - print "$Lang::tr{'outgoing firewall reset'}: "; + print "$Lang::tr{'outgoing firewall reset'}: "; print "
"; &Header::closebox(); } diff --git a/html/cgi-bin/optionsfw.cgi b/html/cgi-bin/optionsfw.cgi index da246f3db..39bd4195d 100644 --- a/html/cgi-bin/optionsfw.cgi +++ b/html/cgi-bin/optionsfw.cgi @@ -35,6 +35,7 @@ $settings{'DROPOUTGOING'} = 'on'; $settings{'DROPPORTSCAN'} = 'on'; $settings{'DROPWIRELESSINPUT'} = 'on'; $settings{'DROPWIRELESSFORWARD'} = 'on'; +$settings{'SHOWCOLORS'} = 'off'; my $errormessage = ''; my $warnmessage = ''; -- 2.39.2