BUG:11312 When renaming a GeoIP Group, the corresponding names in firewallrules (if any) are not changed accordingly. Now when changing a GeoIP Group the firewallrules are renamed correctly.

Message ID 1522910196-7951-1-git-send-email-alexander.marx@ipfire.org
State Dropped
Headers show
Series BUG:11312 When renaming a GeoIP Group, the corresponding names in firewallrules (if any) are not changed accordingly. Now when changing a GeoIP Group the firewallrules are renamed correctly. | expand

Commit Message

Alexander Marx April 5, 2018, 4:36 p.m. UTC
fixes: #11312
---
 html/cgi-bin/fwhosts.cgi | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Michael Tremer April 5, 2018, 7:59 p.m. UTC | #1
Please don't forget to update the bug report so that the people who are involved
see the patch and can test it.

Best,
-Michael

On Thu, 2018-04-05 at 08:36 +0200, Alexander Marx wrote:
> fixes: #11312
> ---
>  html/cgi-bin/fwhosts.cgi | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi
> index a2ade8a..c342d46 100644
> --- a/html/cgi-bin/fwhosts.cgi
> +++ b/html/cgi-bin/fwhosts.cgi
> @@ -1278,7 +1278,7 @@ if ($fwhostsettings{'ACTION'} eq 'changegeoipgrpname')
>  			}
>  			&General::writehasharray("$configgeoipgrp",
> \%customgeoipgrp );
>  			#change name in FW Rules
> -			&changenameinfw($fwhostsettings{'oldgrpname'},$fwhost
> settings{'grp'},6);
> +			&changenameinfw($fwhostsettings{'oldgrpname'},$fwhost
> settings{'grp'},4,"geoip");
>  		}
>  	}
>  	&addgeoipgrp;
> @@ -3052,6 +3052,12 @@ sub changenameinfw
>  	my $old=shift;
>  	my $new=shift;
>  	my $fld=shift;
> +	my $type=shift;
> +	
> +	if ($type eq 'geoip'){
> +		$old="group:$old";
> +		$new="group:$new";
> +	}
>  	&General::readhasharray("$fwconfigfwd", \%fwfwd);
>  	&General::readhasharray("$fwconfiginp", \%fwinp);
>  	&General::readhasharray("$fwconfigout", \%fwout);

Patch

diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi
index a2ade8a..c342d46 100644
--- a/html/cgi-bin/fwhosts.cgi
+++ b/html/cgi-bin/fwhosts.cgi
@@ -1278,7 +1278,7 @@  if ($fwhostsettings{'ACTION'} eq 'changegeoipgrpname')
 			}
 			&General::writehasharray("$configgeoipgrp", \%customgeoipgrp );
 			#change name in FW Rules
-			&changenameinfw($fwhostsettings{'oldgrpname'},$fwhostsettings{'grp'},6);
+			&changenameinfw($fwhostsettings{'oldgrpname'},$fwhostsettings{'grp'},4,"geoip");
 		}
 	}
 	&addgeoipgrp;
@@ -3052,6 +3052,12 @@  sub changenameinfw
 	my $old=shift;
 	my $new=shift;
 	my $fld=shift;
+	my $type=shift;
+	
+	if ($type eq 'geoip'){
+		$old="group:$old";
+		$new="group:$new";
+	}
 	&General::readhasharray("$fwconfigfwd", \%fwfwd);
 	&General::readhasharray("$fwconfiginp", \%fwinp);
 	&General::readhasharray("$fwconfigout", \%fwout);