summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qmail-smtpd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/qmail-smtpd.c b/qmail-smtpd.c
index 8c88c4b..23f9c89 100644
--- a/qmail-smtpd.c
+++ b/qmail-smtpd.c
@@ -58,6 +58,7 @@ void die_control() { out("421 unable to read controls (#4.3.0)\r\n"); flush(); _
void die_ipme() { out("421 unable to figure out my IP addresses (#4.3.0)\r\n"); flush(); _exit(1); }
void straynewline() { out("451 See http://pobox.com/~djb/docs/smtplf.html.\r\n"); flush(); _exit(1); }
+void err_badbounce() { out("550 sorry, bounce messages should have a single envelope recipient (#5.7.1)\r\n"); }
void err_bmf() { out("553 sorry, your envelope sender is in my badmailfrom list (#5.7.1)\r\n"); }
void err_nogateway() { out("553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)\r\n"); }
void err_unimpl(arg) char *arg; { out("502 unimplemented (#5.5.1)\r\n"); }
@@ -258,6 +259,7 @@ int seenmail = 0;
int flagbarf; /* defined if seenmail */
stralloc mailfrom = {0};
stralloc rcptto = {0};
+int recipcount;
char *hostname;
char **childargs;
@@ -311,6 +313,7 @@ void smtp_rcpt(arg) char *arg; {
if (!stralloc_cats(&rcptto,"T")) die_nomem();
if (!stralloc_cats(&rcptto,addr.s)) die_nomem();
if (!stralloc_0(&rcptto)) die_nomem();
+ recipcount++;
out("250 ok\r\n");
}
@@ -422,6 +425,7 @@ void smtp_data(arg) char *arg; {
if (!seenmail) { err_wantmail(); return; }
if (!rcptto.len) { err_wantrcpt(); return; }
+ if (mailfrom.len == 1 && recipcount > 1) { err_badbounce(); return; }
seenmail = 0;
if (databytes) bytestooverflow = databytes + 1;
if (qmail_open(&qqt) == -1) { err_qqt(); return; }