/[smeserver]/rpms/qpsmtpd/sme10/qpsmtpd-0.96-karma_strikes.patch
ViewVC logotype

Contents of /rpms/qpsmtpd/sme10/qpsmtpd-0.96-karma_strikes.patch

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


Revision 1.1 - (show annotations) (download)
Thu Apr 21 15:38:19 2016 UTC (8 years, 6 months ago) by vip-ire
Branch: MAIN
CVS Tags: qpsmtpd-0_96-4_el7_sme
* Thu Apr 21 2016 Daniel Berteaud <daniel@firewall-services.com> 0.96-4.sme
- Backport the karma strikes param patch [SME: 9462]

1 diff -Nur -x '*.orig' -x '*.rej' qpsmtpd-0.96/plugins/karma mezzanine_patched_qpsmtpd-0.96/plugins/karma
2 --- qpsmtpd-0.96/plugins/karma 2016-02-16 23:52:02.000000000 +0100
3 +++ mezzanine_patched_qpsmtpd-0.96/plugins/karma 2016-04-20 18:39:43.299979947 +0200
4 @@ -50,6 +50,16 @@
5 penalize a "mostly good" sender. Raising it to 2 reduces that possibility to
6 improbable.
7
8 +=head2 strikes <integer>
9 +
10 +How many strikes is needed to consider the mail nice or naughty.
11 +Various plugins can adjust the karma (see USING KARMA IN OTHER PLUGINS).
12 +For example, with the default value of 3, if the karma of this message is 3
13 +or above, the mail is considered to be a nice one. If it's -3 or less, it's
14 +considered a naughty one. Between -2 and +2 it's neutral
15 +
16 +Default: 3
17 +
18 =head2 penalty_days <days>
19
20 The number of days a naughty sender is refused connections. Use a decimal
21 @@ -238,6 +248,7 @@
22 $self->log(LOGERROR, "Bad arguments") if @_ % 2;
23 $self->{_args} = {@_};
24 $self->{_args}{negative} ||= 1;
25 + $self->{_args}{strikes} ||= 3;
26 $self->{_args}{penalty_days} ||= 1;
27 $self->{_args}{reject_type} ||= 'disconnect';
28
29 @@ -428,7 +439,7 @@
30 my $history = ($nice || 0) - $naughty;
31 my $log_mess = '';
32
33 - if ($karma < -2) { # they achieved at least 2 strikes
34 + if ($karma =< $self->{_args}{strikes}) { # Enough negative strikes ?
35 $history--;
36 my $negative_limit = 0 - $self->{_args}{negative};
37 if ($history <= $negative_limit) {
38 @@ -445,7 +456,7 @@
39 $log_mess = "negative";
40 }
41 }
42 - elsif ($karma > 2) {
43 + elsif ($karma >= $self->{_args}{strikes}) {
44 $nice++;
45 $log_mess = "positive";
46 }

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