/[smeserver]/rpms/qpsmtpd/sme10/qpsmtpd-0.96-bz10290-spamassassin-fetchmail.patch
ViewVC logotype

Contents of /rpms/qpsmtpd/sme10/qpsmtpd-0.96-bz10290-spamassassin-fetchmail.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Tue Nov 16 23:13:14 2021 UTC (2 years, 6 months ago) by jpp
Branch: MAIN
CVS Tags: qpsmtpd-0_96-22_el7_sme, qpsmtpd-0_96-21_el7_sme, HEAD
Changes since 1.1: +1 -1 lines
* Tue Nov 16 2021 Jean-Philippe Pialasse <tests@pialasse.com> 0.96-21.sme
- fix fetchmail patch to check local_ip [SME: 11763]

1 diff -Nur qpsmtpd-0.96.old/plugins/spamassassin qpsmtpd-0.96/plugins/spamassassin
2 --- qpsmtpd-0.96.old/plugins/spamassassin 2018-03-11 00:31:05.427000000 -0500
3 +++ qpsmtpd-0.96/plugins/spamassassin 2018-03-11 00:40:36.117000000 -0500
4 @@ -121,6 +121,11 @@
5 If the X-Spam-User header is present, the LDA should submit the message to
6 spamd for re-processing with the recipients address.
7
8 +=head 1 Force SPAM Check even if is_immune
9 +You can fill a file with a list of exception that will go under SPMA check even
10 +if qpsmtpd flag the connection as immune. The file is forcespamcheck. Enter an ip
11 +per line. As an example if you have fetchmail running on 127.0.0.200, simply add
12 +this ip on a line in forcespamcheck file.
13
14 =head1 CHANGES
15
16 @@ -134,7 +139,10 @@
17 config. Subverting their changes there is unexpected. Making them read
18 code to figure out why is an unnecessary hurdle.
19 * added assemble_message, so we can calc content size which spamd wants
20 -
21 +2018.03.11 - Jean-Philippe Pialasse
22 + * added an exception list forcespamcheck to is_immune. This is useful if you are
23 + running a local deamon such as fetchmail, which connection should still go through
24 + spamassassin testing, even if considered immune because connect as local.
25 =cut
26
27 use strict;
28 @@ -170,7 +178,7 @@
29 sub data_post_handler {
30 my ($self, $transaction) = @_;
31
32 - return DECLINED if $self->is_immune();
33 + return DECLINED if $self->is_immune() and ! $self->is_in_forcespamcheck() ;
34
35 my $limit = $self->{_args}->{size_limit} || 500_000;
36 if ($transaction->data_size > $limit) {
37 @@ -193,6 +201,26 @@
38 return $self->reject($transaction);
39 }
40
41 +sub is_in_forcespamcheck {
42 + my $self = shift;
43 +
44 + my %forcespamcheck = map { $_ => 1 } $self->qp->config('forcespamcheck');
45 +
46 + my $ip = $self->qp->connection->local_ip;
47 +
48 + while ($ip) {
49 + if (exists $forcespamcheck{$ip}) {
50 + $self->log(LOGINFO, "$ip in force spam check");
51 + return 1;
52 + }
53 + $ip =~ s/(\d|\w)+(:|\.)?$// or last; # strip off another octet
54 + }
55 +
56 + $self->log(LOGDEBUG, "no match in forcespamcheck");
57 + return;
58 +}
59 +
60 +
61 sub select_spamd_username {
62 my ($self, $transaction) = @_;
63

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed