add GeoIP2 support and make it the default

remove optional Geo::IP support from dependencies,
databases are not updated anymore
with input from sthen@
This commit is contained in:
giovanni 2019-03-07 07:41:07 +00:00
parent 71a4f027bd
commit 78f886c43b
2 changed files with 37 additions and 3 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.111 2018/09/25 09:05:09 giovanni Exp $
# $OpenBSD: Makefile,v 1.112 2019/03/07 07:41:07 giovanni Exp $
COMMENT= mailfilter to identify and mark spam
VER= 3.4.2
DISTNAME= Mail-SpamAssassin-${VER}
PKGNAME= p5-${DISTNAME}
REVISION= 0
REVISION= 1
RULESNAME= Mail-SpamAssassin-rules-${VER}.r1840640.tgz
CATEGORIES= mail perl5
@ -35,7 +35,7 @@ RUN_DEPENDS= ${COMMON_DEPENDS} \
devel/re2c \
devel/p5-BSD-Resource \
p5-Mail-SPF-*|p5-Mail-SPF-Query-*:mail/p5-Mail-SPF \
p5-Geo-IP-*|p5-IP-Country-DB_File-*|p5-IP-Country-*:net/p5-Geo-IP \
p5-GeoIP2-*|p5-IP-Country-DB_File-*|p5-IP-Country-*:net/p5-GeoIP2 \
net/p5-Net-LibIDN \
net/p5-Net-Patricia \
security/gnupg \

View File

@ -0,0 +1,34 @@
$OpenBSD: patch-lib_Mail_SpamAssassin_Plugin_URILocalBL_pm,v 1.3 2019/03/07 07:41:08 giovanni Exp $
Patch to fix URILocalBL plugin with GeoIP2 Perl module
Index: lib/Mail/SpamAssassin/Plugin/URILocalBL.pm
--- lib/Mail/SpamAssassin/Plugin/URILocalBL.pm.orig
+++ lib/Mail/SpamAssassin/Plugin/URILocalBL.pm
@@ -459,16 +459,20 @@ sub check_uri_local_bl {
# this code burps an ugly message if it fails, but that's redirected elsewhere
my $flags = 0;
- eval '$flags = Geo::IP::GEOIP_SILENCE' if ($gip_wanted >= $gip_have);
+ my $flag_isp = 0;
+ my $flag_silent = 0;
+ eval '$flags = GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE' if ($gip_wanted >= $gip_have);
+ eval '$flag_silent = Geo::IP::GEOIP_SILENCE' if ($gip_wanted >= $gip_have);
+ eval '$flag_isp = GEOIP_ISP_EDITION' if ($gip_wanted >= $gip_have);
- if ($flags && $gic_wanted >= $gic_have) {
- $self->{geoip} = Geo::IP->new(GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE | $flags);
- $self->{geoisp} = Geo::IP->open_type(GEOIP_ISP_EDITION, GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE | $flags);
+ if ($flag_silent && $gic_wanted >= $gic_have) {
+ $self->{geoip} = Geo::IP->new($flags | $flag_silent);
+ $self->{geoisp} = Geo::IP->open_type($flag_isp | $flag_silent | $flags);
} else {
open(OLDERR, ">&STDERR");
open(STDERR, ">", "/dev/null");
- $self->{geoip} = Geo::IP->new(GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE);
- $self->{geoisp} = Geo::IP->open_type(GEOIP_ISP_EDITION, GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE);
+ $self->{geoip} = Geo::IP->new($flags);
+ $self->{geoisp} = Geo::IP->open_type($flag_isp);
open(STDERR, ">&OLDERR");
close(OLDERR);
}