[exim-cvs] ARC: fix crash on signing with missing key file

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Exim Git Commits Mailing List
Dátum:  
Címzett: exim-cvs
Tárgy: [exim-cvs] ARC: fix crash on signing with missing key file
Gitweb: https://git.exim.org/exim.git/commitdiff/97e939dfe2ea44a6e243ff6f489790ccd94f39ee
Commit:     97e939dfe2ea44a6e243ff6f489790ccd94f39ee
Parent:     36f7a17f69fe27a4c04a4ff98f80f780007db175
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Fri May 11 16:26:17 2018 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Fri May 11 16:26:17 2018 +0100


    ARC: fix crash on signing with missing key file
---
 src/src/arc.c              |  3 ++-
 test/confs/4560            |  4 ++++
 test/log/4560              | 32 +++++++++++++++++++++++++++++---
 test/mail/4560.a           | 20 ++++++++++++++++++++
 test/scripts/4560-ARC/4560 | 34 ++++++++++++++++++++++++++++++++++
 5 files changed, 89 insertions(+), 4 deletions(-)


diff --git a/src/src/arc.c b/src/src/arc.c
index 787c6e1..5881127 100644
--- a/src/src/arc.c
+++ b/src/src/arc.c
@@ -1696,7 +1696,8 @@ g = arc_sign_append_ams(g, &arc_sign_ctx, instance, identity, selector,
         including self (but with an empty b= in self)
 */


-g = arc_sign_prepend_as(g, &arc_sign_ctx, instance, identity, selector, &ar,
+if (g)
+  g = arc_sign_prepend_as(g, &arc_sign_ctx, instance, identity, selector, &ar,
       privkey, options);


 /* Finally, append the dkim headers and return the lot. */
diff --git a/test/confs/4560 b/test/confs/4560
index e2095af..ad634a4 100644
--- a/test/confs/4560
+++ b/test/confs/4560
@@ -86,8 +86,12 @@ tsmtp:
   port =    PORT_D
   allow_localhost
 .ifndef OPTION
+.ifdef BAD
+  arc_sign =    $primary_hostname : sel : MISSING_KEY
+.else
   arc_sign =    $primary_hostname : sel : DIR/aux-fixed/dkim/dkim.private
 .endif
+.endif


 tmlist:
   driver =    smtp
diff --git a/test/log/4560 b/test/log/4560
index 153c3c7..c072bdd 100644
--- a/test/log/4560
+++ b/test/log/4560
@@ -245,8 +245,6 @@
 1999-03-02 09:44:33 10HmbQ-0005vi-00 => a <a@???> R=d1 T=tfile
 1999-03-02 09:44:33 10HmbQ-0005vi-00 Completed
 1999-03-02 09:44:33 End queue run: pid=pppp
-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 10HmbR-0005vi-00 H=(xxx) [127.0.0.1] Warning: ARC-FAIL
 1999-03-02 09:44:33 10HmbR-0005vi-00 arc_state:      <none>
 1999-03-02 09:44:33 10HmbR-0005vi-00 domains:        <>
 1999-03-02 09:44:33 10HmbR-0005vi-00 arc_oldest_pass <0>
@@ -254,4 +252,32 @@
 1999-03-02 09:44:33 10HmbR-0005vi-00 lh_A-R:         <>
 1999-03-02 09:44:33 10HmbR-0005vi-00 lh-ams:         <>
 1999-03-02 09:44:33 10HmbR-0005vi-00 oldest-p-ams:   <>
-1999-03-02 09:44:33 10HmbR-0005vi-00 <= CALLER@??? H=(xxx) [127.0.0.1] P=smtp S=sss for a@???
+1999-03-02 09:44:33 10HmbR-0005vi-00 <= CALLER@??? H=(xxx) [127.0.0.1] P=smtp S=sss for za@???
+1999-03-02 09:44:33 Start queue run: pid=pppp
+1999-03-02 09:44:33 10HmbR-0005vi-00 ARC: AMS signing: error:0906D06C:PEM routines:PEM_read_bio:no start line
+
+1999-03-02 09:44:33 10HmbS-0005vi-00 arc_state:      <none>
+1999-03-02 09:44:33 10HmbS-0005vi-00 domains:        <>
+1999-03-02 09:44:33 10HmbS-0005vi-00 arc_oldest_pass <0>
+1999-03-02 09:44:33 10HmbS-0005vi-00 reason:         <>
+1999-03-02 09:44:33 10HmbS-0005vi-00 lh_A-R:         < test.ex;\n    arc=none>
+1999-03-02 09:44:33 10HmbS-0005vi-00 lh-ams:         <>
+1999-03-02 09:44:33 10HmbS-0005vi-00 oldest-p-ams:   <>
+1999-03-02 09:44:33 10HmbS-0005vi-00 <= CALLER@??? H=localhost (test.ex) [127.0.0.1] P=esmtp S=sss for a@???
+1999-03-02 09:44:33 10HmbR-0005vi-00 => a@??? <za@???> R=fwd T=tsmtp H=127.0.0.1 [127.0.0.1] C="250 OK id=10HmbS-0005vi-00"
+1999-03-02 09:44:33 10HmbR-0005vi-00 Completed
+1999-03-02 09:44:33 End queue run: pid=pppp
+1999-03-02 09:44:33 Start queue run: pid=pppp
+1999-03-02 09:44:33 10HmbS-0005vi-00 => a <a@???> R=d1 T=tfile
+1999-03-02 09:44:33 10HmbS-0005vi-00 Completed
+1999-03-02 09:44:33 End queue run: pid=pppp
+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 10HmbT-0005vi-00 H=(xxx) [127.0.0.1] Warning: ARC-FAIL
+1999-03-02 09:44:33 10HmbT-0005vi-00 arc_state:      <none>
+1999-03-02 09:44:33 10HmbT-0005vi-00 domains:        <>
+1999-03-02 09:44:33 10HmbT-0005vi-00 arc_oldest_pass <0>
+1999-03-02 09:44:33 10HmbT-0005vi-00 reason:         <>
+1999-03-02 09:44:33 10HmbT-0005vi-00 lh_A-R:         <>
+1999-03-02 09:44:33 10HmbT-0005vi-00 lh-ams:         <>
+1999-03-02 09:44:33 10HmbT-0005vi-00 oldest-p-ams:   <>
+1999-03-02 09:44:33 10HmbT-0005vi-00 <= CALLER@??? H=(xxx) [127.0.0.1] P=smtp S=sss for a@???
diff --git a/test/mail/4560.a b/test/mail/4560.a
index 63b4327..8f9735f 100644
--- a/test/mail/4560.a
+++ b/test/mail/4560.a
@@ -479,3 +479,23 @@ http://lists.dmarc.org/mailman/listinfo/arc-discuss


--===============2728806607597782871==--

+From CALLER@??? Tue Mar 02 09:44:33 1999
+Authentication-Results: test.ex;
+    iprev=pass (localhost) smtp.client-ip=127.0.0.1;
+    arc=none
+Received: from localhost ([127.0.0.1] helo=test.ex)
+    by test.ex with esmtp (Exim x.yz)
+    (envelope-from <CALLER@???>)
+    id 10HmbS-0005vi-00
+    for a@???; Tue, 2 Mar 1999 09:44:33 +0000
+Authentication-Results: test.ex;
+    arc=none
+Received: from [127.0.0.1] (helo=xxx)
+    by test.ex with smtp (Exim x.yz)
+    (envelope-from <CALLER@???>)
+    id 10HmbR-0005vi-00
+    for za@???; Tue, 2 Mar 1999 09:44:33 +0000
+Subject: Test
+
+This is a test body.
+
diff --git a/test/scripts/4560-ARC/4560 b/test/scripts/4560-ARC/4560
index 1a0086f..e6fba71 100644
--- a/test/scripts/4560-ARC/4560
+++ b/test/scripts/4560-ARC/4560
@@ -388,6 +388,40 @@ exim -DSERVER=server -DNOTDAEMON -q
 ****
 #
 #
+# Check attemtping to sign, with a missing keyfile
+# It starts off bare, so the forwarder reception gets an ARC status of "none".
+# The outbound tries to sign it with that.
+#
+client 127.0.0.1 PORT_D
+??? 220
+HELO xxx
+??? 250
+MAIL FROM:<CALLER@???>
+??? 250
+RCPT TO:<za@???>
+??? 250
+DATA
+??? 354
+Subject: Test
+
+This is a test body.
+.
+??? 250
+QUIT
+??? 221
+****
+#
+exim -DSERVER=server -DNOTDAEMON -DBAD -q
+****
+exim -DSERVER=server -DNOTDAEMON -q
+****
+#
+#
+#
+#
+#
+#
+#
 #
 killdaemon
 #