diff options
| -rw-r--r-- | qmail-smtpd.c | 11 |
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; | |||
| 53 | unsigned int greetdelay = 0; | 53 | unsigned int greetdelay = 0; |
| 54 | unsigned int drop_pre_greet = 0; | 54 | unsigned int drop_pre_greet = 0; |
| 55 | int timeout = 1200; | 55 | int timeout = 1200; |
| 56 | int recipcount = 0; | ||
| 57 | unsigned int max_recipcount = 100; | ||
| 56 | 58 | ||
| 57 | const char *protocol = "SMTP"; | 59 | const 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}; | |||
| 539 | stralloc rcptto = {0}; | 544 | stralloc rcptto = {0}; |
| 540 | stralloc fuser = {0}; | 545 | stralloc fuser = {0}; |
| 541 | stralloc mfparms = {0}; | 546 | stralloc mfparms = {0}; |
| 542 | int recipcount; | ||
| 543 | 547 | ||
| 544 | int mailfrom_size(arg) char *arg; | 548 | int 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); |
