[exim-cvs] ARC: Reset received ARC instance counter before n…

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Exim Git Commits Mailing List
Datum:  
To: exim-cvs
Betreff: [exim-cvs] ARC: Reset received ARC instance counter before next message on a connection. Bug 2498
Gitweb: https://git.exim.org/exim.git/commitdiff/1415d1a6c91e66922036079b3e3b481e579cdb00
Commit:     1415d1a6c91e66922036079b3e3b481e579cdb00
Parent:     723f7bdb06013d9fabe5197151d25dda38832962
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Tue Dec 17 10:46:21 2019 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Tue Dec 17 10:46:21 2019 +0000


        ARC: Reset received ARC instance counter before next message on a connection.  Bug 2498
---
 doc/doc-txt/ChangeLog      |  5 ++++
 src/src/smtp_in.c          |  1 +
 test/confs/4560            |  1 +
 test/confs/4562            |  1 +
 test/log/4562              | 25 ++++++++++++++++++
 test/mail/4562.a           | 44 +++++++++++++++++++++++++++++++
 test/scripts/4560-ARC/4562 | 65 ++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 142 insertions(+)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index ac4d57a..f496338 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -48,6 +48,11 @@ JH/11 Bug 2494: Unset the default for dmarc_tld_file.  Previously a naiive
 JH/12 Fix an uninitialised flag in early-pipelining.  Previously connections
       could, depending on the platform, hang at the STARTTLS response.


+JH/13 Bug 2498: Reset a counter used for ARC verify before handling another
+      message on a connection.  Previously if one message had ARC headers and
+      the following one did not, a crash could result when adding an
+      Authentication-Results: header.
+


Exim version 4.93
-----------------
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index 9e2b39c..0ae89a4 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -2092,6 +2092,7 @@ dmarc_used_domain = NULL;
#endif
#ifdef EXPERIMENTAL_ARC
arc_state = arc_state_reason = NULL;
+arc_received_instance = 0;
#endif
dsn_ret = 0;
dsn_envid = NULL;
diff --git a/test/confs/4560 b/test/confs/4560
index ad634a4..d945999 100644
--- a/test/confs/4560
+++ b/test/confs/4560
@@ -15,6 +15,7 @@ acl_smtp_data = check_data

log_selector = +received_recipients +dkim_verbose
queue_only
+queue_run_in_order

 # ----- ACL -----
 begin acl
