diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2016-09-01 18:25:58 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2016-09-01 21:15:47 +0100 |
commit | 45bd315dc080b8f77679ba5ae60e35b0d8c9e97c (patch) | |
tree | cb2c9063a3fd7eb6bd6eebe2971da4878b2846db | |
parent | fbbd45ff5ade30d38ca60ea5aeccc305501c9174 (diff) |
CHUNKING: after rejecting a pipelined SMTP command, flush any followon BDAT data
-rw-r--r-- | src/src/smtp_in.c | 17 | ||||
-rw-r--r-- | test/log/0900 | 1 | ||||
-rw-r--r-- | test/scripts/0000-Basic/0900 | 24 | ||||
-rw-r--r-- | test/stdout/0900 | 37 |
4 files changed, 79 insertions, 0 deletions
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index 09356c231..597b88e38 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -476,6 +476,20 @@ next_cmd: } } +static void +bdat_flush_data(void) +{ +while (chunking_data_left-- > 0) + if (lwr_receive_getc() < 0) + break; + +receive_getc = lwr_receive_getc; +receive_ungetc = lwr_receive_ungetc; + +if (chunking_state != CHUNKING_LAST) + chunking_state = CHUNKING_OFFERED; +} + @@ -4775,6 +4789,9 @@ while (done <= 0) smtp_connection_had[smtp_ch_index-1] == SCH_DATA ? US"valid RCPT command must precede DATA" : US"valid RCPT command must precede BDAT"); + + if (chunking_state > CHUNKING_OFFERED) + bdat_flush_data(); break; } diff --git a/test/log/0900 b/test/log/0900 index 32aeaca60..8ce3bcb0f 100644 --- a/test/log/0900 +++ b/test/log/0900 @@ -8,3 +8,4 @@ 1999-03-02 09:44:33 SMTP connection from (tester) [127.0.0.1] lost while reading message data 1999-03-02 09:44:33 SMTP connection from (tester) [127.0.0.1] lost while reading message data 1999-03-02 09:44:33 10HmbB-0005vi-00 <= someone@some.domain H=(tester) [127.0.0.1] P=esmtp K S=sss for CALLER@test.ex +1999-03-02 09:44:33 H=(tester) [127.0.0.1] F=<someone@some.domain> rejected RCPT <dummy@reject.ex>: relay not permitted diff --git a/test/scripts/0000-Basic/0900 b/test/scripts/0000-Basic/0900 index 9774e5747..9e014c43e 100644 --- a/test/scripts/0000-Basic/0900 +++ b/test/scripts/0000-Basic/0900 @@ -191,5 +191,29 @@ quit ??? 221 **** # +# plain, longer message (xple chunks), RCPT rejected +# pipelined +client 127.0.0.1 PORT_D +??? 220 +EHLO tester +??? 250- +??? 250-SIZE +??? 250-8BITMIME +??? 250-PIPELINING +??? 250-CHUNKING +??? 250 HELP +MAIL FROM:<someone@some.domain>\r\nRCPT TO:<dummy@reject.ex>\r\nBDAT 86\r\nTo: Susan@random.com\r\nFrom: Sal@random.com\r\nSubject: This is a bodyless test message\r\nBDAT 6 LAST\r\nZZ\r\n +??? 250 +??? 550 +??? 503- +??? 503- +??? 503 +??? 503- +??? 503- +??? 503 +quit +??? 221 +**** +# killdaemon no_msglog_check diff --git a/test/stdout/0900 b/test/stdout/0900 index bf6010f82..70c527c17 100644 --- a/test/stdout/0900 +++ b/test/stdout/0900 @@ -259,3 +259,40 @@ Connecting to 127.0.0.1 port 1225 ... connected ??? 221 <<< 221 testhost.test.ex closing connection End of script +Connecting to 127.0.0.1 port 1225 ... connected +??? 220 +<<< 220 testhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000 +>>> EHLO tester +??? 250- +<<< 250-testhost.test.ex Hello tester [127.0.0.1] +??? 250-SIZE +<<< 250-SIZE 52428800 +??? 250-8BITMIME +<<< 250-8BITMIME +??? 250-PIPELINING +<<< 250-PIPELINING +??? 250-CHUNKING +<<< 250-CHUNKING +??? 250 HELP +<<< 250 HELP +>>> MAIL FROM:<someone@some.domain>\r\nRCPT TO:<dummy@reject.ex>\r\nBDAT 86\r\nTo: Susan@random.com\r\nFrom: Sal@random.com\r\nSubject: This is a bodyless test message\r\nBDAT 6 LAST\r\nZZ\r\n +??? 250 +<<< 250 OK +??? 550 +<<< 550 relay not permitted +??? 503- +<<< 503-All RCPT commands were rejected with this error: +??? 503- +<<< 503-relay not permitted +??? 503 +<<< 503 Valid RCPT command must precede BDAT +??? 503- +<<< 503-All RCPT commands were rejected with this error: +??? 503- +<<< 503-relay not permitted +??? 503 +<<< 503 valid RCPT command must precede BDAT +>>> quit +??? 221 +<<< 221 testhost.test.ex closing connection +End of script |