summaryrefslogtreecommitdiffstats
path: root/qmail-smtpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'qmail-smtpd.c')
-rw-r--r--qmail-smtpd.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/qmail-smtpd.c b/qmail-smtpd.c
index 38c5929..839f2d3 100644
--- a/qmail-smtpd.c
+++ b/qmail-smtpd.c
@@ -53,6 +53,8 @@ unsigned int mfchk = 0;
53unsigned int greetdelay = 0; 53unsigned int greetdelay = 0;
54unsigned int drop_pre_greet = 0; 54unsigned int drop_pre_greet = 0;
55int timeout = 1200; 55int timeout = 1200;
56int recipcount = 0;
57unsigned int max_recipcount = 100;
56 58
57const char *protocol = "SMTP"; 59const char *protocol = "SMTP";
58 60
@@ -312,6 +314,9 @@ void setup()
312 x = env_get("DROP_PRE_GREET"); 314 x = env_get("DROP_PRE_GREET");
313 if (x) { scan_ulong(x, &u); drop_pre_greet = u; } 315 if (x) { scan_ulong(x, &u); drop_pre_greet = u; }
314 316
317 x = env_get("MAXRCPT");
318 if (x) { scan_ulong(x,&u); max_recipcount = u; }
319
315 remoteip = env_get("TCPREMOTEIP"); 320 remoteip = env_get("TCPREMOTEIP");
316 if (!remoteip) remoteip = "unknown"; 321 if (!remoteip) remoteip = "unknown";
317 local = env_get("TCPLOCALHOST"); 322 local = env_get("TCPLOCALHOST");
@@ -539,7 +544,6 @@ stralloc mailfrom = {0};
539stralloc rcptto = {0}; 544stralloc rcptto = {0};
540stralloc fuser = {0}; 545stralloc fuser = {0};
541stralloc mfparms = {0}; 546stralloc mfparms = {0};
542int recipcount;
543 547
544int mailfrom_size(arg) char *arg; 548int mailfrom_size(arg) char *arg;
545{ 549{
@@ -731,6 +735,11 @@ void smtp_rcpt(arg) char *arg; {
731 if (!seenmail) { err_wantmail(); return; } 735 if (!seenmail) { err_wantmail(); return; }
732 if (!addrparse(arg)) { err_syntax(); return; } 736 if (!addrparse(arg)) { err_syntax(); return; }
733 if (!relayclient && addrrelay()) { err_relay(); return; } 737 if (!relayclient && addrrelay()) { err_relay(); return; }
738 if (recipcount >= max_recipcount) {
739 out("450 4.7.1 Error: too many recipients\r\n");
740 strerr_warn2("qmail-smtpd: too many recipients at ",remoteip,0);
741 return;
742 }
734 if (flagbarfbhelo) { 743 if (flagbarfbhelo) {
735 if (logregex) { 744 if (logregex) {
736 strerr_warn6("qmail-smtpd: badhelo: <",helohost.s,"> at ",remoteip," matches pattern: ",matchedregex.s,0); 745 strerr_warn6("qmail-smtpd: badhelo: <",helohost.s,"> at ",remoteip," matches pattern: ",matchedregex.s,0);