Forward Firewall: Fix 80,81,83 (Forum)
authorAlexander Marx <amarx@ipfire.org>
Mon, 18 Feb 2013 15:10:42 +0000 (16:10 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 9 Aug 2013 12:08:21 +0000 (14:08 +0200)
Apply Button now on group and rule site
remark can be delted
- and . are allowed in Hostname

html/cgi-bin/forwardfw.cgi
html/cgi-bin/fwhosts.cgi

index 86fed83b98fc791a3917b761cd46f0704ecb6432..6d662224e183745280fb87101efa3ccdd41e5d2d 100755 (executable)
@@ -2110,6 +2110,7 @@ sub rules
 {
        if (!-f "${General::swroot}/forward/reread"){
                system("touch ${General::swroot}/forward/reread");
+               system("touch ${General::swroot}/fwhosts/reread");
        }
 }
 sub reread_rules
@@ -2117,6 +2118,7 @@ sub reread_rules
        system("/usr/local/bin/forwardfwctrl");
        if ( -f "${General::swroot}/forward/reread"){
                system("rm ${General::swroot}/forward/reread");
+               system("rm ${General::swroot}/fwhosts/reread");
        }
 }
 &Header::closebigbox();
index 4b0a1122d248d0e37cec12dae4c9d7c3bc6d142a..ae9383d76956a6a3c3c0295d84a2e3e1f806fb12 100755 (executable)
@@ -1000,7 +1000,7 @@ if ($fwhostsettings{'ACTION'} eq $Lang::tr{'fwhost newservicegrp'})
 if ($fwhostsettings{'ACTION'} eq 'changegrpremark')
 {
        &General::readhasharray("$configgrp", \%customgrp);
-       if ($fwhostsettings{'oldrem'} ne $fwhostsettings{'newrem'} && &validremark($fwhostsettings{'newrem'})){
+       if ($fwhostsettings{'oldrem'} ne $fwhostsettings{'newrem'} && (&validremark($fwhostsettings{'newrem'}) || $fwhostsettings{'newrem'} eq '')){
                foreach my $key (sort keys %customgrp)
                        {
                                #$customgrp{$key}[1]=~ s/\|/,/g;
@@ -1028,7 +1028,7 @@ if ($fwhostsettings{'ACTION'} eq 'changegrpremark')
 if ($fwhostsettings{'ACTION'} eq 'changesrvgrpremark')
 {
        &General::readhasharray("$configsrvgrp", \%customservicegrp );
-       if ($fwhostsettings{'oldsrvrem'} ne $fwhostsettings{'newsrvrem'} && &validremark($fwhostsettings{'newsrvrem'})){
+       if ($fwhostsettings{'oldsrvrem'} ne $fwhostsettings{'newsrvrem'} && (&validremark($fwhostsettings{'newsrvrem'}) || $fwhostsettings{'newsrvrem'} eq '')){
                foreach my $key (sort keys %customservicegrp)
                        {
                                #$customservicegrp{$key}[1]=~ s/\|/,/g;
@@ -1468,7 +1468,7 @@ sub viewtablegrp
                                        {
                                                $delflag++;
                                        }
-                                       if($delflag > 0){
+                                       if($delflag > 1){
                                                last;
                                        }
                                }
@@ -1753,7 +1753,7 @@ sub plausicheck
        
        my $edit=shift;
        #check hostname
-       if (!&General::validhostname($fwhostsettings{'HOSTNAME'}))
+       if (!&validhostname($fwhostsettings{'HOSTNAME'}))
        {
                $errormessage=$errormessage.$Lang::tr{'fwhost err name'};
                $fwhostsettings{'BLK_IP'}='readonly';
@@ -1957,6 +1957,7 @@ sub rules
 {
        if (!-f "${General::swroot}/fwhosts/reread"){
                system("touch ${General::swroot}/fwhosts/reread");
+               system("touch ${General::swroot}/forward/reread");
        }
 }
 sub reread_rules
@@ -1964,6 +1965,7 @@ sub reread_rules
        system ("/usr/local/bin/forwardfwctrl");
        if ( -f "${General::swroot}/fwhosts/reread"){
                system("rm ${General::swroot}/fwhosts/reread");
+               system("rm ${General::swroot}/forward/reread");
        }
        
 }
@@ -2062,7 +2064,7 @@ sub validhostname
        if (length ($hostname) < 1 || length ($hostname) > 63) {
                return 0;}
        # Only valid characters are a-z, A-Z, 0-9 and -
-       if ($hostname !~ /^[a-zA-ZäöüÖÄÜ0-9-_()\/\s]*$/) {
+       if ($hostname !~ /^[a-zA-ZäöüÖÄÜ0-9-_.;()\/\s]*$/) {
                return 0;}
        # First character can only be a letter or a digit
        if (substr ($hostname, 0, 1) !~ /^[a-zA-ZöäüÖÄÜ0-9]*$/) {