# diff -C 4 -c qmail-smtpd.c qmail-smtpd.c.new *** qmail-smtpd.c Thu Nov 2 10:13:38 2000 --- qmail-smtpd.c.new Thu Nov 2 13:15:04 2000 *************** *** 26,33 **** --- 26,35 ---- #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; { int r; *************** *** 108,115 **** --- 110,118 ---- liphostok = control_rldef(&liphost,"control/localiphost",1,(char *) 0); 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(); bmfok = control_readfile(&bmf,"control/badmailfrom",0); *************** *** 238,245 **** --- 241,249 ---- out("250 flushed\r\n"); } void smtp_mail(arg) char *arg; { + rcptcounter = 0 ; if (!addrparse(arg)) { err_syntax(); return; } flagbarf = bmfcheck(); seenmail = 1; if (!stralloc_copys(&rcptto,"")) die_nomem(); *************** *** 247,255 **** --- 251,261 ---- if (!stralloc_0(&mailfrom)) die_nomem(); out("250 ok\r\n"); } void smtp_rcpt(arg) char *arg; { + rcptcounter++; if (!seenmail) { err_wantmail(); return; } + if (checkrcptcount() == 1) { err_syntax(); return; } if (!addrparse(arg)) { err_syntax(); return; } if (flagbarf) { err_bmf(); return; } if (relayclient) { --addr.len; *************** *** 417,421 **** --- 423,433 ---- smtp_greet("220 "); out(" ESMTP\r\n"); if (commands(&ssin,&smtpcommands) == 0) die_read(); die_nomem(); + } + + int checkrcptcount() { + if (maxrcpt == -1) { return 0;} + else if (rcptcounter > maxrcpt ) { return 1;} + return 0; }