Removed
Link Here
|
1 |
--- amavisd.orig 2009-06-25 14:39:01.000000000 +0200 |
2 |
+++ amavisd 2009-08-01 13:51:53.000000000 +0200 |
3 |
@@ -1492,6 +1492,7 @@ |
4 |
CC_BANNED, sub { c('final_banned_destiny') }, |
5 |
CC_SPAM, sub { c('final_spam_destiny') }, |
6 |
CC_BADH, sub { c('final_bad_header_destiny') }, |
7 |
+ CC_MTA.',2', D_REJECT, |
8 |
CC_OVERSIZED, D_BOUNCE, |
9 |
CC_CATCHALL, D_PASS, |
10 |
); |
11 |
@@ -11316,6 +11317,32 @@ |
12 |
$r->blocking_ccat($blocking_ccat) if !defined($r->blocking_ccat); |
13 |
$msginfo->blocking_ccat($blocking_ccat) |
14 |
if !defined($msginfo->blocking_ccat); |
15 |
+ my($final_destiny) = |
16 |
+ $r->setting_by_contents_category(cr('final_destiny_by_ccat')); |
17 |
+ if ($final_destiny == D_PASS) { |
18 |
+ $final_destiny = D_REJECT; # impossible to pass, change to reject |
19 |
+ } |
20 |
+ local($1,$2); |
21 |
+ $r->recip_destiny($final_destiny); |
22 |
+ if ($final_destiny == D_DISCARD && $smtp_resp =~ /^5/) { |
23 |
+ $smtp_resp =~ s{^5(\d\d) 5(\.\d\.\d)}{250 2$2}; # 5xx -> 250 |
24 |
+ } |
25 |
+ my($smtp_reason) = # get the custom smtp response reason text |
26 |
+ $r->setting_by_contents_category(cr('smtp_reason_by_ccat')); |
27 |
+ $smtp_reason = '' if !defined $smtp_reason; |
28 |
+ if ($smtp_reason ne '') { |
29 |
+ my(%mybuiltins) = %builtins; # make a local copy |
30 |
+ $smtp_reason = expand(\$smtp_reason, \%mybuiltins); |
31 |
+ $smtp_reason = !ref($smtp_reason) ? '' : $$smtp_reason; |
32 |
+ chomp($smtp_reason); $smtp_reason = sanitize_str($smtp_reason,1); |
33 |
+ $smtp_reason = substr($smtp_reason,0,100) . "..." |
34 |
+ if length($smtp_reason) > 100+3; |
35 |
+ } |
36 |
+ $smtp_resp =~ /^(\d\d\d(?: \d\.\d\.\d)?)\s*(.*)\z/; |
37 |
+ my($dis) = $final_destiny == D_DISCARD ? ' Discarded' : ''; |
38 |
+ $r->recip_smtp_response("$1$dis $smtp_reason, $2"); |
39 |
+ $r->recip_done(1); # fake a delivery (confirm delivery to a bit bucket) |
40 |
+ # note that 5xx status rejects may later be converted to bounces |
41 |
} |
42 |
$msginfo->header_edits($hdr_edits); # restore original edits just in case |
43 |
$elapsed{'TimeElapsedForwarding'} = Time::HiRes::time - $t0_sect; |
44 |
@@ -17774,23 +17801,21 @@ |
45 |
# |
46 |
sub enhance_smtp_response($$$$$) { |
47 |
my($smtp_resp,$am_id,$mta_id,$dflt_enhcode,$cmd_name) = @_; |
48 |
- local($1,$2,$3); my($resp_shortmsg,$resp_msg); |
49 |
+ local($1,$2,$3); my($resp_msg); |
50 |
my($resp_code,$resp_enhcode) = ('451', '4.5.0'); |
51 |
if (!defined($smtp_resp) || $smtp_resp eq '') { |
52 |
- $resp_shortmsg = 'No resp. to '.$cmd_name; |
53 |
+ $smtp_resp = sprintf('No resp. to %s', $cmd_name); |
54 |
} elsif ($smtp_resp !~ /^[245]\d{2}/) { |
55 |
- $resp_shortmsg = 'Bad resp. to '.$cmd_name; |
56 |
+ $smtp_resp = sprintf('Bad resp. to %s: %s', $cmd_name,$smtp_resp); |
57 |
} elsif ($smtp_resp =~ /^ (\d{3}) [ \t]+ ([245] \. \d{1,3} \. \d{1,3})? |
58 |
\s* (.*) \z/xs) { |
59 |
($resp_code, $resp_enhcode, $resp_msg) = ($1, $2, $3); |
60 |
my($c) = substr($resp_code,0,1); |
61 |
if ($resp_enhcode eq '' && $resp_code =~ /^[245]/) |
62 |
{ $resp_enhcode = $dflt_enhcode; $resp_enhcode =~ s/^\d*/$c/ } |
63 |
- $resp_shortmsg = $c eq '2' ? 'Ok' : $c eq '4' ? 'TempFailed' : 'Failed'; |
64 |
} |
65 |
- sprintf("%s %s %s, id=%s, from MTA(%s): %s", |
66 |
- $resp_code, $resp_enhcode, $resp_shortmsg, |
67 |
- $am_id, $mta_id, $smtp_resp); |
68 |
+ sprintf("%s %s from MTA(%s): %s", |
69 |
+ $resp_code, $resp_enhcode, $mta_id, $smtp_resp); |
70 |
} |
71 |
|
72 |
# Send mail using SMTP - single transaction |