From 9e0ed81fc2a821e60dd3235c4e5598ab45cfcc1e Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sun, 8 Oct 2017 18:56:13 +0100 Subject: [PATCH] Logging: show when input from truncated for logging "next input sent too soon" --- doc/doc-txt/ChangeLog | 3 +++ src/src/smtp_in.c | 9 +++++---- test/log/0901 | 2 +- test/rejectlog/0901 | 2 +- test/scripts/0000-Basic/0901 | 6 +----- test/stdout/0901 | 6 +----- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 8f1b6b7ad..5266cefc4 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -166,6 +166,9 @@ HS/02 Fix Bug 2130: large writes from the transport subprocess where chunked JH/27 Fix SOCKS bug: an unitialized pointer was deref'd by the transport process which could crash as a result. This could lead to undeliverable messages. +JH/28 Logging: "next input sent too soon" now shows where input was truncated + for log purposes. + Exim version 4.89 ----------------- diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index 0f8d5599b..9847c86c7 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -565,11 +565,12 @@ for(;;) incomplete_transaction_log(US"sync failure"); log_write(0, LOG_MAIN|LOG_REJECT, "SMTP protocol synchronization error " "(next input sent too soon: pipelining was not advertised): " - "rejected \"%s\" %s next input=\"%s\"", + "rejected \"%s\" %s next input=\"%s\"%s", smtp_cmd_buffer, host_and_ident(TRUE), - string_printing(string_copyn(smtp_inptr, n))); - (void) synprot_error(L_smtp_protocol_error, 554, NULL, - US"SMTP synchronization error"); + string_printing(string_copyn(smtp_inptr, n)), + smtp_inend - smtp_inptr > n ? "..." : ""); + (void) synprot_error(L_smtp_protocol_error, 554, NULL, + US"SMTP synchronization error"); goto repeat_until_rset; } diff --git a/test/log/0901 b/test/log/0901 index 0297a8915..0f876740f 100644 --- a/test/log/0901 +++ b/test/log/0901 @@ -10,6 +10,6 @@ 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 10HmbD-0005vi-00 <= someone8@some.domain H=(tester) [127.0.0.1] P=esmtp K S=sss for CALLER@test.ex -1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised): rejected "BDAT 1" H=(tester) [127.0.0.1] next input="BDAT 87 last\r\n" +1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised): rejected "BDAT 1" H=(tester) [127.0.0.1] next input="BDAT 87 last\r\no: Susan@random.co"... 1999-03-02 09:44:33 SMTP call from (tester) [127.0.0.1] dropped: too many syntax or protocol errors (last command was "From: Sam@random.com") 1999-03-02 09:44:33 SMTP connection from (tester) [127.0.0.1] lost while reading message data (header) diff --git a/test/rejectlog/0901 b/test/rejectlog/0901 index f75d9d270..a4185a966 100644 --- a/test/rejectlog/0901 +++ b/test/rejectlog/0901 @@ -1,6 +1,6 @@ ******** SERVER ******** -1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised): rejected "BDAT 1" H=(tester) [127.0.0.1] next input="BDAT 87 last\r\n" +1999-03-02 09:44:33 SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised): rejected "BDAT 1" H=(tester) [127.0.0.1] next input="BDAT 87 last\r\no: Susan@random.co"... Envelope-from: Envelope-to: 1999-03-02 09:44:33 SMTP call from (tester) [127.0.0.1] dropped: too many syntax or protocol errors (last command was "From: Sam@random.com") diff --git a/test/scripts/0000-Basic/0901 b/test/scripts/0000-Basic/0901 index 5e88c5ae9..f5a6fff9a 100644 --- a/test/scripts/0000-Basic/0901 +++ b/test/scripts/0000-Basic/0901 @@ -247,11 +247,7 @@ MAIL FROM:someone9@some.domain ??? 250 RCPT TO:CALLER@test.ex ??? 250 -BDAT 1\r\nTBDAT 87 last -o: Susan@random.com -From: Sam@random.com -Subject: This is a bodyless test message - +BDAT 1\r\nTBDAT 87 last\r\no: Susan@random.com\r\nFrom: Sam@random.com\r\nSubject: This is a bodyless test message\r\n\r\n ??? 554 SMTP synchronization error **** # diff --git a/test/stdout/0901 b/test/stdout/0901 index a982ac8b6..c4020ae5f 100644 --- a/test/stdout/0901 +++ b/test/stdout/0901 @@ -330,11 +330,7 @@ Connecting to 127.0.0.1 port 1225 ... connected >>> RCPT TO:CALLER@test.ex ??? 250 <<< 250 Accepted ->>> BDAT 1\r\nTBDAT 87 last ->>> o: Susan@random.com ->>> From: Sam@random.com ->>> Subject: This is a bodyless test message ->>> +>>> BDAT 1\r\nTBDAT 87 last\r\no: Susan@random.com\r\nFrom: Sam@random.com\r\nSubject: This is a bodyless test message\r\n\r\n ??? 554 SMTP synchronization error <<< 554 SMTP synchronization error End of script -- 2.25.1