On Wednesday 30 August 2006 11:17, Thomas Ogrisegg wrote:
> On Mon, Aug 28, 2006 at 07:02:40PM -0400, Matt Sergeant wrote:
> > On 28-Aug-06, at 6:45 PM, Peter J. Holzer wrote:
> > >Check if the same message has already been received in the last n
> > >hours
> > >(a combination of message-id, sender and recipients should be
> > >sufficient). If it is a duplicate, reject with an appropriate message
> > >("550 You already sent me that message" or something like that).
> >
> > Nice idea (procmail has something that does this) but unfortunately
> > that means the end user gets a 5xx error message.
>
> Then send a 250 but don't queue it.

I've had this in production for a long time.
It's by spamassassin and the AV plugins to "deny" during DATA, as it's mostly 
pointless bouncing viruses and spam.

$ svn diff lib/Qpsmtpd.pm lib/Qpsmtpd/Constants.pm lib/Qpsmtpd/SMTP.pm
Index: lib/Qpsmtpd.pm
===================================================================
--- lib/Qpsmtpd.pm      (revision 658)
+++ lib/Qpsmtpd.pm      (working copy)
@@ -348,7 +348,8 @@

         # should we have a hook for "OK" too?
         if ($r[0] == DENY or $r[0] == DENYSOFT or
-            $r[0] == DENY_DISCONNECT or $r[0] == DENYSOFT_DISCONNECT)
+            $r[0] == DENY_DISCONNECT or $r[0] == DENYSOFT_DISCONNECT or
+            $r[0] == OK_DENY)
         {
           $r[1] = "" if not defined $r[1];
           $self->log(LOGDEBUG, "Plugin ".$code->{name}.
Index: lib/Qpsmtpd/Constants.pm
===================================================================
--- lib/Qpsmtpd/Constants.pm    (revision 658)
+++ lib/Qpsmtpd/Constants.pm    (working copy)
@@ -23,6 +23,7 @@
        DENYHARD => 903,   # 550 + disconnect  (deprecated in 0.29)
        DENY_DISCONNECT     => 903, # 550 + disconnect
        DENYSOFT_DISCONNECT => 904, # 450 + disconnect
+       OK_DENY  => 905, # Lie, say it was queued, without queuing
        DECLINED => 909,
        DONE     => 910,
 );
Index: lib/Qpsmtpd/SMTP.pm
===================================================================
--- lib/Qpsmtpd/SMTP.pm (revision 658)
+++ lib/Qpsmtpd/SMTP.pm (working copy)
@@ -618,7 +618,11 @@
   elsif ($rc == DENYSOFT) {
     $msg[0] ||= "Message denied temporarily";
     $self->respond(452, @msg);
-  }
+  }
+  elsif ($rc == OK_DENY) {
+    $self->log(LOGNOTICE, "Virus ridden email swallowed");
+    $self->respond(250, 'Queued');
+  }
   else {
     $self->queue($self->transaction);
   }

-- 
Mike Williams

Reply via email to