[exim-dev] [Bug 1444] New: non-SMTP without -oi mangles line…

Top Page
Delete this message
Reply to this message
Author: Wolfgang Breyha
Date:  
To: exim-dev
New-Topics: [exim-dev] [Bug 1444] non-SMTP without -oi mangles linefeeds on multiple CRLF, [exim-dev] [Bug 1444] non-SMTP without -oi mangles linefeeds on multiple CRLF, [exim-dev] [Bug 1444] non-SMTP without -oi mangles linefeeds on multiple CRLF
Subject: [exim-dev] [Bug 1444] New: non-SMTP without -oi mangles linefeeds on multiple CRLF
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1444
           Summary: non-SMTP without -oi mangles linefeeds on multiple CRLF
           Product: Exim
           Version: N/A
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Delivery in general
        AssignedTo: nigel@???
        ReportedBy: wbreyha@???
                CC: exim-dev@???



As reported on exim-users in
Message-ID:
<CAPg4iBC_Am90dCukJkcqwREdime2NjQJtxpcWK-55NZ68bMJnw@???>

Sending a mailbody on commandline with eg:
echo -en "To: testrecipient@???\r\nSubject:
test\r\n\r\ntest\r\n\r\ntest"|exim -d+all -f testsender@???
testrecipient@???
ends up in broken DKIM signatures. This is not caused by the DKIM code itself.
The debug output already shows
"test{CR}{LF}{CR}{CR}{LF}test"
coming through pdkim_feed().

It only happens if -oi is _not_ set and the messagebody ends either with a "."
or EOF.

The doubled {CR} is introduced by the code in
received.c:609ff:read_message_data()

The code for "dot_ends==true" in lines 661ff doesn't handle the "\r\n\r\n" case
correctly IMO.

strace shows that it already ends up in the spool file as
21449 write(3, "1WFQ3f-0005Zx-07-D\ntest\n\r\n\r\ntest\n", 33) = 33

The "\r" right after "\n" is written instead of silently removed.

I think
--------
--- receive.c.orig      2013-10-25 02:46:27.000000000 +0200
+++ receive.c   2014-02-17 16:56:37.000000000 +0100
@@ -680,6 +680,7 @@


     case 1:                         /* After written "\n" */
     if (ch == '.') { ch_state = 3; continue; }
+    if (ch == '\r') { ch_state = 2; continue; }
     if (ch != '\n') ch_state = 0; else linelength = -1;
     break;


--------
should fix it.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email