mail-filter/spamassassin: Security cleanup

Bug: https://bugs.gentoo.org/666348
Signed-off-by: Mikle Kolyada <zlogene@gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11
This commit is contained in:
Mikle Kolyada
2018-12-11 13:19:10 +03:00
parent 7e39c93f8c
commit dc7e9cb73a
14 changed files with 0 additions and 2063 deletions

View File

@@ -1,2 +1 @@
DIST Mail-SpamAssassin-3.4.1.tar.bz2 2710985 BLAKE2B f85b0ed2bae783bc6dfa39df36589a6cb90e6c657efcff1fa094f952847e4bcb24aa232b6689804bb1170204ae1d33216ed9bde207d7a7a6863410d8f847c391 SHA512 91d50e2ce6520e3e1c7bc66da133a0815be34ced15e26b6e6c17af5a03d5c62f41d8086f25f65084d6634497148cf5439977d7d4a44d7c3e307535beac6629af
DIST Mail-SpamAssassin-3.4.2.tar.bz2 2700016 BLAKE2B a29b4cfce5e578c07ec54b2224191917dc45bcefff071f674c572fc905f1d6324827bcc21c338546bdea11140fc20474a16314218e2fd4fa685965b0e0078df8 SHA512 fe3d9d1d7b9fed3063549afd071066729f1f4d998be91ded1e5afc29bb37c7a298dc5f8f99a282b75435d317b5b5072a81393134ccfe059a73d953e26a9c3885

View File

