Adjust CGI files to work with latest location-function.pl changes.

Fixes #12515.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Stefan Schantl
2020-11-07 19:47:24 +01:00
committed by Michael Tremer
parent 427190d578
commit 07e42be978
11 changed files with 17 additions and 47 deletions

View File

@@ -24,9 +24,6 @@ require "${General::swroot}/location-functions.pl";
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
# Libloc database handle.
my $libloc_db_handle = &Location::Functions::init();
my %color = ();
my %mainsettings = ();
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
@@ -354,7 +351,8 @@ foreach $_ (@log)
$srcport=$1 if $packet =~ /SPT=(\d+)/;
$dstport=$1 if $packet =~ /DPT=(\d+)/;
my $ccode = &Location::Functions::lookup_country_code($libloc_db_handle, $srcaddr);
# Get the country code.
my $ccode = &Location::Functions::lookup_country_code($srcaddr);
my $servi = uc(getservbyport($srcport, lc($proto)));
if ($servi ne '' && $srcport < 1024) {

View File

@@ -22,9 +22,6 @@ require "${General::swroot}/location-functions.pl";
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
# Libloc database handle.
my $libloc_db_handle = &Location::Functions::init();
use POSIX();
my %cgiparams=();
@@ -311,7 +308,7 @@ foreach $_ (@log)
# Traffic from red
if($srcaddr ne '') {
# srcaddr is set
my $ccode = &Location::Functions::lookup_country_code($libloc_db_handle, $srcaddr);
my $ccode = &Location::Functions::lookup_country_code($srcaddr);
if ($ccode eq '') {
$ccode = 'unknown';
}

View File

@@ -22,9 +22,6 @@ require "${General::swroot}/location-functions.pl";
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
# Libloc database handle.
my $libloc_db_handle = &Location::Functions::init();
use POSIX();
my %cgiparams=();
@@ -438,7 +435,8 @@ for($s=0;$s<$lines;$s++)
$col="bgcolor='$color{\"color$colorIndex\"}'";
print "<tr>";
my $ccode = &Location::Functions::lookup_country_code($libloc_db_handle, $key[$s]);
# Get country code.
my $ccode = &Location::Functions::lookup_country_code($key[$s]);
$color++;
print "<td align='center' $col><form method='post' action='showrequestfromip.dat'><input type='hidden' name='MONTH' value='$cgiparams{'MONTH'}'> <input type='hidden' name='DAY' value='$cgiparams{'DAY'}'> <input type='hidden' name='ip' value='$key[$s]'> <input type='submit' value='$Lang::tr{'details'}'></form></td>";

View File

@@ -19,9 +19,6 @@ require "${General::swroot}/location-functions.pl";
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
# Libloc database handle.
my $libloc_db_handle = &Location::Functions::init();
use POSIX();
#workaround to suppress a warning when a variable is used only once
@@ -181,7 +178,7 @@ if (!$skip)
}
elsif($srcaddr ne '') {
# or srcaddr matches country code
my $ccode = &Location::Functions::lookup_country_code($libloc_db_handle, $srcaddr);
my $ccode = &Location::Functions::lookup_country_code($srcaddr);
if($ccode eq uc($country)){
$log[$lines] = $_;
$lines++;
@@ -352,7 +349,7 @@ foreach $_ (@slice)
if($iface eq $country || $srcaddr ne '') {
my $ccode='';
if($iface ne $country) {
$ccode = &Location::Functions::lookup_country_code($libloc_db_handle, $srcaddr);
$ccode = &Location::Functions::lookup_country_code($srcaddr);
}
if($iface eq $country || $ccode eq uc($country)) {
my $chain = '';