/[smeserver]/rpms/qpsmtpd/sme10/0003-new-plugin-check_bogus_bounce.patch
ViewVC logotype

Annotation of /rpms/qpsmtpd/sme10/0003-new-plugin-check_bogus_bounce.patch

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


Revision 1.1 - (hide annotations) (download)
Sun Feb 7 20:49:53 2016 UTC (8 years, 8 months ago) by stephdl
Branch: MAIN
CVS Tags: qpsmtpd-0_96-19_el7_sme, qpsmtpd-0_96-12_el7_sme, qpsmtpd-0_96-11_el7_sme, qpsmtpd-0_96-16_el7_sme, qpsmtpd-0_96-13_el7_sme, qpsmtpd-0_96-6_el7_sme, qpsmtpd-0_96-18_el7_sme, qpsmtpd-0_96-23_el7_sme, qpsmtpd-0_96-20_el7_sme, qpsmtpd-0_84-20_el7_sme, qpsmtpd-0_96-17_el7_sme, qpsmtpd-0_96-8_el7_sme, qpsmtpd-0_96-5_el7_sme, qpsmtpd-0_96-2_el7_sme, qpsmtpd-0_96-21_el7_sme, qpsmtpd-0_96-22_el7_sme, qpsmtpd-0_96-14_el7_sme, qpsmtpd-0_96-15_el7_sme, qpsmtpd-0_96-9_el7_sme, qpsmtpd-0_96-4_el7_sme, qpsmtpd-0_96-1_el7_sme, qpsmtpd-0_96-3_el7_sme, qpsmtpd-0_84-18_el7_sme, qpsmtpd-0_96-10_el7_sme, qpsmtpd-0_84-19_el7_sme, HEAD
* Sun Feb 7 2016 stephane de labrusse <stephdl@de-labrusse.fr> 0.84-18.sme
- Build new rpm for sme10

1 stephdl 1.1 From 1002d0dd561ad7cd22ecb76f1ecf46487ad83cf7 Mon Sep 17 00:00:00 2001
2     From: Steve Kemp <steve@steve.org.uk>
3     Date: Tue, 4 May 2010 23:37:52 +0100
4     Subject: new plugin - check_bogus_bounce
5    
6     The current status file, in git, has the following entry:
7    
8     -plugin to reject mails from <> if it has multiple recipients.
9    
10     I hereby submit my plugin to handle this case for possible inclusion,
11     under the same terms as the current qpsmtpd release.
12    
13     The plugin is available here:
14    
15     http://www.steve.org.uk/Software/qpsmtpd/check_bogus_bounce/
16    
17     Please find patch against git head below, adding the file and removing
18     the TODO line from the status file.
19    
20     Signed-off-by: Robert <rspier@pobox.com>
21     ---
22     STATUS | 2 -
23     plugins/check_bogus_bounce | 126 ++++++++++++++++++++++++++++++++++++++++++++
24     2 files changed, 126 insertions(+), 2 deletions(-)
25     create mode 100644 plugins/check_bogus_bounce
26    
27     diff --git a/STATUS b/STATUS
28     index 4a00dc6..81cf0df 100644
29     --- a/STATUS
30     +++ b/STATUS
31     @@ -59,8 +59,6 @@ Make a system for configuring the plugins per user/domain/...
32    
33     support databytes per user / domain
34    
35     -plugin to reject mails from <> if it has multiple recipients.
36     -
37     localiphost - support foo@[a.b.c.d] addresses
38    
39     Move dispatch() etc from SMTP.pm to Qpsmtpd.pm to allow other similar
40     diff --git a/plugins/check_bogus_bounce b/plugins/check_bogus_bounce
41     new file mode 100644
42     index 0000000..045889c
43     --- /dev/null
44     +++ b/plugins/check_bogus_bounce
45     @@ -0,0 +1,126 @@
46     +#!/usr/bin/perl -w
47     +
48     +=head1 NAME
49     +
50     +check_bogus_bounce - Check that a bounce message isn't bogus
51     +
52     +=head1 DESCRIPTION
53     +
54     +This plugin is designed to reject bogus bounce messages.
55     +
56     +In our case a bogus bounce message is defined as a bounce message
57     +which has more than a single recipient.
58     +
59     +=head1 CONFIGURATION
60     +
61     +Only a single argument is recognized and is assumed to be the default
62     +action. Valid settings are:
63     +
64     +=over 8
65     +
66     +=item log
67     +
68     +Merely log the receipt of the bogus bounce (the default behaviour).
69     +
70     +=item deny
71     +
72     +Deny with a hard error code.
73     +
74     +=item denysoft
75     +
76     +Deny with a soft error code.
77     +
78     +=back
79     +
80     +=cut
81     +
82     +=head1 AUTHOR
83     +
84     +Steve Kemp
85     +--
86     +http://steve.org.uk/Software/qpsmtpd/
87     +
88     +=cut
89     +
90     +=begin doc
91     +
92     +Look for our single expected argument and configure "action" appropriately.
93     +
94     +=end doc
95     +
96     +=cut
97     +
98     +sub register {
99     + my ($self, $qp, $arg, @nop) = (@_);
100     +
101     + #
102     + # Default behaviour is to merely log.
103     + #
104     + $self->{_action} = "log";
105     +
106     + #
107     + # Unless one was specified
108     + #
109     + if ($arg) {
110     + if ($arg =~ /^(log|deny|denysoft)$/i) {
111     + $self->{_action} = $arg;
112     + }
113     + else {
114     + die "Invalid argument '$arg' - use one of : log, deny, denysoft";
115     + }
116     + }
117     +}
118     +
119     +=begin doc
120     +
121     +Handle the detection of bounces here.
122     +
123     +If we find a match then we'll react with our expected action.
124     +
125     +=end doc
126     +
127     +=cut
128     +
129     +sub hook_data_post {
130     + my ($self, $transaction) = (@_);
131     +
132     + #
133     + # Find the sender, and return unless it wasn't a bounce.
134     + #
135     + my $sender = $transaction->sender->address || undef;
136     + return DECLINED unless ($sender =~ /^<>$/);
137     +
138     + #
139     + # Get the recipients.
140     + #
141     + my @to = $transaction->recipients || ();
142     + return DECLINED unless (scalar @to > 1);
143     +
144     + #
145     + # OK at this point we know:
146     + #
147     + # 1. It is a bounce, via the null-envelope.
148     + # 2. It is a bogus bounce, because there are more than one recipients.
149     + #
150     + if ($self->{_action} =~ /^log$/i) {
151     + $self->log(LOGWARN,
152     + $self->plugin_name() . " bogus bounce for :" . join(",", @to));
153     + }
154     + elsif ($self->{_action} =~ /^deny$/i) {
155     + return (DENY,
156     + $self->plugin_name() . " determined this to be a bogus bounce");
157     + }
158     + elsif ($self->{_action} =~ /^denysoft$/i) {
159     + return (DENYSOFT,
160     + $self->plugin_name() . " determined this to be a bogus bounce");
161     + }
162     + else {
163     + $self->log(LOGWARN,
164     + $self->plugin_name() . " failed to determine action. bug?");
165     + }
166     +
167     + #
168     + # All done; allow this to proceed
169     + #
170     + return DECLINED;
171     +}
172     --
173     1.7.2.2
174    

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