@@ -1,280 +0,0 @@
The "sslv3" option doesn't do what it says (upstream bug 7093) and
only makes things worse. The SSLv3 support also prevents SpamAssassin
from working with LibreSSL, which no longer does SSLv3.
Index: trunk/spamc/libspamc.c
===================================================================
--- trunk.orig/spamc/libspamc.c
+++ trunk/spamc/libspamc.c
@@ -1187,7 +1187,7 @@ int message_filter(struct transport *tp,
unsigned int throwaway;
SSL_CTX *ctx = NULL;
SSL *ssl = NULL;
- SSL_METHOD *meth;
+ const SSL_METHOD *meth;
char zlib_on = 0;
unsigned char *zlib_buf = NULL;
int zlib_bufsiz = 0;
@@ -1213,11 +1213,7 @@ int message_filter(struct transport *tp,
if (flags & SPAMC_USE_SSL) {
#ifdef SPAMC_SSL
SSLeay_add_ssl_algorithms();
- if (flags & SPAMC_TLSV1) {
- meth = TLSv1_client_method();
- } else {
- meth = SSLv3_client_method(); /* default */
- }
+ meth = SSLv23_client_method();
SSL_load_error_strings();
ctx = SSL_CTX_new(meth);
#else
@@ -1596,7 +1592,7 @@ int message_tell(struct transport *tp, c
int failureval;
SSL_CTX *ctx = NULL;
SSL *ssl = NULL;
- SSL_METHOD *meth;
+ const SSL_METHOD *meth;
assert(tp != NULL);
assert(m != NULL);
@@ -1604,7 +1600,7 @@ int message_tell(struct transport *tp, c
if (flags & SPAMC_USE_SSL) {
#ifdef SPAMC_SSL
SSLeay_add_ssl_algorithms();
- meth = SSLv3_client_method();
+ meth = SSLv23_client_method();
SSL_load_error_strings();
ctx = SSL_CTX_new(meth);
#else
Index: trunk/spamc/spamc.c
===================================================================
--- trunk.orig/spamc/spamc.c
+++ trunk/spamc/spamc.c
@@ -368,16 +368,11 @@ read_args(int argc, char **argv,
case 'S':
{
flags |= SPAMC_USE_SSL;
- if (!spamc_optarg || (strcmp(spamc_optarg,"sslv3") == 0)) {
- flags |= SPAMC_SSLV3;
- }
- else if (strcmp(spamc_optarg,"tlsv1") == 0) {
- flags |= SPAMC_TLSV1;
- }
- else {
- libspamc_log(flags, LOG_ERR, "Please specify a legal ssl version (%s)", spamc_optarg);
- ret = EX_USAGE;
- }
+ if(spamc_optarg) {
+ libspamc_log(flags, LOG_ERR,
+ "Explicit specification of an SSL/TLS version no longer supported.");
+ ret = EX_USAGE;
+ }
break;
}
#endif
Index: trunk/spamd/spamd.raw
===================================================================
--- trunk.orig/spamd/spamd.raw
+++ trunk/spamd/spamd.raw
@@ -409,7 +409,6 @@ GetOptions(
'sql-config!' => \$opt{'sql-config'},
'ssl' => \$opt{'ssl'},
'ssl-port=s' => \$opt{'ssl-port'},
- 'ssl-version=s' => \$opt{'ssl-version'},
'syslog-socket=s' => \$opt{'syslog-socket'},
'syslog|s=s' => \$opt{'syslog'},
'log-timestamp-fmt:s' => \$opt{'log-timestamp-fmt'},
@@ -744,11 +743,6 @@ if ( defined $ENV{'HOME'} ) {
# Do whitelist later in tmp dir. Side effect: this will be done as -u user.
-my $sslversion = $opt{'ssl-version'} || 'sslv3';
-if ($sslversion !~ /^(?:sslv3|tlsv1)$/) {
- die "spamd: invalid ssl-version: $opt{'ssl-version'}\n";
-}
-
$opt{'server-key'} ||= "$LOCAL_RULES_DIR/certs/server-key.pem";
$opt{'server-cert'} ||= "$LOCAL_RULES_DIR/certs/server-cert.pem";
@@ -899,9 +893,8 @@ sub compose_listen_info_string {
$socket_info->{ip_addr}, $socket_info->{port}));
} elsif ($socket->isa('IO::Socket::SSL')) {
- push(@listeninfo, sprintf("SSL [%s]:%s, ssl version %s",
- $socket_info->{ip_addr}, $socket_info->{port},
- $opt{'ssl-version'}||'sslv3'));
+ push(@listeninfo, sprintf("SSL [%r]:%s", $socket_info->{ip_addr},
+ $socket_info->{port}));
}
}
@@ -1072,7 +1065,6 @@ sub server_sock_setup_inet {
$sockopt{V6Only} = 1 if $io_socket_module_name eq 'IO::Socket::IP'
&& IO::Socket::IP->VERSION >= 0.09;
%sockopt = (%sockopt, (
- SSL_version => $sslversion,
SSL_verify_mode => 0x00,
SSL_key_file => $opt{'server-key'},
SSL_cert_file => $opt{'server-cert'},
@@ -1093,7 +1085,8 @@ sub server_sock_setup_inet {
if (!$server_inet) {
$diag = sprintf("could not create %s socket on [%s]:%s: %s",
$ssl ? 'IO::Socket::SSL' : $io_socket_module_name,
- $adr, $port, $!);
+ $adr, $port, $ssl && $IO::Socket::SSL::SSL_ERROR ?
+ "$!,$IO::Socket::SSL::SSL_ERROR" : $!);
push(@diag_fail, $diag);
} else {
$diag = sprintf("created %s socket on [%s]:%s",
@@ -3238,7 +3231,6 @@ Options:
-H [dir], --helper-home-dir[=dir] Specify a different HOME directory
--ssl Enable SSL on TCP connections
--ssl-port port Override --port setting for SSL connections
- --ssl-version sslversion Specify SSL protocol version to use
--server-key keyfile Specify an SSL keyfile
--server-cert certfile Specify an SSL certificate
--socketpath=path Listen on a given UNIX domain socket
@@ -3727,14 +3719,6 @@ Optionally specifies the port number for
SSL connections (default: whatever --port uses). See B<--ssl> for
more details.
-=item B<--ssl-version>=I<sslversion>
-
-Specify the SSL protocol version to use, one of B<sslv3> or B<tlsv1>.
-The default, B<sslv3>, is the most flexible, accepting a SSLv3 or
-higher hello handshake, then negotiating use of SSLv3 or TLSv1
-protocol if the client can accept it. Specifying B<--ssl-version>
-implies B<--ssl>.
-
=item B<--server-key> I<keyfile>
Specify the SSL key file to use for SSL connections.
Index: trunk/spamc/spamc.pod
===================================================================
--- trunk.orig/spamc/spamc.pod
+++ trunk/spamc/spamc.pod
@@ -177,12 +177,10 @@ The default is 1 time (ie. one attempt a
Sleep for I<sleep> seconds between failed spamd filtering attempts.
The default is 1 second.
-=item B<-S>, B<--ssl>, B<--ssl>=I<sslversion>
+=item B<-S>, B<--ssl>, B<--ssl>
If spamc was built with support for SSL, encrypt data to and from the
spamd process with SSL; spamd must support SSL as well.
-I<sslversion> specifies the SSL protocol version to use, either
-C<sslv3>, or C<tlsv1>. The default, is C<sslv3>.
=item B<-t> I<timeout>, B<--timeout>=I<timeout>
Index: trunk/t/spamd_ssl_tls.t
===================================================================
--- trunk.orig/t/spamd_ssl_tls.t
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/perl
-
-use lib '.'; use lib 't';
-use SATest; sa_t_init("spamd_ssl_tls");
-use Test; plan tests => (($SKIP_SPAMD_TESTS || !$SSL_AVAILABLE) ? 0 : 9);
-
-exit if ($SKIP_SPAMD_TESTS || !$SSL_AVAILABLE);
-
-# ---------------------------------------------------------------------------
-
-%patterns = (
-
-q{ Return-Path: sb55sb55@yahoo.com}, 'firstline',
-q{ Subject: There yours for FREE!}, 'subj',
-q{ X-Spam-Status: Yes, score=}, 'status',
-q{ X-Spam-Flag: YES}, 'flag',
-q{ X-Spam-Level: **********}, 'stars',
-q{ TEST_ENDSNUMS}, 'endsinnums',
-q{ TEST_NOREALNAME}, 'noreal',
-q{ This must be the very last line}, 'lastline',
-
-
-);
-
-ok (sdrun ("-L --ssl --ssl-version=tlsv1 --server-key data/etc/testhost.key --server-cert data/etc/testhost.cert",
- "--ssl=tlsv1 < data/spam/001",
- \&patterns_run_cb));
-ok_all_patterns();
Index: trunk/t/spamd_ssl_v3.t
===================================================================
--- trunk.orig/t/spamd_ssl_v3.t
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/perl
-
-use lib '.'; use lib 't';
-use SATest; sa_t_init("spamd_sslv3");
-use Test; plan tests => (($SKIP_SPAMD_TESTS || !$SSL_AVAILABLE) ? 0 : 9);
-
-exit if ($SKIP_SPAMD_TESTS || !$SSL_AVAILABLE);
-
-# ---------------------------------------------------------------------------
-
-%patterns = (
-
-q{ Return-Path: sb55sb55@yahoo.com}, 'firstline',
-q{ Subject: There yours for FREE!}, 'subj',
-q{ X-Spam-Status: Yes, score=}, 'status',
-q{ X-Spam-Flag: YES}, 'flag',
-q{ X-Spam-Level: **********}, 'stars',
-q{ TEST_ENDSNUMS}, 'endsinnums',
-q{ TEST_NOREALNAME}, 'noreal',
-q{ This must be the very last line}, 'lastline',
-
-
-);
-
-ok (sdrun ("-L --ssl --ssl-version=sslv3 --server-key data/etc/testhost.key --server-cert data/etc/testhost.cert",
- "--ssl=sslv3 < data/spam/001",
- \&patterns_run_cb));
-ok_all_patterns();
Index: trunk/t/spamd_ssl_accept_fail.t
===================================================================
--- trunk.orig/t/spamd_ssl_accept_fail.t
+++ trunk/t/spamd_ssl_accept_fail.t
@@ -23,9 +23,9 @@ q{ This must be the very last line}, 'la
);
-ok (start_spamd ("-L --ssl --ssl-version=sslv3 --server-key data/etc/testhost.key --server-cert data/etc/testhost.cert"));
+ok (start_spamd ("-L --ssl --server-key data/etc/testhost.key --server-cert data/etc/testhost.cert"));
ok (spamcrun ("< data/spam/001", \&patterns_run_cb));
-ok (spamcrun ("--ssl=sslv3 < data/spam/001", \&patterns_run_cb));
+ok (spamcrun ("--ssl < data/spam/001", \&patterns_run_cb));
ok (stop_spamd ());
ok_all_patterns();
Index: trunk/t/spamd_ssl.t
===================================================================
--- trunk.orig/t/spamd_ssl.t
+++ trunk/t/spamd_ssl.t
@@ -2,10 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("spamd_ssl");
-use Test; plan tests => (($SKIP_SPAMD_TESTS || !$SSL_AVAILABLE) ? 0 : 9),
- onfail => sub {
- warn "\n\nNote: This may not be a SpamAssassin bug, as some platforms require that you" .
- "\nspecify a protocol in spamc --ssl option, and possibly in spamd --ssl-version.\n\n" };
+use Test; plan tests => (($SKIP_SPAMD_TESTS || !$SSL_AVAILABLE) ? 0 : 9);
exit if ($SKIP_SPAMD_TESTS || !$SSL_AVAILABLE);
Index: trunk/MANIFEST
===================================================================
--- trunk.orig/MANIFEST
+++ trunk/MANIFEST
@@ -513,8 +513,6 @@ t/spamd_report_ifspam.t
t/spamd_sql_prefs.t
t/spamd_ssl.t
t/spamd_ssl_accept_fail.t
-t/spamd_ssl_tls.t
-t/spamd_ssl_v3.t
t/spamd_stop.t
t/spamd_symbols.t
t/spamd_syslog.t

View File

@@ -1,31 +0,0 @@
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7208
https://bugs.gentoo.org/650638
--- a/lib/Mail/SpamAssassin/Plugin/URILocalBL.pm 2015/06/10 12:15:22 1684652
+++ a/lib/Mail/SpamAssassin/Plugin/URILocalBL.pm 2015/06/10 12:18:50 1684653
@@ -350,7 +350,7 @@
# look for W3 links only
next unless (defined $info->{types}->{a});
- while (my($host, $domain) = each $info->{hosts}) {
+ while (my($host, $domain) = each %{$info->{hosts}}) {
# skip if the domain name was matched
if (exists $rule->{exclusions} && exists $rule->{exclusions}->{$domain}) {
@@ -374,7 +374,7 @@
}
if (exists $rule->{countries}) {
- dbg("check: uri_local_bl countries %s\n", join(' ', sort keys $rule->{countries}));
+ dbg("check: uri_local_bl countries %s\n", join(' ', sort keys %{$rule->{countries}}));
my $cc = $self->{geoip}->country_code_by_addr($ip);
@@ -403,7 +403,7 @@
}
if (exists $rule->{isps}) {
- dbg("check: uri_local_bl isps %s\n", join(' ', map { '"' . $_ . '"'; } sort keys $rule->{isps}));
+ dbg("check: uri_local_bl isps %s\n", join(' ', map { '"' . $_ . '"'; } sort keys %{$rule->{isps}}));
my $isp = $self->{geoisp}->isp_by_name($ip);

View File

@@ -1,14 +0,0 @@
# Fix for Gentoo bug 579222 (SpamAssassin bug 7223).
--- a/lib/Mail/SpamAssassin/DnsResolver.pm 2015/07/20 18:23:18 1691991
+++ b/lib/Mail/SpamAssassin/DnsResolver.pm 2015/07/20 18:24:48 1691992
@@ -592,6 +592,9 @@
};
if ($packet) {
+ # RD flag needs to be set explicitly since Net::DNS 1.01, Bug 7223
+ $packet->header->rd(1);
+
# my $udp_payload_size = $self->{res}->udppacketsize;
my $udp_payload_size = $self->{conf}->{dns_options}->{edns};
if ($udp_payload_size && $udp_payload_size > 512) {

View File

@@ -1,140 +0,0 @@
This should fix bug 7338, but the related commits were backported to
the 3.4 branch as part of SpamAssassin bug 7231 (comment 13).
--- a/lib/Mail/SpamAssassin/Dns.pm 2017/04/16 06:19:30 1791572
+++ b/lib/Mail/SpamAssassin/Dns.pm 2017/04/16 07:28:59 1791573
@@ -171,7 +171,7 @@
if (substr($rule, 0, 2) eq "__") {
# don't bother with meta rules
} elsif ($answer->type eq 'TXT') {
- # txtdata returns a non- zone-file-format encoded result, unlike rdatastr;
+ # txtdata returns a non- zone-file-format encoded result, unlike rdstring;
# avoid space-separated RDATA <character-string> fields if possible,
# txtdata provides a list of strings in a list context since Net::DNS 0.69
$log = join('',$answer->txtdata);
@@ -215,11 +215,13 @@
my $qname = $question->qname;
- # txtdata returns a non- zone-file-format encoded result, unlike rdatastr;
+ # txtdata returns a non- zone-file-format encoded result, unlike rdstring;
# avoid space-separated RDATA <character-string> fields if possible,
# txtdata provides a list of strings in a list context since Net::DNS 0.69
#
+ # rdatastr() is historical/undocumented, use rdstring() since Net::DNS 0.69
my $rdatastr = $answer->UNIVERSAL::can('txtdata') ? join('',$answer->txtdata)
+ : $answer->UNIVERSAL::can('rdstring') ? $answer->rdstring
: $answer->rdatastr;
if (defined $qname && defined $rdatastr) {
my $qclass = $question->qclass;
@@ -267,8 +269,13 @@
my $answ_type = $answer->type;
# TODO: there are some CNAME returns that might be useful
next if ($answ_type ne 'A' && $answ_type ne 'TXT');
- # skip any A record that isn't on 127/8
- next if ($answ_type eq 'A' && $answer->rdatastr !~ /^127\./);
+ if ($answ_type eq 'A') {
+ # Net::DNS::RR::A::address() is available since Net::DNS 0.69
+ my $ip_address = $answer->UNIVERSAL::can('address') ? $answer->address
+ : $answer->rdatastr;
+ # skip any A record that isn't on 127.0.0.0/8
+ next if $ip_address !~ /^127\./;
+ }
for my $rule (@{$rules}) {
$self->dnsbl_hit($rule, $question, $answer);
}
@@ -284,11 +291,13 @@
sub process_dnsbl_set {
my ($self, $set, $question, $answer) = @_;
- # txtdata returns a non- zone-file-format encoded result, unlike rdatastr;
+ # txtdata returns a non- zone-file-format encoded result, unlike rdstring;
# avoid space-separated RDATA <character-string> fields if possible,
# txtdata provides a list of strings in a list context since Net::DNS 0.69
#
- my $rdatastr = $answer->UNIVERSAL::can('txtdata') ? join('',$answer->txtdata)
+ # rdatastr() is historical/undocumented, use rdstring() since Net::DNS 0.69
+ my $rdatastr = $answer->UNIVERSAL::can('txtdata') ? join('',$answer->txtdata)
+ : $answer->UNIVERSAL::can('rdstring') ? $answer->rdstring
: $answer->rdatastr;
while (my ($subtest, $rule) = each %{ $self->{dnspost}->{$set} }) {
--- a/lib/Mail/SpamAssassin/Plugin/AskDNS.pm 2017/04/16 06:19:30 1791572
+++ b/lib/Mail/SpamAssassin/Plugin/AskDNS.pm 2017/04/16 07:28:59 1791573
@@ -140,7 +140,7 @@
multiple character-strings (as defined in Section 3.3 of [RFC1035]), these
strings are concatenated with no delimiters before comparing the result
to the filtering string. This follows requirements of several documents,
-such as RFC 5518, RFC 4408, RFC 4871, RFC 5617. Examples of a plain text
+such as RFC 5518, RFC 7208, RFC 4871, RFC 5617. Examples of a plain text
filtering parameter: "127.0.0.1", "transaction", 'list' .
A regular expression follows a familiar perl syntax like /.../ or m{...}
@@ -539,7 +539,7 @@
@answer = ( undef );
}
- # NOTE: $rr->rdatastr returns the result encoded in a DNS zone file
+ # NOTE: $rr->rdstring returns the result encoded in a DNS zone file
# format, i.e. enclosed in double quotes if a result contains whitespace
# (or other funny characters), and may use \DDD encoding or \X quoting as
# per RFC 1035. Using $rr->txtdata instead avoids this unnecessary encoding
@@ -566,19 +566,26 @@
# special case, no answer records, only rcode can be tested
} else {
$rr_type = uc $rr->type;
- if ($rr->UNIVERSAL::can('txtdata')) { # TXT, SPF
- # join with no intervening spaces, as per RFC 5518
+ if ($rr_type eq 'A') {
+ # Net::DNS::RR::A::address() is available since Net::DNS 0.69
+ $rr_rdatastr = $rr->UNIVERSAL::can('address') ? $rr->address
+ : $rr->rdatastr;
+ if ($rr_rdatastr =~ m/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\z/) {
+ $rdatanum = Mail::SpamAssassin::Util::my_inet_aton($rr_rdatastr);
+ }
+
+ } elsif ($rr->UNIVERSAL::can('txtdata')) {
+ # TXT, SPF: join with no intervening spaces, as per RFC 5518
if ($txtdata_can_provide_a_list || $rr_type ne 'TXT') {
$rr_rdatastr = join('', $rr->txtdata); # txtdata() in list context!
} else { # char_str_list() is only available for TXT records
$rr_rdatastr = join('', $rr->char_str_list); # historical
}
} else {
- $rr_rdatastr = $rr->rdatastr;
- if ($rr_type eq 'A' &&
- $rr_rdatastr =~ m/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\z/) {
- $rdatanum = Mail::SpamAssassin::Util::my_inet_aton($rr_rdatastr);
- }
+ # rdatastr() is historical, use rdstring() since Net::DNS 0.69
+ $rr_rdatastr = $rr->UNIVERSAL::can('rdstring') ? $rr->rdstring
+ : $rr->rdatastr;
+ utf8::encode($rr_rdatastr) if utf8::is_utf8($rr_rdatastr);
}
# dbg("askdns: received rr type %s, data: %s", $rr_type, $rr_rdatastr);
}
--- a/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm 2017/04/16 06:19:30 1791572
+++ b/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm 2017/04/16 07:28:59 1791573
@@ -1009,10 +1009,9 @@
dbg("uridnsbl: complete_a_lookup aborted %s", $ent->{key});
return;
}
-
dbg("uridnsbl: complete_a_lookup %s", $ent->{key});
- my @answer = $pkt->answer;
my $j = 0;
+ my @answer = $pkt->answer;
foreach my $rr (@answer) {
$j++;
my $str = $rr->string;
@@ -1099,7 +1098,9 @@
my $rr_type = $rr->type;
if ($rr_type eq 'A') {
- $rdatastr = $rr->rdatastr;
+ # Net::DNS::RR::A::address() is available since Net::DNS 0.69
+ $rdatastr = $rr->UNIVERSAL::can('address') ? $rr->address
+ : $rr->rdatastr;
if ($rdatastr =~ m/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {
$rdatanum = Mail::SpamAssassin::Util::my_inet_aton($rdatastr);
}

View File

@@ -1,29 +0,0 @@
# Fix for Gentoo bug 579222 (SpamAssassin bug 7231).
--- a/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm (revision 1694052)
+++ b/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm (working copy)
@@ -942,9 +942,8 @@
next unless (defined($str) && defined($dom));
dbg("uridnsbl: got($j) NS for $dom: $str");
- if ($str =~ /IN\s+NS\s+(\S+)/) {
- my $nsmatch = lc $1;
- $nsmatch =~ s/\.$//;
+ if ($rr->type eq 'NS') {
+ my $nsmatch = lc $rr->nsdname; # available since at least Net::DNS 0.14
my $nsrhblstr = $nsmatch;
my $fullnsrhblstr = $nsmatch;
@@ -1025,9 +1024,9 @@
}
dbg("uridnsbl: complete_a_lookup got(%d) A for %s: %s", $j,$hname,$str);
- local $1;
- if ($str =~ /IN\s+A\s+(\S+)/) {
- $self->lookup_dnsbl_for_ip($pms, $ent->{obj}, $1);
+ if ($rr->type eq 'A') {
+ my $ip_address = $rr->rdatastr;
+ $self->lookup_dnsbl_for_ip($pms, $ent->{obj}, $ip_address);
}
}
}

View File

@@ -1,88 +0,0 @@
# Fix for Gentoo bug 579222 (SpamAssassin bug 7265).
# Two different revisions from that bug have been concatenated
# together into this patch.
--- a/lib/Mail/SpamAssassin/DnsResolver.pm 2015/11/19 15:23:56 1715196
+++ b/lib/Mail/SpamAssassin/DnsResolver.pm 2015/11/19 15:31:49 1715197
@@ -725,6 +725,37 @@
###########################################################################
+=item $id = $res->bgread()
+
+Similar to C<Net::DNS::Resolver::bgread>. Reads a DNS packet from
+a supplied socket, decodes it, and returns a Net::DNS::Packet object
+if successful. Dies on error.
+
+=cut
+
+sub bgread() {
+ my ($self) = @_;
+ my $sock = $self->{sock};
+ my $packetsize = $self->{res}->udppacketsize;
+ $packetsize = 512 if $packetsize < 512; # just in case
+ my $data = '';
+ my $peeraddr = $sock->recv($data, $packetsize+256); # with some size margin for troubleshooting
+ defined $peeraddr or die "bgread: recv() failed: $!";
+ my $peerhost = $sock->peerhost;
+ $data ne '' or die "bgread: received empty packet from $peerhost";
+ dbg("dns: bgread: received %d bytes from %s", length($data), $peerhost);
+ my($answerpkt, $decoded_length) = Net::DNS::Packet->new(\$data);
+ $answerpkt or die "bgread: decoding DNS packet failed: $@";
+ $answerpkt->answerfrom($peerhost);
+ if ($decoded_length ne length($data)) {
+ warn sprintf("bgread: received a %d bytes packet from %s, decoded %d bytes\n",
+ length($data), $peerhost, $decoded_length);
+ }
+ return $answerpkt;
+}
+
+###########################################################################
+
=item $nfound = $res->poll_responses()
See if there are any C<bgsend> reply packets ready, and return
@@ -772,13 +803,25 @@
$timeout = 0; # next time around collect whatever is available, then exit
last if $nfound == 0;
- my $packet = $self->{res}->bgread($self->{sock});
+ my $packet;
+ eval {
+ $packet = $self->bgread();
+ } or do {
+ undef $packet;
+ my $eval_stat = $@ ne '' ? $@ : "errno=$!"; chomp $eval_stat;
+ # resignal if alarm went off
+ die $eval_stat if $eval_stat =~ /__alarm__ignore__\(.*\)/s;
+ info("dns: bad dns reply: %s", $eval_stat);
+ };
+
+# Bug 7265, use our own bgread()
+# my $packet = $self->{res}->bgread($self->{sock});
if (!$packet) {
- my $dns_err = $self->{res}->errorstring;
- # resignal if alarm went off
- die "dns (3) $dns_err\n" if $dns_err =~ /__alarm__ignore__\(.*\)/s;
- info("dns: bad dns reply: $dns_err");
+ # error already reported above
+# my $dns_err = $self->{res}->errorstring;
+# die "dns (3) $dns_err\n" if $dns_err =~ /__alarm__ignore__\(.*\)/s;
+# info("dns: bad dns reply: $dns_err");
} else {
my $header = $packet->header;
if (!$header) {
--- a/lib/Mail/SpamAssassin/Plugin/DKIM.pm 2015/11/19 19:20:06 1715247
+++ b/lib/Mail/SpamAssassin/Plugin/DKIM.pm 2015/11/19 19:22:25 1715248
@@ -793,7 +793,8 @@
# Only do so if EDNS0 provides a reasonably-sized UDP payload size,
# as our interface does not provide a DNS fallback to TCP, unlike
# the Net::DNS::Resolver::send which does provide it.
- my $res = $self->{main}->{resolver}->get_resolver;
+ my $res = $self->{main}->{resolver};
+ dbg("dkim: providing our own resolver: %s", ref $res);
Mail::DKIM::DNS::resolver($res);
}
}

View File

@@ -1,491 +0,0 @@
This patch is a modified combination of the patches posted to
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7361
that allow SpamAssassin to build against (and work with) openssl-1.1.x.
Mark Wright (gienah) made the necessary updates to get the patches to
work on Gentoo and solve bug 624858.
SpamAssassin-bug: 7361
Gentoo-bug: 624858
--- a/spamc/configure (revision 1767127)
+++ b/spamc/configure (working copy)
@@ -943,7 +943,7 @@
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi
- cd "$ac_popdir"
+ cd $ac_popdir
done
fi
@@ -1874,7 +1874,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -1932,7 +1933,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2048,7 +2050,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2102,7 +2105,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2147,7 +2151,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2191,7 +2196,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2523,7 +2529,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2693,7 +2700,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2764,7 +2772,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2917,7 +2926,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3069,7 +3079,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3260,7 +3271,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3323,7 +3335,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3388,7 +3401,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3491,7 +3505,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3557,7 +3572,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3628,7 +3644,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3666,9 +3683,9 @@
SSLLIBS=""
SSLCFLAGS=""
if test yes = "$sa_ssl_enabled"; then
- echo "$as_me:$LINENO: checking for CRYPTO_lock in -lcrypto" >&5
-echo $ECHO_N "checking for CRYPTO_lock in -lcrypto... $ECHO_C" >&6
-if test "${ac_cv_lib_crypto_CRYPTO_lock+set}" = set; then
+ echo "$as_me:$LINENO: checking for CRYPTO_malloc in -lcrypto" >&5
+echo $ECHO_N "checking for CRYPTO_malloc in -lcrypto... $ECHO_C" >&6
+if test "${ac_cv_lib_crypto_CRYPTO_malloc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -3686,11 +3703,11 @@
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char CRYPTO_lock ();
+char CRYPTO_malloc ();
int
main ()
{
-CRYPTO_lock ();
+CRYPTO_malloc ();
;
return 0;
}
@@ -3704,7 +3721,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3716,20 +3734,20 @@
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_lib_crypto_CRYPTO_lock=yes
+ ac_cv_lib_crypto_CRYPTO_malloc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_crypto_CRYPTO_lock=no
+ac_cv_lib_crypto_CRYPTO_malloc=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_CRYPTO_lock" >&5
-echo "${ECHO_T}$ac_cv_lib_crypto_CRYPTO_lock" >&6
-if test $ac_cv_lib_crypto_CRYPTO_lock = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_CRYPTO_malloc" >&5
+echo "${ECHO_T}$ac_cv_lib_crypto_CRYPTO_malloc" >&6
+if test $ac_cv_lib_crypto_CRYPTO_malloc = yes; then
SSLLIBS="-lcrypto $SSLLIBS"
fi
@@ -3771,7 +3789,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3804,7 +3823,7 @@
# before defining SPAMC_SSL check that all its requirements are
# actually available
if test yes = "$ac_cv_header_openssl_crypto_h" && \
- test yes = "$ac_cv_lib_crypto_CRYPTO_lock" && \
+ test yes = "$ac_cv_lib_crypto_CRYPTO_malloc" && \
test yes = "$ac_cv_lib_ssl_SSL_CTX_free"; then
SSLCFLAGS="-DSPAMC_SSL"
else
@@ -3854,7 +3873,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3927,7 +3947,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4000,7 +4021,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4073,7 +4095,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4182,7 +4205,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4246,7 +4270,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4311,7 +4336,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4368,7 +4394,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4435,7 +4462,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4500,7 +4528,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4564,7 +4593,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4628,7 +4658,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4692,7 +4723,8 @@
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5527,6 +5559,11 @@
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
@@ -5565,12 +5602,6 @@
fi;;
esac
done` || { (exit 1); exit 1; }
-
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
--- a/spamc/configure.in (revision 1767127)
+++ b/spamc/configure.in (working copy)
@@ -64,13 +64,13 @@
SSLLIBS=""
SSLCFLAGS=""
if test yes = "$sa_ssl_enabled"; then
- AC_CHECK_LIB(crypto, CRYPTO_lock,[SSLLIBS="-lcrypto $SSLLIBS"])
+ AC_CHECK_LIB(crypto, CRYPTO_malloc,[SSLLIBS="-lcrypto $SSLLIBS"])
AC_CHECK_LIB(ssl, SSL_CTX_free,[SSLLIBS="-lssl $SSLLIBS"],,-lcrypto)
# before defining SPAMC_SSL check that all its requirements are
# actually available
if test yes = "$ac_cv_header_openssl_crypto_h" && \
- test yes = "$ac_cv_lib_crypto_CRYPTO_lock" && \
+ test yes = "$ac_cv_lib_crypto_CRYPTO_malloc" && \
test yes = "$ac_cv_lib_ssl_SSL_CTX_free"; then
SSLCFLAGS="-DSPAMC_SSL"
else
--- a/spamc/libspamc.c 2017-10-20 13:33:54.129653171 +1100
+++ b/spamc/libspamc.c 2017-10-20 13:36:09.429653849 +1100
@@ -1212,10 +1212,21 @@
if (flags & SPAMC_USE_SSL) {
#ifdef SPAMC_SSL
+#if OPENSSL_API_COMPAT >= 0x10100000L
+ OPENSSL_init_ssl(0, NULL);
+ meth = TLS_method();
+ ctx = SSL_CTX_new(meth);
+ if (flags & SPAMC_TLSV1) {
+ SSL_CTX_set_min_proto_version(ctx, TLS1_VERSION);
+ } else {
+ SSL_CTX_set_min_proto_version(ctx, SSL3_VERSION);
+ }
+#else
SSLeay_add_ssl_algorithms();
meth = SSLv23_client_method();
SSL_load_error_strings();
ctx = SSL_CTX_new(meth);
+#endif
#else
UNUSED_VARIABLE(ssl);
UNUSED_VARIABLE(meth);
@@ -1599,10 +1610,17 @@
if (flags & SPAMC_USE_SSL) {
#ifdef SPAMC_SSL
+#if OPENSSL_API_COMPAT >= 0x10100000L
+ OPENSSL_init_ssl(0, NULL);
+ meth = TLS_method();
+ ctx = SSL_CTX_new(meth);
+ SSL_CTX_set_min_proto_version(ctx, SSL3_VERSION);
+#else
SSLeay_add_ssl_algorithms();
meth = SSLv23_client_method();
SSL_load_error_strings();
ctx = SSL_CTX_new(meth);
+#endif
#else
UNUSED_VARIABLE(ssl);
UNUSED_VARIABLE(meth);

View File

@@ -1,23 +0,0 @@
--- a/lib/Mail/SpamAssassin/PerMsgStatus.pm (revision 1790817)
+++ b/lib/Mail/SpamAssassin/PerMsgStatus.pm (working copy)
@@ -896,16 +896,16 @@
$str .= shift @{$ary};
}
undef $ary;
- chomp ($str); $str .= " [...]\n";
# in case the last line was huge, trim it back to around 200 chars
local $1;
- $str =~ s/^(.{,200}).*$/$1/gs;
+ $str =~ s/^(.{200}).+$/$1 [...]/gm;
+ chomp ($str); $str .= "\n";
# now, some tidy-ups that make things look a bit prettier
- $str =~ s/-----Original Message-----.*$//gs;
+ $str =~ s/-----Original Message-----.*$//gm;
$str =~ s/This is a multi-part message in MIME format\.//gs;
- $str =~ s/[-_\*\.]{10,}//gs;
+ $str =~ s/[-_*.]{10,}//gs;
$str =~ s/\s+/ /gs;
# add "Content preview:" ourselves, so that the text aligns

View File

@@ -1,198 +0,0 @@
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7462
https://bugs.gentoo.org/show_bug.cgi?id=627678
--- Mail-SpamAssassin-3.4.1/t/basic_meta.t 2015-04-28 15:56:59.000000000 -0400
+++ Mail-SpamAssassin-3.4.1/t/basic_meta.t 2017-08-20 21:29:44.000000000 -0400
@@ -14,10 +14,11 @@
if (-e 'test_dir') { # running from test directory, not ..
$prefix = '..';
}
use strict;
+use lib '.'; use lib 't';
use SATest; sa_t_init("meta");
use Test;
use Mail::SpamAssassin;
use vars qw( %rules %scores $perl_path);
--- Mail-SpamAssassin-3.4.1/t/body_mod.t 2015-04-28 15:56:58.000000000 -0400
+++ Mail-SpamAssassin-3.4.1/t/body_mod.t 2017-08-20 21:30:09.000000000 -0400
@@ -14,10 +14,11 @@
if (-e 'test_dir') { # running from test directory, not ..
$prefix = '..';
}
use strict;
+use lib '.'; use lib 't';
use SATest; sa_t_init("body_mod");
use Test; BEGIN { plan tests => 3 };
use Mail::SpamAssassin;
--- Mail-SpamAssassin-3.4.1/t/config_errs.t 2015-04-28 15:56:59.000000000 -0400
+++ Mail-SpamAssassin-3.4.1/t/config_errs.t 2017-08-20 21:30:28.000000000 -0400
@@ -39,10 +39,11 @@
if (-e 'test_dir') { # running from test directory, not ..
$prefix = '..';
}
use strict;
+use lib '.'; use lib 't';
use SATest; sa_t_init("config_errs");
use Test;
use Mail::SpamAssassin;
# initialize SpamAssassin
--- Mail-SpamAssassin-3.4.1/t/debug.t 2015-04-28 15:56:58.000000000 -0400
+++ Mail-SpamAssassin-3.4.1/t/debug.t 2017-08-20 21:31:02.000000000 -0400
@@ -14,10 +14,11 @@
if (-e 'test_dir') { # running from test directory, not ..
$prefix = '..';
}
use strict;
+use lib '.'; use lib 't';
use SATest; sa_t_init("debug");
use Test;
use Mail::SpamAssassin;
use constant TEST_ENABLED => conf_bool('run_long_tests');
--- Mail-SpamAssassin-3.4.1/t/get_headers.t 2015-04-28 15:56:58.000000000 -0400
+++ Mail-SpamAssassin-3.4.1/t/get_headers.t 2017-08-20 21:31:48.000000000 -0400
@@ -15,10 +15,11 @@
$prefix = '..';
}
use strict;
use Test;
+use lib '.'; use lib 't';
use SATest; sa_t_init("get_headers");
use Mail::SpamAssassin;
plan tests => 16;
--- Mail-SpamAssassin-3.4.1/t/idn_dots.t 2015-04-28 15:56:58.000000000 -0400
+++ Mail-SpamAssassin-3.4.1/t/idn_dots.t 2017-08-20 21:32:03.000000000 -0400
@@ -16,10 +16,11 @@
if (-e 'test_dir') { # running from test directory, not ..
$prefix = '..';
}
use strict;
+use lib '.'; use lib 't';
use SATest; sa_t_init("normalize_utf8_dots.t");
use Test;
use Mail::SpamAssassin;
use vars qw(%patterns %anti_patterns);
--- Mail-SpamAssassin-3.4.1/t/missing_hb_separator.t 2015-04-28 15:56:58.000000000 -0400
+++ Mail-SpamAssassin-3.4.1/t/missing_hb_separator.t 2017-08-20 21:32:17.000000000 -0400
@@ -15,10 +15,11 @@
$prefix = '..';
}
use strict;
use Test;
+use lib '.'; use lib 't';
use SATest; sa_t_init("missing_hb_separator");
use Mail::SpamAssassin;
plan tests => 13;
--- Mail-SpamAssassin-3.4.1/t/priorities.t 2015-04-28 15:56:59.000000000 -0400
+++ Mail-SpamAssassin-3.4.1/t/priorities.t 2017-08-20 21:34:21.000000000 -0400
@@ -15,10 +15,11 @@
my $prefix = '.';
if (-e 'test_dir') { # running from test directory, not ..
$prefix = '..';
}
+use lib '.'; use lib 't';
use SATest; sa_t_init("priorities");
use strict;
use Test; BEGIN { plan tests => NUM_TESTS };
use Mail::SpamAssassin;
--- Mail-SpamAssassin-3.4.1/t/regexp_valid.t 2015-04-28 15:56:59.000000000 -0400
+++ Mail-SpamAssassin-3.4.1/t/regexp_valid.t 2017-08-20 21:34:31.000000000 -0400
@@ -14,10 +14,11 @@
if (-e 'test_dir') { # running from test directory, not ..
$prefix = '..';
}
use strict;
+use lib '.'; use lib 't';
use SATest; sa_t_init("regexp_valid");
use Test;
# settings
plan tests => 24;
--- Mail-SpamAssassin-3.4.1/t/relative_scores.t 2015-04-28 15:56:59.000000000 -0400
+++ Mail-SpamAssassin-3.4.1/t/relative_scores.t 2017-08-20 21:34:43.000000000 -0400
@@ -9,10 +9,11 @@
if (-e 'test_dir') { # running from test directory, not ..
unshift(@INC, '../blib/lib', '.');
}
}
+use lib '.'; use lib 't';
use SATest; sa_t_init("relative_scores");
use Test;
use strict;
use vars qw/ $error /;
--- Mail-SpamAssassin-3.4.1/t/reuse.t 2015-04-28 15:56:58.000000000 -0400
+++ Mail-SpamAssassin-3.4.1/t/reuse.t 2017-08-20 21:34:52.000000000 -0400
@@ -14,10 +14,11 @@
if (-e 'test_dir') { # running from test directory, not ..
$prefix = '..';
}
use strict;
+use lib '.'; use lib 't';
use SATest; sa_t_init("reuse");
use Test;
use vars qw(%patterns %anti_patterns $perl_path &patterns_run_cb);
--- Mail-SpamAssassin-3.4.1/t/uri_html.t 2015-04-28 15:56:58.000000000 -0400
+++ Mail-SpamAssassin-3.4.1/t/uri_html.t 2017-08-20 21:35:20.000000000 -0400
@@ -16,10 +16,11 @@
if (-e 'test_dir') { # running from test directory, not ..
$prefix = '..';
}
use strict;
+use lib '.'; use lib 't';
use SATest; sa_t_init("uri_html");
use Test;
use Mail::SpamAssassin;
use vars qw(%patterns %anti_patterns);
--- Mail-SpamAssassin-3.4.1/t/uri.t 2015-04-28 15:56:59.000000000 -0400
+++ Mail-SpamAssassin-3.4.1/t/uri.t 2017-08-20 21:35:30.000000000 -0400
@@ -15,10 +15,11 @@
$prefix = '..';
}
use strict;
use Test;
+use lib '.'; use lib 't';
use SATest; sa_t_init("uri");
use Mail::SpamAssassin;
use Mail::SpamAssassin::HTML;
use Mail::SpamAssassin::Util;
--- Mail-SpamAssassin-3.4.1/t/uri_text.t 2015-04-28 15:56:58.000000000 -0400
+++ Mail-SpamAssassin-3.4.1/t/uri_text.t 2017-08-20 21:35:07.000000000 -0400
@@ -16,10 +16,11 @@
if (-e 'test_dir') { # running from test directory, not ..
$prefix = '..';
}
use strict;
+use lib '.'; use lib 't';
use SATest; sa_t_init("uri_text");
use Test;
use Mail::SpamAssassin;
use vars qw(%patterns %anti_patterns);

View File

@@ -1,14 +0,0 @@
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7367
https://bugs.gentoo.org/625316
--- Mail-SpamAssassin-3.4.1/spamc/configure.pl
+++ Mail-SpamAssassin-3.4.1/spamc/configure.pl
@@ -66,7 +66,7 @@
# Do the same thing as for the preprocessor below.
package version_h;
my $Z = $0;
- local $0 = "version.h.pl";
+ local $0 = "./version.h.pl";
local @ARGV = ();
# Got to check for defined because the script returns shell error level!
unless (defined do $0) {

View File

@@ -1,251 +0,0 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit perl-functions systemd toolchain-funcs user
MY_P="Mail-SpamAssassin-${PV//_/-}"
S="${WORKDIR}/${MY_P}"
DESCRIPTION="An extensible mail filter which can identify and tag spam"
HOMEPAGE="https://spamassassin.apache.org/"
SRC_URI="mirror://apache/spamassassin/source/${MY_P}.tar.bz2"
LICENSE="Apache-2.0 GPL-2"
SLOT="0"
KEYWORDS="alpha amd64 ~arm hppa ia64 ppc ppc64 ~s390 ~sh sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos"
IUSE="berkdb cron ipv6 ldap libressl mysql postgres qmail sqlite ssl test"
# The Makefile.PL script checks for dependencies, but only fails if a
# required (i.e. not optional) dependency is missing. We therefore
# require most of the optional modules only at runtime.
REQDEPEND="dev-lang/perl:=
dev-perl/HTML-Parser
dev-perl/Net-DNS
dev-perl/NetAddr-IP
virtual/perl-Archive-Tar
virtual/perl-Digest-SHA
virtual/perl-IO-Zlib
virtual/perl-Time-HiRes
ssl? (
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl )
)"
# SpamAssassin doesn't use libwww-perl except as a fallback for when
# curl/wget are missing, so we depend on one of those instead. Some
# mirrors use https, so we need those utilities to support SSL.
#
# re2c is needed to compile the rules (sa-compile).
#
# We still need the old Digest-SHA1 because razor2 has not been ported
# to Digest-SHA.
OPTDEPEND="app-crypt/gnupg
dev-perl/Digest-SHA1
dev-perl/Encode-Detect
dev-perl/Geo-IP
dev-perl/HTTP-Date
dev-perl/Mail-DKIM
dev-perl/Mail-SPF
dev-perl/Net-Patricia
dev-perl/Net-CIDR-Lite
dev-util/re2c
|| ( net-misc/wget[ssl] net-misc/curl[ssl] )
virtual/perl-MIME-Base64
virtual/perl-Pod-Parser
berkdb? ( virtual/perl-DB_File )
ipv6? ( dev-perl/IO-Socket-INET6 )
ldap? ( dev-perl/perl-ldap )
mysql? (
dev-perl/DBI
dev-perl/DBD-mysql
)
postgres? (
dev-perl/DBI
dev-perl/DBD-Pg
)
sqlite? (
dev-perl/DBI
dev-perl/DBD-SQLite
)
ssl? ( dev-perl/IO-Socket-SSL )"
DEPEND="${REQDEPEND}
test? (
${OPTDEPEND}
virtual/perl-Test-Harness
)"
RDEPEND="${REQDEPEND} ${OPTDEPEND}"
PATCHES=(
"${FILESDIR}/spamassassin-3.4.1-bug_7199.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7223.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7231.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7265.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7231-extra.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7404.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7462.patch"
"${FILESDIR}/spamassassin-3.4.1-perl526.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7361.patch"
)
src_prepare() {
default
# The sa_compile test does some weird stuff like hopping around in
# the directory tree and calling "make" to create a dist tarball
# from ${S}. It fails, and is more trouble than it's worth...
perl_rm_files t/sa_compile.t || die 'failed to remove sa_compile test'
# The spamc tests (which need the networked spamd daemon) fail for
# irrelevant reasons. It's too hard to disable them (unlike the
# spamd tests themselves -- see src_test), so use a crude
# workaround.
perl_rm_files t/spamc_*.t || die 'failed to remove spamc tests'
}
src_configure() {
# This is how and where the perl-module eclass disables the
# MakeMaker interactive prompt.
export PERL_MM_USE_DEFAULT=1
# Set SYSCONFDIR explicitly so we can't get bitten by bug 48205 again
# (just to be sure, nobody knows how it could happen in the first place).
#
# We also set the path to the perl executable explictly. This will be
# used to create the initial shebang line in the scripts (bug 62276).
perl Makefile.PL \
PREFIX="${EPREFIX}/usr" \
INSTALLDIRS=vendor \
SYSCONFDIR="${EPREFIX}/etc" \
DATADIR="${EPREFIX}/usr/share/spamassassin" \
PERL_BIN="${EPREFIX}/usr/bin/perl" \
ENABLE_SSL="$(usex ssl)" \
DESTDIR="${D}" \
|| die 'failed to create a Makefile using Makefile.PL'
# Now configure spamc.
emake CC="$(tc-getCC)" LDFLAGS="${LDFLAGS}" spamc/Makefile
}
src_compile() {
emake
use qmail && emake spamc/qmail-spamc
}
src_install () {
emake install
einstalldocs
# Create the stub dir used by sa-update and friends
keepdir /var/lib/spamassassin
# Move spamd to sbin where it belongs.
dodir /usr/sbin
mv "${ED}"/usr/bin/spamd "${ED}"/usr/sbin/spamd || die "move spamd failed"
if use qmail; then
dobin spamc/qmail-spamc
fi
ln -s mail/spamassassin "${ED}"/etc/spamassassin || die
# Disable plugin by default
sed -i -e 's/^loadplugin/\#loadplugin/g' \
"${ED}/etc/mail/spamassassin/init.pre" \
|| die "failed to disable plugins by default"
# Add the init and config scripts.
newinitd "${FILESDIR}/3.4.1-spamd.init-r2" spamd
newconfd "${FILESDIR}/3.4.1-spamd.conf-r1" spamd
systemd_newunit "${FILESDIR}/${PN}.service-r4" "${PN}.service"
systemd_install_serviced "${FILESDIR}/${PN}.service.conf-r2" \
"${PN}.service"
use postgres && dodoc sql/*_pg.sql
use mysql && dodoc sql/*_mysql.sql
dodoc NOTICE TRADEMARK CREDITS UPGRADE USAGE sql/README.bayes \
sql/README.awl procmailrc.example sample-nonspam.txt \
sample-spam.txt spamd/PROTOCOL spamd/README.vpopmail \
spamd-apache2/README.apache
# Rename some files so that they don't clash with others.
newdoc spamd/README README.spamd
newdoc sql/README README.sql
newdoc ldap/README README.ldap
if use qmail; then
dodoc spamc/README.qmail
fi
insinto /etc/mail/spamassassin/
insopts -m0400
newins "${FILESDIR}"/secrets.cf secrets.cf.example
# Create the directory where sa-update stores its GPG key (if you
# choose to import one). If this directory does not exist, the
# import will fail. This is bug 396307. We expect that the import
# will be performed as root, and making the directory accessible
# only to root prevents a warning on the command-line.
diropts -m0700
dodir /etc/mail/spamassassin/sa-update-keys
if use cron; then
# Install the cron job if they want it.
exeinto /etc/cron.daily
newexe "${FILESDIR}/update-spamassassin-rules.cron" \
update-spamassassin-rules
fi
# Remove perllocal.pod to avoid file collisions (bug #603338).
perl_delete_localpod || die "failed to remove perllocal.pod"
# The perl-module eclass calls three other functions to clean
# up in src_install. The first fixes references to ${D} in the
# packlist, and is useful to us, too. The other two functions,
# perl_delete_emptybsdir and perl_remove_temppath, don't seem
# to be needed: there are no empty directories, *.bs files, or
# ${D} paths remaining in our installed image.
perl_fix_packlist || die "failed to fix paths in packlist"
}
src_test() {
# Trick the test suite into skipping the spamd tests. Setting
# SPAMD_HOST to a non-localhost value causes SKIP_SPAMD_TESTS to be
# set in SATest.pm.
export SPAMD_HOST=disabled
default
}
pkg_preinst() {
# The spamd daemon runs as this user. Use a real home directory so
# that it can hold SA configuration.
enewuser spamd -1 -1 /home/spamd
}
pkg_postinst() {
elog
elog 'No rules are installed by default. You will need to run sa-update'
elog 'at least once, and most likely configure SpamAssassin before it'
elog 'will work.'
if ! use cron; then
elog
elog 'You should consider a cron job for sa-update. One is provided'
elog 'for daily updates if you enable the "cron" USE flag.'
fi
elog
elog 'Configuration and update help can be found on the wiki:'
elog
elog ' https://wiki.gentoo.org/wiki/SpamAssassin'
elog
ewarn 'If this version of SpamAssassin causes permissions issues'
ewarn 'with your user configurations or bayes databases, then you'
ewarn 'may need to set SPAMD_RUN_AS_ROOT=true in your OpenRC service'
ewarn 'configuration file, or remove the --username and --groupname'
ewarn 'flags from the SPAMD_OPTS variable in your systemd service'
ewarn 'configuration file.'
}

View File

@@ -1,251 +0,0 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit perl-functions systemd toolchain-funcs user
MY_P="Mail-SpamAssassin-${PV//_/-}"
S="${WORKDIR}/${MY_P}"
DESCRIPTION="An extensible mail filter which can identify and tag spam"
HOMEPAGE="https://spamassassin.apache.org/"
SRC_URI="mirror://apache/spamassassin/source/${MY_P}.tar.bz2"
LICENSE="Apache-2.0 GPL-2"
SLOT="0"
KEYWORDS="alpha amd64 arm ~hppa ia64 ppc ppc64 s390 ~sh ~sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos"
IUSE="berkdb cron ipv6 ldap libressl mysql postgres qmail sqlite ssl test"
# The Makefile.PL script checks for dependencies, but only fails if a
# required (i.e. not optional) dependency is missing. We therefore
# require most of the optional modules only at runtime.
REQDEPEND="dev-lang/perl:=
dev-perl/HTML-Parser
dev-perl/Net-DNS
dev-perl/NetAddr-IP
virtual/perl-Archive-Tar
virtual/perl-Digest-SHA
virtual/perl-IO-Zlib
virtual/perl-Time-HiRes
ssl? (
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl )
)"
# SpamAssassin doesn't use libwww-perl except as a fallback for when
# curl/wget are missing, so we depend on one of those instead. Some
# mirrors use https, so we need those utilities to support SSL.
#
# re2c is needed to compile the rules (sa-compile).
#
# We still need the old Digest-SHA1 because razor2 has not been ported
# to Digest-SHA.
OPTDEPEND="app-crypt/gnupg
dev-perl/Digest-SHA1
dev-perl/Encode-Detect
dev-perl/Geo-IP
dev-perl/HTTP-Date
dev-perl/Mail-DKIM
dev-perl/Mail-SPF
dev-perl/Net-Patricia
dev-perl/Net-CIDR-Lite
dev-util/re2c
|| ( net-misc/wget[ssl] net-misc/curl[ssl] )
virtual/perl-MIME-Base64
virtual/perl-Pod-Parser
berkdb? ( virtual/perl-DB_File )
ipv6? ( dev-perl/IO-Socket-INET6 )
ldap? ( dev-perl/perl-ldap )
mysql? (
dev-perl/DBI
dev-perl/DBD-mysql
)
postgres? (
dev-perl/DBI
dev-perl/DBD-Pg
)
sqlite? (
dev-perl/DBI
dev-perl/DBD-SQLite
)
ssl? ( dev-perl/IO-Socket-SSL )"
DEPEND="${REQDEPEND}
test? (
${OPTDEPEND}
virtual/perl-Test-Harness
)"
RDEPEND="${REQDEPEND} ${OPTDEPEND}"
PATCHES=(
"${FILESDIR}/spamassassin-3.4.1-bug_7199.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7223.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7231.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7265.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7231-extra.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7404.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7462.patch"
"${FILESDIR}/spamassassin-3.4.1-perl526.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7361.patch"
)
src_prepare() {
default
# The sa_compile test does some weird stuff like hopping around in
# the directory tree and calling "make" to create a dist tarball
# from ${S}. It fails, and is more trouble than it's worth...
perl_rm_files t/sa_compile.t || die 'failed to remove sa_compile test'
# The spamc tests (which need the networked spamd daemon) fail for
# irrelevant reasons. It's too hard to disable them (unlike the
# spamd tests themselves -- see src_test), so use a crude
# workaround.
perl_rm_files t/spamc_*.t || die 'failed to remove spamc tests'
}
src_configure() {
# This is how and where the perl-module eclass disables the
# MakeMaker interactive prompt.
export PERL_MM_USE_DEFAULT=1
# Set SYSCONFDIR explicitly so we can't get bitten by bug 48205 again
# (just to be sure, nobody knows how it could happen in the first place).
#
# We also set the path to the perl executable explictly. This will be
# used to create the initial shebang line in the scripts (bug 62276).
perl Makefile.PL \
PREFIX="${EPREFIX}/usr" \
INSTALLDIRS=vendor \
SYSCONFDIR="${EPREFIX}/etc" \
DATADIR="${EPREFIX}/usr/share/spamassassin" \
PERL_BIN="${EPREFIX}/usr/bin/perl" \
ENABLE_SSL="$(usex ssl)" \
DESTDIR="${D}" \
|| die 'failed to create a Makefile using Makefile.PL'
# Now configure spamc.
emake CC="$(tc-getCC)" LDFLAGS="${LDFLAGS}" spamc/Makefile
}
src_compile() {
emake
use qmail && emake spamc/qmail-spamc
}
src_install () {
emake install
einstalldocs
# Create the stub dir used by sa-update and friends
keepdir /var/lib/spamassassin
# Move spamd to sbin where it belongs.
dodir /usr/sbin
mv "${ED}"/usr/bin/spamd "${ED}"/usr/sbin/spamd || die "move spamd failed"
if use qmail; then
dobin spamc/qmail-spamc
fi
dosym mail/spamassassin /etc/spamassassin
# Disable plugin by default
sed -i -e 's/^loadplugin/\#loadplugin/g' \
"${ED}/etc/mail/spamassassin/init.pre" \
|| die "failed to disable plugins by default"
# Add the init and config scripts.
newinitd "${FILESDIR}/3.4.1-spamd.init-r3" spamd
newconfd "${FILESDIR}/3.4.1-spamd.conf-r1" spamd
systemd_newunit "${FILESDIR}/${PN}.service-r4" "${PN}.service"
systemd_install_serviced "${FILESDIR}/${PN}.service.conf-r2" \
"${PN}.service"
use postgres && dodoc sql/*_pg.sql
use mysql && dodoc sql/*_mysql.sql
dodoc NOTICE TRADEMARK CREDITS UPGRADE USAGE sql/README.bayes \
sql/README.awl procmailrc.example sample-nonspam.txt \
sample-spam.txt spamd/PROTOCOL spamd/README.vpopmail \
spamd-apache2/README.apache
# Rename some files so that they don't clash with others.
newdoc spamd/README README.spamd
newdoc sql/README README.sql
newdoc ldap/README README.ldap
if use qmail; then
dodoc spamc/README.qmail
fi
insinto /etc/mail/spamassassin/
insopts -m0400
newins "${FILESDIR}"/secrets.cf secrets.cf.example
# Create the directory where sa-update stores its GPG key (if you
# choose to import one). If this directory does not exist, the
# import will fail. This is bug 396307. We expect that the import
# will be performed as root, and making the directory accessible
# only to root prevents a warning on the command-line.
diropts -m0700
dodir /etc/mail/spamassassin/sa-update-keys
if use cron; then
# Install the cron job if they want it.
exeinto /etc/cron.daily
newexe "${FILESDIR}/update-spamassassin-rules.cron" \
update-spamassassin-rules
fi
# Remove perllocal.pod to avoid file collisions (bug #603338).
perl_delete_localpod || die "failed to remove perllocal.pod"
# The perl-module eclass calls three other functions to clean
# up in src_install. The first fixes references to ${D} in the
# packlist, and is useful to us, too. The other two functions,
# perl_delete_emptybsdir and perl_remove_temppath, don't seem
# to be needed: there are no empty directories, *.bs files, or
# ${D} paths remaining in our installed image.
perl_fix_packlist || die "failed to fix paths in packlist"
}
src_test() {
# Trick the test suite into skipping the spamd tests. Setting
# SPAMD_HOST to a non-localhost value causes SKIP_SPAMD_TESTS to be
# set in SATest.pm.
export SPAMD_HOST=disabled
default
}
pkg_preinst() {
# The spamd daemon runs as this user. Use a real home directory so
# that it can hold SA configuration.
enewuser spamd -1 -1 /home/spamd
}
pkg_postinst() {
elog
elog 'No rules are installed by default. You will need to run sa-update'
elog 'at least once, and most likely configure SpamAssassin before it'
elog 'will work.'
if ! use cron; then
elog
elog 'You should consider a cron job for sa-update. One is provided'
elog 'for daily updates if you enable the "cron" USE flag.'
fi
elog
elog 'Configuration and update help can be found on the wiki:'
elog
elog ' https://wiki.gentoo.org/wiki/SpamAssassin'
elog
ewarn 'If this version of SpamAssassin causes permissions issues'
ewarn 'with your user configurations or bayes databases, then you'
ewarn 'may need to set SPAMD_RUN_AS_ROOT=true in your OpenRC service'
ewarn 'configuration file, or remove the --username and --groupname'
ewarn 'flags from the SPAMD_OPTS variable in your systemd service'
ewarn 'configuration file.'
}

View File

@@ -1,252 +0,0 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit perl-functions systemd toolchain-funcs user
MY_P="Mail-SpamAssassin-${PV//_/-}"
S="${WORKDIR}/${MY_P}"
DESCRIPTION="An extensible mail filter which can identify and tag spam"
HOMEPAGE="https://spamassassin.apache.org/"
SRC_URI="mirror://apache/spamassassin/source/${MY_P}.tar.bz2"
LICENSE="Apache-2.0 GPL-2"
SLOT="0"
KEYWORDS="alpha amd64 arm ~hppa ia64 ppc ppc64 s390 ~sh sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos"
IUSE="berkdb cron ipv6 ldap libressl mysql postgres qmail sqlite ssl test"
# The Makefile.PL script checks for dependencies, but only fails if a
# required (i.e. not optional) dependency is missing. We therefore
# require most of the optional modules only at runtime.
REQDEPEND="dev-lang/perl:=
dev-perl/HTML-Parser
dev-perl/Net-DNS
dev-perl/NetAddr-IP
virtual/perl-Archive-Tar
virtual/perl-Digest-SHA
virtual/perl-IO-Zlib
virtual/perl-Time-HiRes
ssl? (
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl )
)"
# SpamAssassin doesn't use libwww-perl except as a fallback for when
# curl/wget are missing, so we depend on one of those instead. Some
# mirrors use https, so we need those utilities to support SSL.
#
# re2c is needed to compile the rules (sa-compile).
#
# We still need the old Digest-SHA1 because razor2 has not been ported
# to Digest-SHA.
OPTDEPEND="app-crypt/gnupg
dev-perl/Digest-SHA1
dev-perl/Encode-Detect
dev-perl/Geo-IP
dev-perl/HTTP-Date
dev-perl/Mail-DKIM
dev-perl/Mail-SPF
dev-perl/Net-Patricia
dev-perl/Net-CIDR-Lite
dev-util/re2c
|| ( net-misc/wget[ssl] net-misc/curl[ssl] )
virtual/perl-MIME-Base64
virtual/perl-Pod-Parser
berkdb? ( virtual/perl-DB_File )
ipv6? ( dev-perl/IO-Socket-INET6 )
ldap? ( dev-perl/perl-ldap )
mysql? (
dev-perl/DBI
dev-perl/DBD-mysql
)
postgres? (
dev-perl/DBI
dev-perl/DBD-Pg
)
sqlite? (
dev-perl/DBI
dev-perl/DBD-SQLite
)
ssl? ( dev-perl/IO-Socket-SSL )"
DEPEND="${REQDEPEND}
test? (
${OPTDEPEND}
virtual/perl-Test-Harness
)"
RDEPEND="${REQDEPEND} ${OPTDEPEND}"
PATCHES=(
"${FILESDIR}/spamassassin-3.4.1-bug_7199.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7208.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7223.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7231.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7265.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7231-extra.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7404.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7462.patch"
"${FILESDIR}/spamassassin-3.4.1-perl526.patch"
"${FILESDIR}/spamassassin-3.4.1-bug_7361.patch"
)
src_prepare() {
default
# The sa_compile test does some weird stuff like hopping around in
# the directory tree and calling "make" to create a dist tarball
# from ${S}. It fails, and is more trouble than it's worth...
perl_rm_files t/sa_compile.t || die 'failed to remove sa_compile test'
# The spamc tests (which need the networked spamd daemon) fail for
# irrelevant reasons. It's too hard to disable them (unlike the
# spamd tests themselves -- see src_test), so use a crude
# workaround.
perl_rm_files t/spamc_*.t || die 'failed to remove spamc tests'
}
src_configure() {
# This is how and where the perl-module eclass disables the
# MakeMaker interactive prompt.
export PERL_MM_USE_DEFAULT=1
# Set SYSCONFDIR explicitly so we can't get bitten by bug 48205 again
# (just to be sure, nobody knows how it could happen in the first place).
#
# We also set the path to the perl executable explictly. This will be
# used to create the initial shebang line in the scripts (bug 62276).
perl Makefile.PL \
PREFIX="${EPREFIX}/usr" \
INSTALLDIRS=vendor \
SYSCONFDIR="${EPREFIX}/etc" \
DATADIR="${EPREFIX}/usr/share/spamassassin" \
PERL_BIN="${EPREFIX}/usr/bin/perl" \
ENABLE_SSL="$(usex ssl)" \
DESTDIR="${D}" \
|| die 'failed to create a Makefile using Makefile.PL'
# Now configure spamc.
emake CC="$(tc-getCC)" LDFLAGS="${LDFLAGS}" spamc/Makefile
}
src_compile() {
emake
use qmail && emake spamc/qmail-spamc
}
src_install () {
emake install
einstalldocs
# Create the stub dir used by sa-update and friends
keepdir /var/lib/spamassassin
# Move spamd to sbin where it belongs.
dodir /usr/sbin
mv "${ED}"/usr/bin/spamd "${ED}"/usr/sbin/spamd || die "move spamd failed"
if use qmail; then
dobin spamc/qmail-spamc
fi
dosym mail/spamassassin /etc/spamassassin
# Disable plugin by default
sed -i -e 's/^loadplugin/\#loadplugin/g' \
"${ED}/etc/mail/spamassassin/init.pre" \
|| die "failed to disable plugins by default"
# Add the init and config scripts.
newinitd "${FILESDIR}/3.4.1-spamd.init-r3" spamd
newconfd "${FILESDIR}/3.4.1-spamd.conf-r1" spamd
systemd_newunit "${FILESDIR}/${PN}.service-r4" "${PN}.service"
systemd_install_serviced "${FILESDIR}/${PN}.service.conf-r2" \
"${PN}.service"
use postgres && dodoc sql/*_pg.sql
use mysql && dodoc sql/*_mysql.sql
dodoc NOTICE TRADEMARK CREDITS UPGRADE USAGE sql/README.bayes \
sql/README.awl procmailrc.example sample-nonspam.txt \
sample-spam.txt spamd/PROTOCOL spamd/README.vpopmail \
spamd-apache2/README.apache
# Rename some files so that they don't clash with others.
newdoc spamd/README README.spamd
newdoc sql/README README.sql
newdoc ldap/README README.ldap
if use qmail; then
dodoc spamc/README.qmail
fi
insinto /etc/mail/spamassassin/
insopts -m0400
newins "${FILESDIR}"/secrets.cf secrets.cf.example
# Create the directory where sa-update stores its GPG key (if you
# choose to import one). If this directory does not exist, the
# import will fail. This is bug 396307. We expect that the import
# will be performed as root, and making the directory accessible
# only to root prevents a warning on the command-line.
diropts -m0700
dodir /etc/mail/spamassassin/sa-update-keys
if use cron; then
# Install the cron job if they want it.
exeinto /etc/cron.daily
newexe "${FILESDIR}/update-spamassassin-rules.cron" \
update-spamassassin-rules
fi
# Remove perllocal.pod to avoid file collisions (bug #603338).
perl_delete_localpod || die "failed to remove perllocal.pod"
# The perl-module eclass calls three other functions to clean
# up in src_install. The first fixes references to ${D} in the
# packlist, and is useful to us, too. The other two functions,
# perl_delete_emptybsdir and perl_remove_temppath, don't seem
# to be needed: there are no empty directories, *.bs files, or
# ${D} paths remaining in our installed image.
perl_fix_packlist || die "failed to fix paths in packlist"
}
src_test() {
# Trick the test suite into skipping the spamd tests. Setting
# SPAMD_HOST to a non-localhost value causes SKIP_SPAMD_TESTS to be
# set in SATest.pm.
export SPAMD_HOST=disabled
default
}
pkg_preinst() {
# The spamd daemon runs as this user. Use a real home directory so
# that it can hold SA configuration.
enewuser spamd -1 -1 /home/spamd
}
pkg_postinst() {
elog
elog 'No rules are installed by default. You will need to run sa-update'
elog 'at least once, and most likely configure SpamAssassin before it'
elog 'will work.'
if ! use cron; then
elog
elog 'You should consider a cron job for sa-update. One is provided'
elog 'for daily updates if you enable the "cron" USE flag.'
fi
elog
elog 'Configuration and update help can be found on the wiki:'
elog
elog ' https://wiki.gentoo.org/wiki/SpamAssassin'
elog
ewarn 'If this version of SpamAssassin causes permissions issues'
ewarn 'with your user configurations or bayes databases, then you'
ewarn 'may need to set SPAMD_RUN_AS_ROOT=true in your OpenRC service'
ewarn 'configuration file, or remove the --username and --groupname'
ewarn 'flags from the SPAMD_OPTS variable in your systemd service'
ewarn 'configuration file.'
}