Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- config/cfgroot/location-functions.pl | 30 +++++++++------------------- 1 file changed, 9 insertions(+), 21 deletions(-)
diff --git a/config/cfgroot/location-functions.pl b/config/cfgroot/location-functions.pl index ab99e71d3..a94d5909e 100644 --- a/config/cfgroot/location-functions.pl +++ b/config/cfgroot/location-functions.pl @@ -38,6 +38,9 @@ my %not_iso_3166_location = ( "fx" => "France, Metropolitan" );
+# Array which contains special country codes. +my @special_locations = ( "A1", "A2", "A3" ); + # Directory where the libloc database and keyfile lives. our $location_dir = "/var/lib/location/";
@@ -167,29 +170,14 @@ sub get_full_country_name($) {
# Function to get all available locations. sub get_locations() { - my @locations = (); - - # Get listed country codes from ISO 3166-1. - my @locations_lc = &Locale::Codes::Country::all_country_codes(); - - # The Codes::Country module provides the country codes only in lower case. - # So we have to loop over the array and convert them into upper case format. - foreach my $ccode (@locations_lc) { - # Convert the country code to uppercase. - my $ccode_uc = uc($ccode); + # Create libloc database handle. + my $db_handle = &init();
- # Add the converted ccode to the locations array. - push(@locations, $ccode_uc); - } - - # Add locations from not_iso_3166_locations. - foreach my $location (keys %not_iso_3166_location) { - # Convert the location into uppercase. - my $location_uc = uc($location); + # Get locations which are stored in the location database. + my @database_locations = &Location::database_countries($db_handle);
- # Add the location to the locations array. - push(@locations, $location_uc); - } + # Merge special locations array and the database locations array. + my @locations = (@special_locations, @database_locations);
# Sort locations array in alphabetical order. my @sorted_locations = sort(@locations);
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- config/cfgroot/location-functions.pl | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/config/cfgroot/location-functions.pl b/config/cfgroot/location-functions.pl index a94d5909e..c8ccd94c2 100644 --- a/config/cfgroot/location-functions.pl +++ b/config/cfgroot/location-functions.pl @@ -24,18 +24,13 @@ package Location::Functions;
use Location; -use Locale::Codes::Country;
# Hash which contains country codes and their names which are special or not # part of ISO 3166-1. my %not_iso_3166_location = ( - "a1" => "Anonymous Proxy", - "a2" => "Satellite Provider", - "a3" => "Worldwide Anycast Instance", - "an" => "Netherlands Antilles", - "ap" => "Asia/Pacific Region", - "eu" => "Europe", - "fx" => "France, Metropolitan" + "A1" => "Anonymous Proxy", + "A2" => "Satellite Provider", + "A3" => "Worldwide Anycast Instance", );
# Array which contains special country codes. @@ -152,17 +147,19 @@ sub get_full_country_name($) { # Remove whitespaces. chomp($input);
+ # Convert input into upper case format. + my $code = uc($input);
- # Convert input into lower case format. - my $code = lc($input); - - # Handle country codes which are not in the list. + # Handle country codes which are special or not part of the list. if ($not_iso_3166_location{$code}) { # Grab location name from hash. $name = $not_iso_3166_location{$code}; } else { - # Use perl built-in module to get the country code. - $name = &Locale::Codes::Country::code2country($code); + # Init libloc database connection. + my $db_handle = &init(); + + # Get the country name by using the location module. + $name = &Location::get_country_name($db_handle, $code); }
return $name;
This function can be used to check if a given address has one of the known flags like "Anonymous Proxy".
If this is true, the mapped special country code will be returned.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- config/cfgroot/location-functions.pl | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/config/cfgroot/location-functions.pl b/config/cfgroot/location-functions.pl index c8ccd94c2..b0b8cd086 100644 --- a/config/cfgroot/location-functions.pl +++ b/config/cfgroot/location-functions.pl @@ -33,6 +33,13 @@ my %not_iso_3166_location = ( "A3" => "Worldwide Anycast Instance", );
+# Hash which contains possible network flags and their mapped location codes. +my %network_flags = ( + "LOC_NETWORK_FLAG_ANONYMOUS_PROXY" => "A1", + "LOC_NETWORK_FLAG_SATELLITE_PROVIDER" => "A2", + "LOC_NETWORK_FLAG_ANYCAST" => "A3", +); + # Array which contains special country codes. my @special_locations = ( "A1", "A2", "A3" );
@@ -183,4 +190,26 @@ sub get_locations() { return @sorted_locations; }
+# Function to check if a given address has a special flag. +sub address_has_flag($) { + my ($address) = @_; + + # Init libloc database handle. + my $db_handle = &init(); + + # Loop through the hash of possible network flags. + foreach my $flag (keys(%network_flags)) { + # Check if the address has the current flag. + if (&Location::lookup_network_has_flag($db_handle, $address, $flag)) { + # The given address has the requested flag. + # + # Grab the mapped location code for this flag. + $mapped_code = $network_flags{$flag}; + + # Return the code. + return $mapped_code; + } + } +} + 1;
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- html/cgi-bin/country.cgi | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/html/cgi-bin/country.cgi b/html/cgi-bin/country.cgi index a1cf24347..b519d89b3 100644 --- a/html/cgi-bin/country.cgi +++ b/html/cgi-bin/country.cgi @@ -21,8 +21,6 @@
use strict;
-use Locale::Codes::Country; - my $col; my $lines = '1'; my $lines2 = ''; @@ -32,6 +30,8 @@ require "${General::swroot}/location-functions.pl"; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl";
+require "${General::swroot}/location-functions.pl"; + &Header::showhttpheaders();
&Header::openpage($Lang::tr{'countries'}, 1, ''); @@ -52,8 +52,11 @@ print<<END; </tr> END
+# Init libloc database connection. +my $db_handle = &Location::Functions::init(); + # Get a list of all supported country codes. -my @countries = Locale::Codes::Country::all_country_codes(); +my @countries = &Location::database_countries($db_handle);
# Loop through whole country list. foreach my $country (@countries) {
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- html/cgi-bin/tor.cgi | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/html/cgi-bin/tor.cgi b/html/cgi-bin/tor.cgi index c9416be01..28dec6cf0 100644 --- a/html/cgi-bin/tor.cgi +++ b/html/cgi-bin/tor.cgi @@ -20,7 +20,6 @@ ###############################################################################
use strict; -use Locale::Codes::Country;
# enable only the following on debugging purpose #use warnings; @@ -31,6 +30,9 @@ require "${General::swroot}/location-functions.pl"; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl";
+# Init libloc database connection. +my $db_handle = &Location::Functions::init(); + #workaround to suppress a warning when a variable is used only once my @dummy = ( ${Header::colouryellow} ); undef (@dummy); @@ -321,10 +323,14 @@ END <option value=''>- $Lang::tr{'tor exit country any'} -</option> END
- my @country_names = Locale::Codes::Country::all_country_names(); - foreach my $country_name (sort @country_names) { - my $country_code = Locale::Codes::Country::country2code($country_name); + my @country_codes = &Location::database_countries(); + foreach my $country_code (@country_codes) { + # Convert country code into upper case format. $country_code = uc($country_code); + + # Get country name. + my $country_name = &Location::Functions::get_country_name($country_code); + print "<option value='$country_code'";
if ($settings{'TOR_EXIT_COUNTRY'} eq $country_code) {
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- html/cgi-bin/guardian.cgi | 1 - 1 file changed, 1 deletion(-)
diff --git a/html/cgi-bin/guardian.cgi b/html/cgi-bin/guardian.cgi index 71316523f..7dc6b0149 100644 --- a/html/cgi-bin/guardian.cgi +++ b/html/cgi-bin/guardian.cgi @@ -20,7 +20,6 @@ ###############################################################################
use strict; -use Locale::Codes::Country; use Guardian::Socket;
# enable only the following on debugging purpose
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- config/cfgroot/general-functions.pl | 1 - 1 file changed, 1 deletion(-)
diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 5de4fb84b..9be1e7708 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -17,7 +17,6 @@ package General; use strict; use Socket; use IO::Socket; -use Locale::Codes::Country; use Net::SSLeay; use Net::IPv4Addr qw(:all); $|=1; # line buffering
Use the libloc data for gathering and displaying the stored network flags, like "Anonymous Proxy" for the addresses.
The notice of a flag only will be displayed, if a flag is set for the network which contains the given address.
Currently this notice text is "hardcoded" in englisch language, because the entire other content of the page is in Englisch (responses from RIR's) and also the flag names like "Anonymous Proxy" are only availabe in English.
IMHO there is no need to to translate the string "This address is marked as" into different languages, because of the reasons abouve.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- html/cgi-bin/ipinfo.cgi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/html/cgi-bin/ipinfo.cgi b/html/cgi-bin/ipinfo.cgi index 978488cb1..cce6097ff 100644 --- a/html/cgi-bin/ipinfo.cgi +++ b/html/cgi-bin/ipinfo.cgi @@ -64,6 +64,7 @@ if (&General::validip($addr)) { # enumerate location information for IP address... my $db_handle = &Location::Functions::init(); my $ccode = &Location::Functions::lookup_country_code($db_handle, $addr); + my $network_flag = &Location::Functions::address_has_flag($addr);
# Try to get the continent of the country code. my $continent = &Location::get_continent_code($db_handle, $ccode); @@ -108,6 +109,17 @@ if (&General::validip($addr)) { }
&Header::openbox('100%', 'left', $addr . " <a href='country.cgi#$ccode'><img src='$flag_icon' border='0' align='absmiddle' alt='$ccode' title='$ccode' /></a> (" . $hostname . ') : '.$whois_server); + + # Check if the address has a flag. + if ($network_flag) { + # Get + my $network_flag_name = &Location::Functions::get_full_country_name($network_flag); + + # Display notice. + print "<h3>This address is marked as $network_flag_name.</h3>\n"; + print "<br>\n"; + } + print "<pre>\n"; foreach my $line (@lines) { print &Header::cleanhtml($line,"y");
All used functions from this module now is done by libloc, so this package safely can be dropped.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- config/rootfiles/common/Locale-Country | 60 -------------------- lfs/Locale-Country | 77 -------------------------- make.sh | 1 - 3 files changed, 138 deletions(-) delete mode 100644 config/rootfiles/common/Locale-Country delete mode 100644 lfs/Locale-Country
diff --git a/config/rootfiles/common/Locale-Country b/config/rootfiles/common/Locale-Country deleted file mode 100644 index 941c18121..000000000 --- a/config/rootfiles/common/Locale-Country +++ /dev/null @@ -1,60 +0,0 @@ -#usr/lib/perl5/site_perl/5.30.0/Locale -#usr/lib/perl5/site_perl/5.30.0/Locale/Codes -usr/lib/perl5/site_perl/5.30.0/Locale/Codes.pm -#usr/lib/perl5/site_perl/5.30.0/Locale/Codes.pod -#usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Changes.pod -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Constants.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Country.pm -#usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Country.pod -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Country_Codes.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Country_Retired.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Currency.pm -#usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Currency.pod -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Currency_Codes.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Currency_Retired.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/LangExt.pm -#usr/lib/perl5/site_perl/5.30.0/Locale/Codes/LangExt.pod -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/LangExt_Codes.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/LangExt_Retired.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/LangFam.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/LangFam.pod -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/LangFam_Codes.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/LangFam_Retired.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/LangVar.pm -#usr/lib/perl5/site_perl/5.30.0/Locale/Codes/LangVar.pod -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/LangVar_Codes.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/LangVar_Retired.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Language.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Language.pod -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Language_Codes.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Language_Retired.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Script.pm -#usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Script.pod -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Script_Codes.pm -usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Script_Retired.pm -#usr/lib/perl5/site_perl/5.30.0/Locale/Codes/Types.pod -usr/lib/perl5/site_perl/5.30.0/Locale/Country.pm -#usr/lib/perl5/site_perl/5.30.0/Locale/Country.pod -usr/lib/perl5/site_perl/5.30.0/Locale/Currency.pm -#usr/lib/perl5/site_perl/5.30.0/Locale/Currency.pod -usr/lib/perl5/site_perl/5.30.0/Locale/Language.pm -#usr/lib/perl5/site_perl/5.30.0/Locale/Language.pod -usr/lib/perl5/site_perl/5.30.0/Locale/Script.pm -#usr/lib/perl5/site_perl/5.30.0/Locale/Script.pod -#usr/lib/perl5/site_perl/5.30.0/xxxMACHINExxx-linux-thread-multi/auto/Locale -#usr/lib/perl5/site_perl/5.30.0/xxxMACHINExxx-linux-thread-multi/auto/Locale/Codes -#usr/lib/perl5/site_perl/5.30.0/xxxMACHINExxx-linux-thread-multi/auto/Locale/Codes/.packlist -#usr/share/man/man3/Locale::Codes.3 -#usr/share/man/man3/Locale::Codes::Changes.3 -#usr/share/man/man3/Locale::Codes::Country.3 -#usr/share/man/man3/Locale::Codes::Currency.3 -#usr/share/man/man3/Locale::Codes::LangExt.3 -#usr/share/man/man3/Locale::Codes::LangFam.3 -#usr/share/man/man3/Locale::Codes::LangVar.3 -#usr/share/man/man3/Locale::Codes::Language.3 -#usr/share/man/man3/Locale::Codes::Script.3 -#usr/share/man/man3/Locale::Codes::Types.3 -#usr/share/man/man3/Locale::Country.3 -#usr/share/man/man3/Locale::Currency.3 -#usr/share/man/man3/Locale::Language.3 -#usr/share/man/man3/Locale::Script.3 diff --git a/lfs/Locale-Country b/lfs/Locale-Country deleted file mode 100644 index 1f9323ee0..000000000 --- a/lfs/Locale-Country +++ /dev/null @@ -1,77 +0,0 @@ -############################################################################### -# # -# IPFire.org - A linux based firewall # -# Copyright (C) 2007-2018 IPFire Team info@ipfire.org # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see http://www.gnu.org/licenses/. # -# # -############################################################################### - -############################################################################### -# Definitions -############################################################################### - -include Config - -VER = 3.62 - -THISAPP = Locale-Codes-$(VER) -DL_FILE = $(THISAPP).tar.gz -DL_FROM = $(URL_IPFIRE) -DIR_APP = $(DIR_SRC)/$(THISAPP) -TARGET = $(DIR_INFO)/$(THISAPP) - -############################################################################### -# Top-level Rules -############################################################################### - -objects = $(DL_FILE) - -$(DL_FILE) = $(DL_FROM)/$(DL_FILE) - -$(DL_FILE)_MD5 = d4ee6fb8b5483c54abde1aa2b94e555a - -install : $(TARGET) - -check : $(patsubst %,$(DIR_CHK)/%,$(objects)) - -download :$(patsubst %,$(DIR_DL)/%,$(objects)) - -md5 : $(subst %,%_MD5,$(objects)) - -############################################################################### -# Downloading, checking, md5sum -############################################################################### - -$(patsubst %,$(DIR_CHK)/%,$(objects)) : - @$(CHECK) - -$(patsubst %,$(DIR_DL)/%,$(objects)) : - @$(LOAD) - -$(subst %,%_MD5,$(objects)) : - @$(MD5) - -############################################################################### -# Installation Details -############################################################################### - -$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) - @$(PREBUILD) - @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) - cd $(DIR_APP) && perl Makefile.PL - cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE) - cd $(DIR_APP) && make install - @rm -rf $(DIR_APP) - @$(POSTBUILD) diff --git a/make.sh b/make.sh index 4a9dd3cb6..ad721eeca 100755 --- a/make.sh +++ b/make.sh @@ -1336,7 +1336,6 @@ buildipfire() { lfsmake2 Archive-Tar lfsmake2 Archive-Zip lfsmake2 Text-Tabs+Wrap - lfsmake2 Locale-Country lfsmake2 XML-Parser lfsmake2 Crypt-PasswdMD5 lfsmake2 Net-Telnet
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- config/cfgroot/location-functions.pl | 17 +++++++--- html/cgi-bin/ipinfo.cgi | 48 ++++++++++++++++++++++++---- 2 files changed, 55 insertions(+), 10 deletions(-)
diff --git a/config/cfgroot/location-functions.pl b/config/cfgroot/location-functions.pl index b0b8cd086..2cfe7f908 100644 --- a/config/cfgroot/location-functions.pl +++ b/config/cfgroot/location-functions.pl @@ -190,10 +190,13 @@ sub get_locations() { return @sorted_locations; }
-# Function to check if a given address has a special flag. -sub address_has_flag($) { +# Function to check if a given address has one ore more special flags. +sub address_has_flags($) { my ($address) = @_;
+ # Array to store the flags of the address. + my @flags; + # Init libloc database handle. my $db_handle = &init();
@@ -206,10 +209,16 @@ sub address_has_flag($) { # Grab the mapped location code for this flag. $mapped_code = $network_flags{$flag};
- # Return the code. - return $mapped_code; + # Add the mapped code to the array of flags. + push(@flags, $mapped_code); } } + + # Sort the array of flags. + @flags = sort(@flags); + + # Return the array of flags. + return @flags; }
1; diff --git a/html/cgi-bin/ipinfo.cgi b/html/cgi-bin/ipinfo.cgi index cce6097ff..d8cb6c6b7 100644 --- a/html/cgi-bin/ipinfo.cgi +++ b/html/cgi-bin/ipinfo.cgi @@ -64,7 +64,7 @@ if (&General::validip($addr)) { # enumerate location information for IP address... my $db_handle = &Location::Functions::init(); my $ccode = &Location::Functions::lookup_country_code($db_handle, $addr); - my $network_flag = &Location::Functions::address_has_flag($addr); + my @network_flags = &Location::Functions::address_has_flags($addr);
# Try to get the continent of the country code. my $continent = &Location::get_continent_code($db_handle, $ccode); @@ -111,12 +111,48 @@ if (&General::validip($addr)) { &Header::openbox('100%', 'left', $addr . " <a href='country.cgi#$ccode'><img src='$flag_icon' border='0' align='absmiddle' alt='$ccode' title='$ccode' /></a> (" . $hostname . ') : '.$whois_server);
# Check if the address has a flag. - if ($network_flag) { - # Get - my $network_flag_name = &Location::Functions::get_full_country_name($network_flag); + if (@network_flags) { + # Get amount of flags for this network. + my $flags_amount = @network_flags; + my $processed_flags; + + # The message string which will be displayed. + my $message_string = "This address is marked as"; + + # Loop through the array of network_flags. + foreach my $network_flag (@network_flags) { + # Increment value of processed flags. + $processed_flags++; + + # Get the network flag name. + my $network_flag_name = &Location::Functions::get_full_country_name($network_flag); + + # Add the flag name to the message string. + $message_string = "$message_string" . " $network_flag_name"; + + # Check if multiple flags are set for this network. + if ($flags_amount gt "1") { + # Check if the the current flag is the next-to-last one. + if ($processed_flags eq $flags_amount - 1) { + $message_string = "$message_string" . " and "; + + # Check if the current flag it the last one. + } elsif ($processed_flags eq $flags_amount) { + # The message is finished add a dot for ending the sentence. + $message_string = "$message_string" . "."; + + # Otherwise add a simple comma to the message string. + } else { + $message_string = "$message_string" . ", "; + } + } else { + # Nothing special to do, simple add a dot to finish the sentence. + $message_string = "$message_string" . "."; + } + }
- # Display notice. - print "<h3>This address is marked as $network_flag_name.</h3>\n"; + # Display the generated notice. + print "<h3>$message_string</h3>\n"; print "<br>\n"; }
Also update to the shipped database to 2020-09-21.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- lfs/libloc | 12 ++++------ ...te-buffer-when-reading-from-database.patch | 24 ------------------- ...c-0.9.3-location-provide-return-code.patch | 22 ----------------- 3 files changed, 4 insertions(+), 54 deletions(-) delete mode 100644 src/patches/libloc-0.9.3-country-terminate-buffer-when-reading-from-database.patch delete mode 100644 src/patches/libloc-0.9.3-location-provide-return-code.patch
diff --git a/lfs/libloc b/lfs/libloc index 178f9f9cc..da53e5149 100644 --- a/lfs/libloc +++ b/lfs/libloc @@ -24,8 +24,8 @@
include Config
-VER = 0.9.3 -DB_DATE = 2020-07-10 +VER = 0.9.4 +DB_DATE = 2020-09-21
THISAPP = libloc-$(VER) DL_FILE = $(THISAPP).tar.gz @@ -43,8 +43,8 @@ objects = $(DL_FILE) \ $(DL_FILE) = https://source.ipfire.org/releases/libloc//$(DL_FILE) location-$(DB_DATE).db.xz = https://location.ipfire.org/databases/1/archive/location-$(DB_DATE).db.xz
-$(DL_FILE)_MD5 = 61f1d543f67baf665b0140d3676fdade -location-$(DB_DATE).db.xz_MD5 = 3f68f631e94c29b953c4e60454567540 +$(DL_FILE)_MD5 = 82770e9eba20f636c96e6fa42ff234b5 +location-$(DB_DATE).db.xz_MD5 = fa3069bf31170629d638317e283913c0
install : $(TARGET)
@@ -78,10 +78,6 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar xvf $(DIR_DL)/$(DL_FILE)
- # Apply upstream patches - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/libloc-0.9.3-country-terminate-buffer-when-reading-from-database.patch - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/libloc-0.9.3-location-provide-return-code.patch - # Add patch for i586 to disable strong stack protector. ifeq "$(BUILD_ARCH)" "i586" cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/libloc-0.9.3-perl-i586-regular-stack-protector.patch diff --git a/src/patches/libloc-0.9.3-country-terminate-buffer-when-reading-from-database.patch b/src/patches/libloc-0.9.3-country-terminate-buffer-when-reading-from-database.patch deleted file mode 100644 index 0ad9229fd..000000000 --- a/src/patches/libloc-0.9.3-country-terminate-buffer-when-reading-from-database.patch +++ /dev/null @@ -1,24 +0,0 @@ -commit 61d3516bbfce6b4e6393825329c07b1e2a88d47d -Author: Michael Tremer michael.tremer@ipfire.org -Date: Mon Jul 13 10:47:30 2020 +0000 - - country: Terminate buffer when reading from database - - Compilers on ARM do not seem to initialise the buffer. - - Signed-off-by: Michael Tremer michael.tremer@ipfire.org - -diff --git a/src/country.c b/src/country.c -index d6ddf50..2ba93e6 100644 ---- a/src/country.c -+++ b/src/country.c -@@ -125,6 +125,9 @@ int loc_country_new_from_database_v1(struct loc_ctx* ctx, struct loc_stringpool* - // Read country code - loc_country_code_copy(buffer, dbobj->code); - -+ // Terminate buffer -+ buffer[2] = '\0'; -+ - // Create a new country object - int r = loc_country_new(ctx, country, buffer); - if (r) diff --git a/src/patches/libloc-0.9.3-location-provide-return-code.patch b/src/patches/libloc-0.9.3-location-provide-return-code.patch deleted file mode 100644 index 2382145c3..000000000 --- a/src/patches/libloc-0.9.3-location-provide-return-code.patch +++ /dev/null @@ -1,22 +0,0 @@ -commit 1be0681cc4bcc006369e69d90dc4439eaa6f58d5 -Author: Stefan Schantl stefan.schantl@ipfire.org -Date: Wed Jul 29 18:50:20 2020 +0200 - - location: Provide a return code if the database does not need to be - updated. - - Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org - -diff --git a/src/python/location.in b/src/python/location.in -index 5211b28..8cdd140 100644 ---- a/src/python/location.in -+++ b/src/python/location.in -@@ -416,7 +416,7 @@ class CLI(object): - _("The datase has recently be updated recently (%s)") % \ - format_timedelta(now - t), - ) -- return -+ return 3 - - # Fetch the timestamp we need from DNS - t = location.discover_latest_version()