summaryrefslogtreecommitdiffstats
path: root/qmail-smtpd.c
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2013-02-05 18:20:18 +0100
committermanuel <manuel@mausz.at>2013-02-05 18:20:18 +0100
commitb4d6d654e95c9ad5a019a58e69679e8dd3201dc4 (patch)
treed038a8b330e860c3a2c095a9c14ceb18e21e2b70 /qmail-smtpd.c
parent257d264568df9e2acab0cec0c89cecbc52435d65 (diff)
downloadqmail-b4d6d654e95c9ad5a019a58e69679e8dd3201dc4.tar.gz
qmail-b4d6d654e95c9ad5a019a58e69679e8dd3201dc4.tar.bz2
qmail-b4d6d654e95c9ad5a019a58e69679e8dd3201dc4.zip
[PATCH] Only allow one envelope recipient for bounces
Refuse messages from the null envelope sender if they have more than one envelope recipient nullenvsender-recipcount
Diffstat (limited to 'qmail-smtpd.c')
-rw-r--r--qmail-smtpd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/qmail-smtpd.c b/qmail-smtpd.c
index c8ee61b..25f821c 100644
--- a/qmail-smtpd.c
+++ b/qmail-smtpd.c
@@ -133,6 +133,7 @@ void err_nogateway()
133 out(" (#5.7.1)\r\n"); 133 out(" (#5.7.1)\r\n");
134} 134}
135#endif 135#endif
136void err_badbounce() { out("550 sorry, bounce messages should have a single envelope recipient (#5.7.1)\r\n"); }
136void err_unimpl() { out("502 unimplemented (#5.5.1)\r\n"); } 137void err_unimpl() { out("502 unimplemented (#5.5.1)\r\n"); }
137void err_syntax() { out("555 syntax error (#5.5.4)\r\n"); } 138void err_syntax() { out("555 syntax error (#5.5.4)\r\n"); }
138void err_relay() { out("553 we don't relay (#5.7.1)\r\n"); } 139void err_relay() { out("553 we don't relay (#5.7.1)\r\n"); }
@@ -443,6 +444,7 @@ stralloc mailfrom = {0};
443stralloc rcptto = {0}; 444stralloc rcptto = {0};
444stralloc fuser = {0}; 445stralloc fuser = {0};
445stralloc mfparms = {0}; 446stralloc mfparms = {0};
447int recipcount;
446 448
447int mailfrom_size(arg) char *arg; 449int mailfrom_size(arg) char *arg;
448{ 450{
@@ -559,6 +561,7 @@ void smtp_mail(arg) char *arg;
559 if (!stralloc_copys(&rcptto,"")) die_nomem(); 561 if (!stralloc_copys(&rcptto,"")) die_nomem();
560 if (!stralloc_copys(&mailfrom,addr.s)) die_nomem(); 562 if (!stralloc_copys(&mailfrom,addr.s)) die_nomem();
561 if (!stralloc_0(&mailfrom)) die_nomem(); 563 if (!stralloc_0(&mailfrom)) die_nomem();
564 recipcount = 0;
562 out("250 ok\r\n"); 565 out("250 ok\r\n");
563} 566}
564void smtp_rcpt(arg) char *arg; { 567void smtp_rcpt(arg) char *arg; {
@@ -610,6 +613,7 @@ void smtp_rcpt(arg) char *arg; {
610 if (!stralloc_cats(&rcptto,"T")) die_nomem(); 613 if (!stralloc_cats(&rcptto,"T")) die_nomem();
611 if (!stralloc_cats(&rcptto,addr.s)) die_nomem(); 614 if (!stralloc_cats(&rcptto,addr.s)) die_nomem();
612 if (!stralloc_0(&rcptto)) die_nomem(); 615 if (!stralloc_0(&rcptto)) die_nomem();
616 recipcount++;
613 out("250 ok\r\n"); 617 out("250 ok\r\n");
614} 618}
615 619
@@ -726,6 +730,7 @@ void smtp_data() {
726 730
727 if (!seenmail) { err_wantmail(); return; } 731 if (!seenmail) { err_wantmail(); return; }
728 if (!rcptto.len) { err_wantrcpt(); return; } 732 if (!rcptto.len) { err_wantrcpt(); return; }
733 if (mailfrom.len == 1 && recipcount > 1) { err_badbounce(); return; }
729 if (flagbrt) { err_brt(); return; } 734 if (flagbrt) { err_brt(); return; }
730 seenmail = 0; 735 seenmail = 0;
731 if (databytes) bytestooverflow = databytes + 1; 736 if (databytes) bytestooverflow = databytes + 1;