diff --git a/test/confs/4562 b/test/confs/4562
new file mode 120000
index 0000000..359a76c
--- /dev/null
+++ b/test/confs/4562
@@ -0,0 +1 @@
+4560
\ No newline at end of file
diff --git a/test/log/4562 b/test/log/4562
new file mode 100644
index 0000000..b4320bf
--- /dev/null
+++ b/test/log/4562
@@ -0,0 +1,25 @@
+
+******** SERVER ********
+1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D
+1999-03-02 09:44:33 10HmaX-0005vi-00 arc_state:      <pass>
+1999-03-02 09:44:33 10HmaX-0005vi-00 domains:        <test.ex>
+1999-03-02 09:44:33 10HmaX-0005vi-00 arc_oldest_pass <1>
+1999-03-02 09:44:33 10HmaX-0005vi-00 reason:         <>
+1999-03-02 09:44:33 10HmaX-0005vi-00 lh_A-R:         < test.ex; arc=none>
+1999-03-02 09:44:33 10HmaX-0005vi-00 lh-ams:         < i=1; test.ex; arc=none>
+1999-03-02 09:44:33 10HmaX-0005vi-00 oldest-p-ams:   <i=1; test.ex; arc=none>
+1999-03-02 09:44:33 10HmaX-0005vi-00 <= has_arc@??? H=(xxx) [127.0.0.1] P=smtp S=sss ARC id=qwerty1234@??? for a@???
+1999-03-02 09:44:33 10HmaY-0005vi-00 arc_state:      <none>
+1999-03-02 09:44:33 10HmaY-0005vi-00 domains:        <>
+1999-03-02 09:44:33 10HmaY-0005vi-00 arc_oldest_pass <1>
+1999-03-02 09:44:33 10HmaY-0005vi-00 reason:         <>
+1999-03-02 09:44:33 10HmaY-0005vi-00 lh_A-R:         <>
+1999-03-02 09:44:33 10HmaY-0005vi-00 lh-ams:         <>
+1999-03-02 09:44:33 10HmaY-0005vi-00 oldest-p-ams:   <>
+1999-03-02 09:44:33 10HmaY-0005vi-00 <= no_arc@??? H=(xxx) [127.0.0.1] P=smtp S=sss id=qwerty1234@??? for a@???
+1999-03-02 09:44:33 Start queue run: pid=pppp
+1999-03-02 09:44:33 10HmaX-0005vi-00 => a <a@???> R=d1 T=tfile
+1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
+1999-03-02 09:44:33 10HmaY-0005vi-00 => a <a@???> R=d1 T=tfile
+1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
+1999-03-02 09:44:33 End queue run: pid=pppp
diff --git a/test/mail/4562.a b/test/mail/4562.a
new file mode 100644
index 0000000..4a83ce6
--- /dev/null
+++ b/test/mail/4562.a
@@ -0,0 +1,44 @@
+From has_arc@??? Tue Mar 02 09:44:33 1999
+Authentication-Results: test.ex;
+    arc=pass (i=1) header.s=sel arc.oldest-pass=1 smtp.remote-ip=127.0.0.1
+Received: from [127.0.0.1] (helo=xxx)
+    by test.ex with smtp (Exim x.yz)
+    (envelope-from <has_arc@???>)
+    id 10HmaX-0005vi-00
+    for a@???; Tue, 2 Mar 1999 09:44:33 +0000
+ARC-Seal: i=1; a=rsa-sha256; cv=none; d=test.ex; s=sel; t=1521752658; b=
+        xcIN0OEpAc3s8riODm31Q6JgmIECch3iVd1LXWwsypGpCY2UFFuo5HhCEf4a043q
+        YZ+zn/MbFFkvwIqleeQkJ7S5UcvfM8dv/V4YnwAe+JD8r79glh/FRq6uKlc0ixLS
+        CllJMwj98J1P1K9+gwmO5TrD1eTZV68caZj77P+X2kw=
+ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=test.ex;
+         h=from:to:date:message-id:subject; s=sel; bh=3UbbJTudPxmejzh7U1
+        Zg33U3QT+16kfV2eOTvMeiEis=; b=WgE+YWSm48w/P448gPlBBNCKt2SJ4gosPx
+        0JQ98aZJhun2RaVcUO3INc+kZv8YOijofMzFqJxVn1cgMjoU8/QSHIyyt40FzkQB
+        oSGmSrCjtRnzS8pbp491NX3kGuetidaWE5muPSdOystg6mm1rBnl9sqVrwaynCmr
+        fu2jTuUfw=
+ARC-Authentication-Results: i=1; test.ex; arc=none
+Authentication-Results: test.ex; arc=none
+From: mrgus@???
+To: bakawolf@???
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+Message-ID: <qwerty1234@???>
+Subject: simple test
+
+This is a simple test.
+
+From no_arc@??? Tue Mar 02 09:44:33 1999
+Authentication-Results: test.ex;
+    arc=none
+Received: from [127.0.0.1] (helo=xxx)
+    by test.ex with smtp (Exim x.yz)
+    (envelope-from <no_arc@???>)
+    id 10HmaY-0005vi-00
+    for a@???; Tue, 2 Mar 1999 09:44:33 +0000
+From: mrgus@???
+To: bakawolf@???
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+Message-ID: <qwerty1234@???>
+Subject: simple test
+
+This is a simple test.
+
diff --git a/test/scripts/4560-ARC/4562 b/test/scripts/4560-ARC/4562
new file mode 100644
index 0000000..96efd77
--- /dev/null
+++ b/test/scripts/4560-ARC/4562
@@ -0,0 +1,65 @@
+# ARC verify, sequential messages on connection
+#
+exim -DSERVER=server -bd -oX PORT_D
+****
+#
+# A two-message connection. First should pass ARC.
+# Mail original in aux-fixed/4560.msg1.txt
+# Sig generated by: perl aux-fixed/dkim/sign_arc.pl < aux-fixed/4560.msg1.txt
+client 127.0.0.1 PORT_D
+??? 220
+HELO xxx
+??? 250
+MAIL FROM:<has_arc@???>
+??? 250
+RCPT TO:<a@???>
+??? 250
+DATA
+??? 354
+ARC-Seal: i=1; a=rsa-sha256; cv=none; d=test.ex; s=sel; t=1521752658; b=
+        xcIN0OEpAc3s8riODm31Q6JgmIECch3iVd1LXWwsypGpCY2UFFuo5HhCEf4a043q
+        YZ+zn/MbFFkvwIqleeQkJ7S5UcvfM8dv/V4YnwAe+JD8r79glh/FRq6uKlc0ixLS
+        CllJMwj98J1P1K9+gwmO5TrD1eTZV68caZj77P+X2kw=
+ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=test.ex;
+         h=from:to:date:message-id:subject; s=sel; bh=3UbbJTudPxmejzh7U1
+        Zg33U3QT+16kfV2eOTvMeiEis=; b=WgE+YWSm48w/P448gPlBBNCKt2SJ4gosPx
+        0JQ98aZJhun2RaVcUO3INc+kZv8YOijofMzFqJxVn1cgMjoU8/QSHIyyt40FzkQB
+        oSGmSrCjtRnzS8pbp491NX3kGuetidaWE5muPSdOystg6mm1rBnl9sqVrwaynCmr
+        fu2jTuUfw=
+ARC-Authentication-Results: i=1; test.ex; arc=none
+Authentication-Results: test.ex; arc=none
+From: mrgus@???
+To: bakawolf@???
+Date: Thu, 19 Nov 2015 17:00:07 -0700
+Message-ID: <qwerty1234@???>
+Subject: simple test
+
+This is a simple test.
+.
+??? 250
+MAIL FROM:<no_arc@???>
+??? 250
+RCPT TO:<a@???>
+??? 250
+DATA
+??? 354
+From: mrgus@???
+To: bakawolf@???
+Date: Thu, 19 Nov 2015 17:00:07 -0700
+Message-ID: <qwerty1234@???>
+Subject: simple test
+
+This is a simple test.
+.
+??? 250
+QUIT
+??? 221
+****
+exim -DSERVER=server -DNOTDAEMON -q
+****
+#
+#
+#
+killdaemon
+no_stdout_check
+no_msglog_check