Hiya,

there was a discussion on the main qmail list recently if messages with 
an empty envelope sender may contain more than one recipient. We agreed 
they may not. Charles Cazabon wrote a small patch implementing this
restriction. 
I picked up the idea for qmail-ldap; for us it is much easier to implement as 
we already count recipients for maxrcpt and tarpitting. I don't see any 
reason to accept a bounce message with more than one recipient, so I didn't 
bother with control files, environment variables and so on; so the whole 
patch consists of two added lines:

--- ../qmail-ldap-20011001a-unpatched/qmail-smtpd.c     Mon Dec 10 13:43:31 2001
+++ qmail-smtpd.c       Mon Dec 10 14:11:35 2001
@@ -139,6 +139,7 @@
 void err_rbl(arg) char *arg; { out("553 sorry, your mailserver is listed in "); 
out(arg); out(", mail from your location is not accepted here (#5.7.1)\r\n"); }
 void err_maxrcpt() { out("553 sorry, too many recipients (#5.7.1)\r\n"); }
 void err_nogateway() { out("553 sorry, that domain isn't in my list of allowed 
rcpthosts (#5.7.1)\r\n"); }
+void err_badbounce() { out("553 sorry, I don't accept bounce messages with more than 
+1 recipient. Go read RFC 2821. (#5.7.1)\r\n"); }
 #ifdef TLS
 void err_nogwcert() { out("553 no valid cert for gatewaying (#5.7.1)\r\n"); }
 #endif
@@ -989,6 +990,7 @@
   logline(3,"smtp data");
   if (!seenmail) { err_wantmail(); return; }
   if (!rcptto.len) { err_wantrcpt(); return; }
+  if ( ( mailfrom.len == 1 ) && ( rcptcount > 1 ) ) { err_badbounce(); return; }
   seenmail = 0;
   if (databytes) bytestooverflow = databytes + 1;
   if (qmail_open(&qqt) == -1) { err_qqt(); logline(1,"failed to start qmail-queue"); 
return; }

I'd love to see this included in the next patch.

Greetz

Henning

-- 
* Henning Brauer, [EMAIL PROTECTED], http://www.bsws.de    *
* BS Web Services, Roedingsmarkt 14, 20459 Hamburg, Germany *
Unix is very simple, but it takes a genius to understand the simplicity.
(Dennis Ritchie)

Reply via email to