1 |
diff -Nur smeserver-geoip-1.2.old/root/usr/share/qpsmtpd/plugins/check_badcountries smeserver-geoip-1.2/root/usr/share/qpsmtpd/plugins/check_badcountries |
2 |
--- smeserver-geoip-1.2.old/root/usr/share/qpsmtpd/plugins/check_badcountries 2019-01-05 14:42:43.487000000 -0500 |
3 |
+++ smeserver-geoip-1.2/root/usr/share/qpsmtpd/plugins/check_badcountries 2019-01-05 14:47:37.767000000 -0500 |
4 |
@@ -96,6 +96,8 @@ |
5 |
|
6 |
=head1 CHANGES |
7 |
|
8 |
+2019-01 - JP Pialasse - make it compatible with old v1 + improve log level |
9 |
+ |
10 |
2018-06 - John Crisp - modify to work with SME server |
11 |
|
12 |
2014-06 - Matt Simerson - added GeoIP2 support |
13 |
@@ -152,9 +154,8 @@ |
14 |
|
15 |
sub load_geoip { |
16 |
my ( $self ) = @_; |
17 |
- # prevent v1 from functioning |
18 |
- # $self->load_geoip1() and return 1; |
19 |
$self->load_geoip2() and return 1; |
20 |
+ $self->load_geoip1() and return 1; #only search v1 if v2 not available |
21 |
return 0; |
22 |
} |
23 |
|
24 |
@@ -278,7 +279,7 @@ |
25 |
# Returns DECLINED if there are no countries found above |
26 |
return DECLINED unless $country; |
27 |
|
28 |
- $self->log(LOGINFO, "Country $country RemoteIP $ip"); |
29 |
+ $self->log(LOGNOTICE, "Country $country RemoteIP $ip"); |
30 |
|
31 |
for (@badcountries) { |
32 |
my ($pattern, $response) = split /\s+/, $_, 2; |
33 |
@@ -476,6 +477,7 @@ |
34 |
return $self->set_asn_ipv6($ip); |
35 |
} |
36 |
return if ! $self->{GeoIPASNum}; |
37 |
+ return if ! $self->{GeoIPASNum}->can('name_by_addr');# prior Geo-IP 1.39 should use org_by_addr |
38 |
|
39 |
my $asn = $self->{GeoIPASNum}->name_by_addr($ip) or return; |
40 |
if ('AS' eq substr($asn, 0, 2)) { |