]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
Forward Firewall: When changing a service which is used in a rule, the rule was destr...
authorAlexander Marx <amarx@ipfire.org>
Thu, 7 Feb 2013 11:12:11 +0000 (12:12 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 9 Aug 2013 12:08:18 +0000 (14:08 +0200)
Now the configfiles of the firewall are adapted as needed.

html/cgi-bin/fwhosts.cgi

index 6b6a5ec23c4208e42b548eda625e1854e7b44fb8..06522acc1993fa55cebce431771429402001af7e 100755 (executable)
@@ -151,6 +151,30 @@ if ($fwhostsettings{'ACTION'} eq 'updateservice')
                $customservice{$key1}[3] = $fwhostsettings{'ICMP_TYPES'};
                $customservice{$key1}[4] = $count;
                &General::writehasharray("$configsrv", \%customservice);
+               
+               #check if we need to update configfiles for rules
+               if ($fwhostsettings{'SRV_NAME'} ne $fwhostsettings{'oldsrvname'}){
+                       if ( ! -z $fwconfigfwd ){
+                               &General::readhasharray("$fwconfigfwd", \%fwfwd);
+                               foreach my $key (sort keys %fwfwd){
+                                       if ($fwfwd{$key}[15] eq $fwhostsettings{'oldsrvname'}){
+                                               $fwfwd{$key}[15] = $fwhostsettings{'SRV_NAME'};
+                                       }
+                               }
+                               &General::writehasharray("$fwconfigfwd", \%fwfwd);
+                               $needrules='on';
+                       }
+                       if ( ! -z $fwconfiginp ){
+                               &General::readhasharray("$fwconfiginp", \%fwinp);
+                               foreach my $line (sort keys %fwinp){
+                                       if ($fwfwd{$line}[15] eq $fwhostsettings{'oldsrvname'}){
+                                               $fwfwd{$line}[15] = $fwhostsettings{'SRV_NAME'};
+                                       }
+                               }
+                               &General::writehasharray("$fwconfiginp", \%fwinp);
+                       }
+                       $needrules='on';
+               }
                if($fwhostsettings{'updatesrv'} eq 'on'){
                        if($count gt 0 && $fwhostsettings{'oldsrvport'} ne $fwhostsettings{'SRV_PORT'} ){
                                $needrules='on';
@@ -169,7 +193,6 @@ if ($fwhostsettings{'ACTION'} eq 'updateservice')
                $fwhostsettings{'updatesrv'}= 'on';
        }
        if($needrules eq 'on'){
-               $errormessage="reread!";
                &rules;
        }
        &addservice;