logs.cgi/showrequestfromcountry.dat: Proper lookup country code.

Message ID 20210405133612.3251-1-stefan.schantl@ipfire.org
State Accepted
Commit 5ae118858924b3ca909f907e9448350cc7089cc0
Headers
Series logs.cgi/showrequestfromcountry.dat: Proper lookup country code. |

Commit Message

Stefan Schantl April 5, 2021, 1:36 p.m. UTC
  Seems to be a code fragment has been left while switching to
libloc. Now call the right function from location-functions.pl.

Fixes #12599.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
 html/cgi-bin/logs.cgi/showrequestfromcountry.dat | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Peter Müller April 5, 2021, 2:50 p.m. UTC | #1
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>

> Seems to be a code fragment has been left while switching to
> libloc. Now call the right function from location-functions.pl.
> 
> Fixes #12599.
> 
> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
> ---
>  html/cgi-bin/logs.cgi/showrequestfromcountry.dat | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/html/cgi-bin/logs.cgi/showrequestfromcountry.dat b/html/cgi-bin/logs.cgi/showrequestfromcountry.dat
> index 2a246ec60..f81994f87 100644
> --- a/html/cgi-bin/logs.cgi/showrequestfromcountry.dat
> +++ b/html/cgi-bin/logs.cgi/showrequestfromcountry.dat
> @@ -218,7 +218,7 @@ if ($multifile) {
>  				# extract ipv4 and ipv6 address
>  				elsif (($_ =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($_ =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) {
>  					my $srcaddr=$1;
> -					my $ccode = $gi->country_code_by_name($srcaddr);
> +					my $ccode = &Location::Functions::lookup_country_code($srcaddr);
>  					if($ccode eq uc($country)){
>  						# or srcaddr matches country code
>  						$log[$lines] = $_;
>
  

Patch

diff --git a/html/cgi-bin/logs.cgi/showrequestfromcountry.dat b/html/cgi-bin/logs.cgi/showrequestfromcountry.dat
index 2a246ec60..f81994f87 100644
--- a/html/cgi-bin/logs.cgi/showrequestfromcountry.dat
+++ b/html/cgi-bin/logs.cgi/showrequestfromcountry.dat
@@ -218,7 +218,7 @@  if ($multifile) {
 				# extract ipv4 and ipv6 address
 				elsif (($_ =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($_ =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) {
 					my $srcaddr=$1;
-					my $ccode = $gi->country_code_by_name($srcaddr);
+					my $ccode = &Location::Functions::lookup_country_code($srcaddr);
 					if($ccode eq uc($country)){
 						# or srcaddr matches country code
 						$log[$lines] = $_;