DKIM: Fix signing for body lines starting with a pair of dots. Bug 2284
authorJeremy Harris <jgh146exb@wizmail.org>
Thu, 21 Jun 2018 16:03:38 +0000 (17:03 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Thu, 21 Jun 2018 16:38:46 +0000 (17:38 +0100)
Broken-by: 42055a3385
doc/doc-txt/ChangeLog
src/src/dkim_transport.c
test/log/4520
test/mail/4520.a
test/scripts/4500-DKIM/4520

index 63bcf0c20e8b2870b36cb2913bb88905a67c4cd2..da162a04f17ecd55311d46ca2bebdbdfbb4c9dec 100644 (file)
@@ -37,6 +37,8 @@ JH/09 Bug 2274: Fix logging of cmdline args when starting in an unlinked cwd.
 JH/10 Fix ARC signing for case when DKIM signing failed.  Previously this would
       segfault.
 
+JH/14 Bug 2284: Fix DKIM signing for body lines starting with a pair of dots.
+
 
 Exim version 4.91
 -----------------
index 11458680348c105af464222fb7f068c763ee5631..13db0f2f82ab9b023172205ea4d667769de15aea 100644 (file)
@@ -155,7 +155,10 @@ if (!rc) return FALSE;
 arc_sign_init();
 #endif
 
-dkim->dot_stuffed = !!(save_options & topt_end_dot);
+/* The dotstuffed status of the datafile depends on whether it was stored
+in wireformat. */
+
+dkim->dot_stuffed = spool_file_wireformat;
 if (!(dkim_signature = dkim_exim_sign(deliver_datafile, SPOOL_DATA_START_OFFSET,
                                    hdrs, dkim, &errstr)))
   if (!(rc = dkt_sign_fail(dkim, &errno)))
@@ -271,7 +274,9 @@ if (!rc)
 arc_sign_init();
 #endif
 
-/* Feed the file to the goats^W DKIM lib */
+/* Feed the file to the goats^W DKIM lib.  At this point the dotstuffed
+status of the file depends on the output of transport_write_message() just
+above, which should be the result of the end_dot flag in tctx->options. */
 
 dkim->dot_stuffed = !!(options & topt_end_dot);
 if (!(dkim_signature = dkim_exim_sign(dkim_fd, 0, NULL, dkim, &errstr)))
index 2208b4f7290e8c13c5caeee29b7b375b4c2c8feb..1bba9453048dd7d3a9df2ba5c91cf1df25b67e61 100644 (file)
 1999-03-02 09:44:33 10HmbJ-0005vi-00 => d@test.ex R=client T=send_to_server H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4] C="250 OK id=10HmbK-0005vi-00"
 1999-03-02 09:44:33 10HmbJ-0005vi-00 Completed
 1999-03-02 09:44:33 10HmbL-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
-1999-03-02 09:44:33 10HmbL-0005vi-00 => a@test.ex R=client T=send_to_server H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4] C="250 OK id=10HmbM-0005vi-00"
+1999-03-02 09:44:33 10HmbL-0005vi-00 => e@test.ex R=client T=send_to_server H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4] C="250 OK id=10HmbM-0005vi-00"
 1999-03-02 09:44:33 10HmbL-0005vi-00 Completed
+1999-03-02 09:44:33 10HmbN-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 10HmbN-0005vi-00 => f@test.ex R=client T=send_to_server H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4] C="250 OK id=10HmbO-0005vi-00"
+1999-03-02 09:44:33 10HmbN-0005vi-00 Completed
 
 ******** SERVER ********
 1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
 1999-03-02 09:44:33 rcpt acl: macro: From:Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive
 1999-03-02 09:44:33 10HmbM-0005vi-00 data acl: dkim status 
 1999-03-02 09:44:33 10HmbM-0005vi-00 <= CALLER@myhost.test.ex H=the.local.host.name (myhost.test.ex) [ip4.ip4.ip4.ip4] P=esmtp S=sss id=E10HmbL-0005vi-00@myhost.test.ex
-1999-03-02 09:44:33 10HmbM-0005vi-00 => a <a@test.ex> R=server_store T=file
+1999-03-02 09:44:33 10HmbM-0005vi-00 => e <e@test.ex> R=server_store T=file
 1999-03-02 09:44:33 10HmbM-0005vi-00 Completed
+1999-03-02 09:44:33 rcpt acl: macro: From:Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive
+1999-03-02 09:44:33 10HmbO-0005vi-00 dkim_acl: signer: test.ex bits: 1024 h=From
+1999-03-02 09:44:33 10HmbO-0005vi-00 DKIM: d=test.ex s=sel c=relaxed/relaxed a=rsa-sha256 b=1024 [verification succeeded]
+1999-03-02 09:44:33 10HmbO-0005vi-00 data acl: dkim status pass
+1999-03-02 09:44:33 10HmbO-0005vi-00 <= CALLER@myhost.test.ex H=the.local.host.name (myhost.test.ex) [ip4.ip4.ip4.ip4] P=esmtp S=sss id=E10HmbN-0005vi-00@myhost.test.ex
+1999-03-02 09:44:33 10HmbO-0005vi-00 => f <f@test.ex> R=server_store T=file
+1999-03-02 09:44:33 10HmbO-0005vi-00 Completed
index f33057d4db3c79207973ff20763c68428104a267..430033f9cd01673adc9382468aafb2a760a52911 100644 (file)
@@ -21,20 +21,3 @@ Date: Tue, 2 Mar 1999 09:44:33 +0000
 
 content
 
-From CALLER@myhost.test.ex Tue Mar 02 09:44:33 1999
-Received: from the.local.host.name ([ip4.ip4.ip4.ip4] helo=myhost.test.ex)
-       by myhost.test.ex with esmtp (Exim x.yz)
-       (envelope-from <CALLER@myhost.test.ex>)
-       id 10HmbM-0005vi-00
-       for a@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
-Received: from CALLER by myhost.test.ex with local (Exim x.yz)
-       (envelope-from <CALLER@myhost.test.ex>)
-       id 10HmbL-0005vi-00
-       for a@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
-From: nobody@example.com
-Message-Id: <E10HmbL-0005vi-00@myhost.test.ex>
-Sender: CALLER_NAME <CALLER@myhost.test.ex>
-Date: Tue, 2 Mar 1999 09:44:33 +0000
-
-content
-
index f7fafb3e4bc03a8f28e7d4f5ae849d725fe613cf..7c4831029f85cc160737221de57df401e11f1809 100644 (file)
@@ -67,12 +67,19 @@ content
 ****
 #
 # check that an empty dkim_privatekey overrides dkim_strict
-exim -DOPT=From -DSTRICT=true -DSELECTOR=none -odf a@test.ex
+exim -DOPT=From -DSTRICT=true -DSELECTOR=none -odf e@test.ex
 From: nobody@example.com
 
 content
 ****
 #
+# single header signed, body line starting with dot
+exim -DOPT=From -odf f@test.ex
+From: nobody@example.com
+
+..content
+****
+#
 millisleep 500
 killdaemon
 no_msglog_check