Hi,
this diff add GeoIP2 support to SpamAssassin and makes it the default
geo library as done upstream.
Ok or is it a too heavy dependency ?
 Cheers
  Giovanni
Index: Makefile
===================================================================
RCS file: /var/cvs/ports/mail/p5-Mail-SpamAssassin/Makefile,v
retrieving revision 1.111
diff -u -p -r1.111 Makefile
--- Makefile    25 Sep 2018 09:05:09 -0000      1.111
+++ Makefile    20 Feb 2019 07:59:32 -0000
@@ -5,7 +5,7 @@ COMMENT=                mailfilter to identify and mar
 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-Geo-IP-*|p5-IP-Country-DB_File-*|p5-IP-Country-*:net/p5-GeoIP2 \
                        net/p5-Net-LibIDN \
                        net/p5-Net-Patricia \
                        security/gnupg \
Index: patches/patch-lib_Mail_SpamAssassin_Plugin_URILocalBL_pm
===================================================================
RCS file: patches/patch-lib_Mail_SpamAssassin_Plugin_URILocalBL_pm
diff -N patches/patch-lib_Mail_SpamAssassin_Plugin_URILocalBL_pm
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_Mail_SpamAssassin_Plugin_URILocalBL_pm    20 Feb 2019 
08:05:11 -0000
@@ -0,0 +1,34 @@
+$OpenBSD$
+
+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);
+     }

Attachment: signature.asc
Description: PGP signature



Reply via email to