]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
Forward Firewall: some code optimizations
authorAlexander Marx <amarx@ipfire.org>
Thu, 7 Feb 2013 14:24:19 +0000 (15:24 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 9 Aug 2013 12:08:18 +0000 (14:08 +0200)
html/cgi-bin/fwhosts.cgi

index 900928d82c3654a5a4c02d152648638edd644320..c23c9093759b135eea9d53098266d3b07f4a5102 100755 (executable)
@@ -152,7 +152,7 @@ if ($fwhostsettings{'ACTION'} eq 'updateservice')
                $customservice{$key1}[4] = $count;
                &General::writehasharray("$configsrv", \%customservice);
                
-               #check if we need to update configfiles for rules
+               #check if we need to update firewallrules
                if ($fwhostsettings{'SRV_NAME'} ne $fwhostsettings{'oldsrvname'}){
                        if ( ! -z $fwconfigfwd ){
                                &General::readhasharray("$fwconfigfwd", \%fwfwd);
@@ -162,7 +162,6 @@ if ($fwhostsettings{'ACTION'} eq 'updateservice')
                                        }
                                }
                                &General::writehasharray("$fwconfigfwd", \%fwfwd);
-                               $needrules='on';
                        }
                        if ( ! -z $fwconfiginp ){
                                &General::readhasharray("$fwconfiginp", \%fwinp);
@@ -175,14 +174,14 @@ if ($fwhostsettings{'ACTION'} eq 'updateservice')
                        }
                        $needrules='on';
                }
-               if($fwhostsettings{'updatesrv'} eq 'on'){
-                       if($count gt 0 && $fwhostsettings{'oldsrvport'} ne $fwhostsettings{'SRV_PORT'} ){
-                               $needrules='on';
-                       }
-                       if($count gt 0 && $fwhostsettings{'oldsrvprot'} ne $fwhostsettings{'PROT'} ){
-                               $needrules='on';
-                       }
+               
+               if($count gt 0 && $fwhostsettings{'oldsrvport'} ne $fwhostsettings{'SRV_PORT'} ){
+                       $needrules='on';
                }
+               if($count gt 0 && $fwhostsettings{'oldsrvprot'} ne $fwhostsettings{'PROT'} ){
+                       $needrules='on';
+               }
+               
                $fwhostsettings{'SRV_NAME'}     = '';
                $fwhostsettings{'SRV_PORT'}     = '';
                $fwhostsettings{'PROT'}         = '';
@@ -1749,14 +1748,12 @@ sub plausicheck
        {
                $errormessage.="<br>".$Lang::tr{'fwhost err hostexist'};
                $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
-               #if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}=$edit;}
-               $fwhostsettings{'ACTION'}=$edit;
+               if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}=$edit;}
        }
        #check if host with this ip already exists
        if (!&checkip(\%customhost,2))
        {
                $errormessage=$errormessage."<br>".$Lang::tr{'fwhost err ipcheck'};
-               
        }