diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2016-01-21 15:37:08 +0000 |
---|---|---|
committer | Heiko Schlittermann (HS12-RIPE) <hs@schlittermann.de> | 2016-02-12 16:00:50 +0100 |
commit | 2d51a06458d4fb771dca34966cf2d19c6820ce61 (patch) | |
tree | 621f04d796a25e5283f5f9fcfa368ce53bc123b6 | |
parent | 80c65f170357842ad720aba710f3fe56d58d0680 (diff) | |
download | exim4-2d51a06458d4fb771dca34966cf2d19c6820ce61.tar.gz |
Cutthrough: Fix bug with dot-only line
(cherry picked from commit 1bc460a64a0de0766d21f4f8660c6597bc410cbc)
Conflicts:
doc/doc-txt/ChangeLog
test/log/5400
test/scripts/5400-cutthrough/5400
test/stdout/5400
-rw-r--r-- | doc/doc-txt/ChangeLog | 8 | ||||
-rw-r--r-- | src/src/receive.c | 10 | ||||
-rw-r--r-- | test/log/5400 | 4 | ||||
-rw-r--r-- | test/scripts/5400-cutthrough/5400 | 34 | ||||
-rw-r--r-- | test/stdout/5400 | 291 |
5 files changed, 223 insertions, 124 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 38a5f5a65..86b615eef 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -6,6 +6,14 @@ Exim version 4.84+fixes Cherry-Picked from the master development branch for complaints please contact hs@schlittermann.de ------------------------------------------------- +JH/38 Fix cutthrough bug with body lines having a single dot. The dot was + incorrectly not doubled on cutthrough transmission, hence seen as a + body-termination at the receiving system - resulting in truncated mails. + Commonly the sender saw a TCP-level error, and retransmitted the nessage + via the normal store-and-forward channel. This could result in duplicates + received - but deduplicating mailstores were liable to retain only the + initial truncated version. + JH/05 Fix results-pipe from transport process. Several recipients, combined with certificate use, exposed issues where response data items split diff --git a/src/src/receive.c b/src/src/receive.c index f27dc425e..b6c1d4e41 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -838,7 +838,15 @@ while ((ch = (receive_getc)()) != EOF) ch_state = 4; continue; } - ch_state = 1; /* The dot itself is removed */ + /* The dot was removed at state 3. For a doubled dot, here, reinstate + it to cutthrough. The current ch, dot or not, is passed both to cutthrough + and to file below. */ + if (ch == '.') + { + uschar c= ch; + (void) cutthrough_puts(&c, 1); + } + ch_state = 1; break; case 4: /* After [CR] LF . CR */ diff --git a/test/log/5400 b/test/log/5400 index 6b51348c3..2e05c2547 100644 --- a/test/log/5400 +++ b/test/log/5400 @@ -16,3 +16,7 @@ 1999-03-02 09:44:33 10HmbA-0005vi-00 >> userx@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK" 1999-03-02 09:44:33 10HmbA-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss 1999-03-02 09:44:33 10HmbA-0005vi-00 Completed +1999-03-02 09:44:33 rcpt for userx@domain.com +1999-03-02 09:44:33 10HmbH-0005vi-00 >> userx@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK" +1999-03-02 09:44:33 10HmbH-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss for userx@domain.com +1999-03-02 09:44:33 10HmbH-0005vi-00 Completed diff --git a/test/scripts/5400-cutthrough/5400 b/test/scripts/5400-cutthrough/5400 index 3e56b43b8..501113ca8 100644 --- a/test/scripts/5400-cutthrough/5400 +++ b/test/scripts/5400-cutthrough/5400 @@ -123,3 +123,37 @@ body . QUIT **** +# data having line with (logical, doubled on wire) single dot +server PORT_S +220 ESMTP +EHLO +250 OK +MAIL FROM: +250 Sender OK +RCPT TO: +250 Recipient OK +DATA +354 Send data +. +250 OK +QUIT +250 OK +**** +exim -bs -odf +EHLO myhost.test.ex +MAIL FROM:<CALLER@myhost.test.ex> +RCPT TO:<userx@domain.com> +DATA +Subject: singledot test + +This data has a line with a single dot... next: +.. +and this is the line right after. +Next we have a line with a leading dot: +..test +and this is the next line. + +. +QUIT +**** +# diff --git a/test/stdout/5400 b/test/stdout/5400 index 4895072a3..e0aa25fc1 100644 --- a/test/stdout/5400 +++ b/test/stdout/5400 @@ -43,126 +43,171 @@ 354 Enter message, ending with "." on a line by itself
250 OK id=10HmbA-0005vi-00
221 myhost.test.ex closing connection
- -******** SERVER ******** -Listening on port 1224 ... -Connection request from [ip4.ip4.ip4.ip4] -220 ESMTP -EHLO myhost.test.ex -250 OK -MAIL FROM:<CALLER@myhost.test.ex> -250 Sender OK -RCPT TO:<userx@domain.com> -250 Recipient OK -DATA -354 Send data -Received: from CALLER (helo=myhost.test.ex) - by myhost.test.ex with local-esmtp (Exim x.yz) - (envelope-from <CALLER@myhost.test.ex>) - id 10HmaX-0005vi-00 - for userx@domain.com; Tue, 2 Mar 1999 09:44:33 +0000 -Message-Id: <E10HmaX-0005vi-00@myhost.test.ex> -From: CALLER_NAME <CALLER@myhost.test.ex> -Date: Tue, 2 Mar 1999 09:44:33 +0000 -X-hdr-rtr-new: +++ - -. -250 OK -QUIT -250 OK -End of script -Listening on port 1224 ... -Connection request from [ip4.ip4.ip4.ip4] -220 SMTP only spoken here -EHLO myhost.test.ex -550 Not here, mate -HELO myhost.test.ex -250 OK -MAIL FROM:<CALLER@myhost.test.ex> -250 Sender OK -RCPT TO:<userz@domain.com> -250 Recipient OK -DATA -354 Send data -Received: from CALLER (helo=myhost.test.ex) - by myhost.test.ex with local-esmtp (Exim x.yz) - (envelope-from <CALLER@myhost.test.ex>) - id 10HmaY-0005vi-00 - for userz@domain.com; Tue, 2 Mar 1999 09:44:33 +0000 -Message-Id: <E10HmaY-0005vi-00@myhost.test.ex> -From: CALLER_NAME <CALLER@myhost.test.ex> -Date: Tue, 2 Mar 1999 09:44:33 +0000 -X-hdr-rtr-new: +++ - -. -250 OK -QUIT -250 OK -End of script -Listening on port 1224 ... -Connection request from [ip4.ip4.ip4.ip4] -220 ESMTP -EHLO myhost.test.ex -250 OK -MAIL FROM:<CALLER@myhost.test.ex> -250 Sender OK -RCPT TO:<usery@domain.com> -250 Recipient OK -QUIT -Expected EOF read from client -Listening on port 1224 ... -Connection request from [ip4.ip4.ip4.ip4] -220 ESMTP -EHLO myhost.test.ex -250 OK -MAIL FROM:<CALLER@myhost.test.ex> -250 Sender OK -RCPT TO:<usery@domain.com> -250 Recipient OK -RCPT TO:<userx@domain.com> -250 Recipient OK -DATA -354 Send data -Received: from CALLER (helo=myhost.test.ex) - by myhost.test.ex with local-esmtp (Exim x.yz) - (envelope-from <CALLER@myhost.test.ex>) - id 10HmaZ-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000 -Message-Id: <E10HmaZ-0005vi-00@myhost.test.ex> -From: CALLER_NAME <CALLER@myhost.test.ex> -Date: Tue, 2 Mar 1999 09:44:33 +0000 -X-hdr-rtr-new: +++ - -. -250 OK -QUIT -250 OK -End of script -Listening on port 1224 ... -Connection request from [ip4.ip4.ip4.ip4] -220 ESMTP -EHLO myhost.test.ex -250 OK -MAIL FROM:<CALLER@myhost.test.ex> -250 Sender OK -RCPT TO:<userx@domain.com> -250 Recipient OK -DATA -354 Send data -Received: from CALLER (helo=myhost.test.ex) - by myhost.test.ex with local-esmtp (Exim x.yz) - (envelope-from <CALLER@myhost.test.ex>) - id 10HmbA-0005vi-00 - for userx@domain.com; Tue, 2 Mar 1999 09:44:33 +0000 -X-hdr-tpt: zzz -Message-Id: <E10HmbA-0005vi-00@myhost.test.ex> -From: CALLER_NAME <CALLER@myhost.test.ex> -Date: Tue, 2 Mar 1999 09:44:33 +0000 -X-hdr-rtr-new: +++ - - -body -. -250 OK -QUIT -250 OK -End of script +220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+250-myhost.test.ex Hello CALLER at myhost.test.ex
+250-SIZE 52428800
+250-8BITMIME
+250-PIPELINING
+250 HELP
+250 OK
+250 Accepted
+354 Enter message, ending with "." on a line by itself
+250 OK id=10HmbH-0005vi-00
+221 myhost.test.ex closing connection
+
+******** SERVER ********
+Listening on port 1224 ...
+Connection request from [ip4.ip4.ip4.ip4]
+220 ESMTP
+EHLO myhost.test.ex
+250 OK
+MAIL FROM:<CALLER@myhost.test.ex>
+250 Sender OK
+RCPT TO:<userx@domain.com>
+250 Recipient OK
+DATA
+354 Send data
+Received: from CALLER (helo=myhost.test.ex)
+ by myhost.test.ex with local-esmtp (Exim x.yz)
+ (envelope-from <CALLER@myhost.test.ex>)
+ id 10HmaX-0005vi-00
+ for userx@domain.com; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaX-0005vi-00@myhost.test.ex>
+From: CALLER_NAME <CALLER@myhost.test.ex>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+X-hdr-rtr-new: +++
+
+.
+250 OK
+QUIT
+250 OK
+End of script
+Listening on port 1224 ...
+Connection request from [ip4.ip4.ip4.ip4]
+220 SMTP only spoken here
+EHLO myhost.test.ex
+550 Not here, mate
+HELO myhost.test.ex
+250 OK
+MAIL FROM:<CALLER@myhost.test.ex>
+250 Sender OK
+RCPT TO:<userz@domain.com>
+250 Recipient OK
+DATA
+354 Send data
+Received: from CALLER (helo=myhost.test.ex)
+ by myhost.test.ex with local-esmtp (Exim x.yz)
+ (envelope-from <CALLER@myhost.test.ex>)
+ id 10HmaY-0005vi-00
+ for userz@domain.com; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaY-0005vi-00@myhost.test.ex>
+From: CALLER_NAME <CALLER@myhost.test.ex>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+X-hdr-rtr-new: +++
+
+.
+250 OK
+QUIT
+250 OK
+End of script
+Listening on port 1224 ...
+Connection request from [ip4.ip4.ip4.ip4]
+220 ESMTP
+EHLO myhost.test.ex
+250 OK
+MAIL FROM:<CALLER@myhost.test.ex>
+250 Sender OK
+RCPT TO:<usery@domain.com>
+250 Recipient OK
+QUIT
+Expected EOF read from client
+Listening on port 1224 ...
+Connection request from [ip4.ip4.ip4.ip4]
+220 ESMTP
+EHLO myhost.test.ex
+250 OK
+MAIL FROM:<CALLER@myhost.test.ex>
+250 Sender OK
+RCPT TO:<usery@domain.com>
+250 Recipient OK
+RCPT TO:<userx@domain.com>
+250 Recipient OK
+DATA
+354 Send data
+Received: from CALLER (helo=myhost.test.ex)
+ by myhost.test.ex with local-esmtp (Exim x.yz)
+ (envelope-from <CALLER@myhost.test.ex>)
+ id 10HmaZ-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaZ-0005vi-00@myhost.test.ex>
+From: CALLER_NAME <CALLER@myhost.test.ex>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+X-hdr-rtr-new: +++
+
+.
+250 OK
+QUIT
+250 OK
+End of script
+Listening on port 1224 ...
+Connection request from [ip4.ip4.ip4.ip4]
+220 ESMTP
+EHLO myhost.test.ex
+250 OK
+MAIL FROM:<CALLER@myhost.test.ex>
+250 Sender OK
+RCPT TO:<userx@domain.com>
+250 Recipient OK
+DATA
+354 Send data
+Received: from CALLER (helo=myhost.test.ex)
+ by myhost.test.ex with local-esmtp (Exim x.yz)
+ (envelope-from <CALLER@myhost.test.ex>)
+ id 10HmbA-0005vi-00
+ for userx@domain.com; Tue, 2 Mar 1999 09:44:33 +0000
+X-hdr-tpt: zzz
+Message-Id: <E10HmbA-0005vi-00@myhost.test.ex>
+From: CALLER_NAME <CALLER@myhost.test.ex>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+X-hdr-rtr-new: +++
+
+
+.
+250 OK
+QUIT
+250 OK
+End of script
+Listening on port 1224 ...
+Connection request from [ip4.ip4.ip4.ip4]
+220 ESMTP
+EHLO myhost.test.ex
+250 OK
+MAIL FROM:<CALLER@myhost.test.ex>
+250 Sender OK
+RCPT TO:<userx@domain.com>
+250 Recipient OK
+DATA
+354 Send data
+Received: from CALLER (helo=myhost.test.ex)
+ by myhost.test.ex with local-esmtp (Exim x.yz)
+ (envelope-from <CALLER@myhost.test.ex>)
+ id 10HmbH-0005vi-00
+ for userx@domain.com; Tue, 2 Mar 1999 09:44:33 +0000
+Subject: singledot test
+Message-Id: <E10HmbH-0005vi-00@myhost.test.ex>
+From: CALLER_NAME <CALLER@myhost.test.ex>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+X-hdr-rtr-new: +++
+
+This data has a line with a single dot... next:
+..
+and this is the line right after.
+Next we have a line with a leading dot:
+..test
+and this is the next line.
+
+body
+.
+250 OK
+QUIT
+250 OK
+End of script
|