On Thu, Nov 11, 1999 at 09:54:56PM +0100, Andres Mendez wrote:
> The patch 1.01 doesn't work if you have qmail 1.03.
> 
> Ricardo Cerqueira posted a new one which worked with 1.03, but the file was
> corrupted or truncated.
> 
I've just tried to use that patch (I extracted it from the mail, just to be sure) over 
a clean source and it applied perfectly! Where does it fail you?

------------------
root@avalon (/tmp/tests/qmail-1.03) # patch -p1 < ../qmail-1.03-maxrcpt.patch 
patching file `qmail-smtpd.c'
root@avalon (/tmp/tests/qmail-1.03) #
------------------

Anyway, here it goes again.

                                                Regards;
                                                        Ricardo


-- 
+-------------------
| Ricardo Cerqueira  -  [EMAIL PROTECTED]
| PGP Key fingerprint  -  B7 05 13 CE 48 0A BF 1E  87 21 83 DB 28 DE 03 42 
| FCCN/RCCN  -  Fundacao para a Computacao Cientifica Nacional 
| Av. Brasil, 101 / 1700-066 Lisboa / Portugal *** Tel: (+351) 218440100
diff -u qmail-1.03/qmail-smtpd.c qmail-1.03-maxrcpt/qmail-smtpd.c
--- qmail-1.03/qmail-smtpd.c    Mon Jun 15 11:53:16 1998
+++ qmail-1.03-maxrcpt/qmail-smtpd.c    Fri Nov  5 20:11:54 1999
@@ -27,6 +27,8 @@
 #define MAXHOPS 100
 unsigned int databytes = 0;
 int timeout = 1200;
+int rcptcounter = 0;
+int maxrcpt = -1;
 
 int safewrite(fd,buf,len) int fd; char *buf; int len;
 {
@@ -58,6 +60,7 @@
 void err_noop() { out("250 ok\r\n"); }
 void err_vrfy() { out("252 send some mail, i'll try my best\r\n"); }
 void err_qqt() { out("451 qqt failure (#4.3.0)\r\n"); }
+void err_excessrcpt() { out("666 Too many recipients specified (#5.5.4)\r\n"); }
 
 
 stralloc greeting = {0};
@@ -109,6 +112,7 @@
   if (liphostok == -1) die_control();
   if (control_readint(&timeout,"control/timeoutsmtpd") == -1) die_control();
   if (timeout <= 0) timeout = 1;
+  if (control_readint(&maxrcpt,"control/maxrcpt") == -1) die_control();
 
   if (rcpthosts_init() == -1) die_control();
 
@@ -240,6 +244,7 @@
 void smtp_mail(arg) char *arg;
 {
   if (!addrparse(arg)) { err_syntax(); return; }
+  rcptcounter = 0;
   flagbarf = bmfcheck();
   seenmail = 1;
   if (!stralloc_copys(&rcptto,"")) die_nomem();
@@ -248,7 +253,9 @@
   out("250 ok\r\n");
 }
 void smtp_rcpt(arg) char *arg; {
+  rcptcounter++; 
   if (!seenmail) { err_wantmail(); return; }
+  if (checkrcptcount() == 1) {err_excessrcpt(); }
   if (!addrparse(arg)) { err_syntax(); return; }
   if (flagbarf) { err_bmf(); return; }
   if (relayclient) {
@@ -392,6 +399,12 @@
   if (*qqx == 'D') out("554 "); else out("451 ");
   out(qqx + 1);
   out("\r\n");
+}
+
+int checkrcptcount() {
+  if (maxrcpt == -1) {return 0;}
+  else if (rcptcounter > maxrcpt) {return 1;}
+  else {return 0;}
 }
 
 struct commands smtpcommands[] = {

Reply via email to