Michael,

(I already replied offline, but let's keep the list informed)

> After upgrading to 2.4.2, getting backscatter I never got before:
> It looks like amavisd-new is trying to bounce email (spam) back to me
> even though it exceeds dsn cutoff level.

Gary V wrote:
> Looks like a bug.
> No problem when smtp is used, problem when lmtp is used.
...
> This bug is also present in 2.4.1. When using lmtp
> with 2.3.3, it appears there was code to mute the DSN:

Indeed an ugly bug, introduced when true DSN support was added.
I noticed it also during my code review, but I was too far away
from the internet... :)  Thanks for helping!

Luckily most sites feed amavisd through SMTP (instead of LMTP),
so it went by unnoticed for quite a while.

The patch below fixes it.


> My assumptions were that lmtp was lighter, and I think (someone's faq's)
> said to use it.

Old versions of Postfix used session caching only with LMTP,
and SMTP always did a fresh connect for each message.
This is no longer so for quite some time, Postfix SMTP client
service can reuse open sessions, so there is not much difference
between feeding amavisd through SMTP or LMTP, performance-wise.

  Mark


--- amavisd.orig        Tue Jun 27 13:31:56 2006
+++ amavisd     Sun Jul 30 23:41:13 2006
@@ -12050,13 +12050,18 @@
             for my $r (@{$msginfo->per_recip_data}) {
               my($resp) = $r->recip_smtp_response;
-              if ($bounced && $smtp_resp=~/^2/ && $resp!~/^2/) {
-                # as the message was already bounced by us,
-                # MTA must not bounce it again; failure status
-                # needs to be converted into success!
-                $resp = sprintf("250 2.5.0 Ok %s, DSN %s (%s)",
-                        $r->recip_addr, $bounced==1 ? 'sent' : 'muted', $resp);
+              my($recip_quoted) = qquote_rfc2821_local($r->recip_addr);
+              if ($resp=~/^2/) {
+                # success, no need to change status
+              } elsif ($bounced) {
+                # a non-delivery notifications was already sent by us, so
+                # MTA must not bounce it again; turn status into a success
+                $resp = sprintf("250 2.5.0 Ok %s, DSN was sent (%s)",
+                                $recip_quoted, $resp);
+              } elsif ($resp=~/^5/ && $r->recip_destiny != D_REJECT) {
+                $resp = sprintf("250 2.5.0 Ok %s, DSN suppressed (%s)",
+                                $recip_quoted, $resp);
               }
-              do_log(4, 'sending LMTP response for <%s>: "%s"',
-                        $r->recip_addr, $resp);
+              do_log(4, 'sending LMTP response for %s: "%s"',
+                        $recip_quoted, $resp);
               $self->smtp_resp(0, $resp);
             }
-------------------

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to