[exim-cvs] ARC: support $arc_domains also for verify fails

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] ARC: support $arc_domains also for verify fails
Gitweb: https://git.exim.org/exim.git/commitdiff/08bd2689bdeceb41f161a7d54fc1af4abcbbb8c1
Commit:     08bd2689bdeceb41f161a7d54fc1af4abcbbb8c1
Parent:     9cffa4367b034b97a01fb3a0cf8095d8f56fa56a
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Wed Apr 25 21:02:39 2018 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Wed Apr 25 21:02:39 2018 +0100


    ARC: support $arc_domains also for verify fails
---
 doc/doc-txt/experimental-spec.txt |  3 ++-
 src/src/arc.c                     | 22 ++++++++++++++++------
 test/log/4560                     |  8 ++++----
 test/log/4561                     |  2 +-
 4 files changed, 23 insertions(+), 12 deletions(-)


diff --git a/doc/doc-txt/experimental-spec.txt b/doc/doc-txt/experimental-spec.txt
index 8454308..481af1a 100644
--- a/doc/doc-txt/experimental-spec.txt
+++ b/doc/doc-txt/experimental-spec.txt
@@ -797,7 +797,8 @@ There are three new variables: $arc_state, $arc_state_reason, $arc_domains:

   $arc_state        One of pass, fail, none
   $arc_state_reason    (if fail, why)
-  $arc_domains        (if pass) colon-sep list of ARC chain domains
+  $arc_domains        colon-sep list of ARC chain domains, in chain order.
+            problematic elements may have empty list elements


Receive log lines for an ARC pass will be tagged "ARC".

diff --git a/src/src/arc.c b/src/src/arc.c
index 7ad00fc..9d8f7d5 100644
--- a/src/src/arc.c
+++ b/src/src/arc.c
@@ -1780,15 +1780,25 @@ uschar *
fn_arc_domains(void)
{
arc_set * as;
+unsigned inst;
gstring * g = NULL;

-if (!arc_state || Ustrcmp(arc_state, "pass") != 0)
-  return US"";
-
-for(as = arc_verify_ctx.arcset_chain; as; as = as->next)
+for (as = arc_verify_ctx.arcset_chain, inst = 1; as; as = as->next, inst++)
   {
-  blob * d = &as->hdr_as->d;
-  g = string_append_listele_n(g, ':', d->data, d->len);
+  arc_line * hdr_as = as->hdr_as;
+  if (hdr_as)
+    {
+    blob * d = &hdr_as->d;
+
+    for (; inst < as->instance; inst++)
+      g = string_catn(g, ":", 1);
+
+    g = d->data && d->len
+      ? string_append_listele_n(g, ':', d->data, d->len)
+      : string_catn(g, ":", 1);
+    }
+  else
+    g = string_catn(g, ":", 1);
   }
 return g ? g->s : US"";
 }
diff --git a/test/log/4560 b/test/log/4560
index 2e8d6dc..c94ef10 100644
--- a/test/log/4560
+++ b/test/log/4560
@@ -90,7 +90,7 @@
 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 10HmbK-0005vi-00 arc_state: <fail>
-1999-03-02 09:44:33 10HmbK-0005vi-00 domains:   <>
+1999-03-02 09:44:33 10HmbK-0005vi-00 domains:   <test.ex:test.ex>
 1999-03-02 09:44:33 10HmbK-0005vi-00 reason:    <AMS body hash miscompare>
 1999-03-02 09:44:33 10HmbK-0005vi-00 <= CALLER@??? H=localhost (test.ex) [127.0.0.1] P=esmtp S=sss for za@???
 1999-03-02 09:44:33 10HmbJ-0005vi-00 => za@??? <mza@???> R=mlist T=tmlist H=127.0.0.1 [127.0.0.1] C="250 OK id=10HmbK-0005vi-00"
@@ -98,7 +98,7 @@
 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 10HmbL-0005vi-00 arc_state: <fail>
-1999-03-02 09:44:33 10HmbL-0005vi-00 domains:   <>
+1999-03-02 09:44:33 10HmbL-0005vi-00 domains:   <test.ex:test.ex:test.ex>
 1999-03-02 09:44:33 10HmbL-0005vi-00 reason:    <i=3 (cv, sequence or missing header)>
 1999-03-02 09:44:33 10HmbL-0005vi-00 <= CALLER@??? H=localhost (test.ex) [127.0.0.1] P=esmtp S=sss for a@???
 1999-03-02 09:44:33 10HmbK-0005vi-00 => a@??? <za@???> R=fwd T=tsmtp H=127.0.0.1 [127.0.0.1] C="250 OK id=10HmbL-0005vi-00"
@@ -132,14 +132,14 @@
 1999-03-02 09:44:33 10HmbP-0005vi-00 DKIM: d=dmarc.org s=clochette c=simple/simple a=rsa-sha256 b=1024 t=1517535263 [verification succeeded]
 1999-03-02 09:44:33 10HmbP-0005vi-00 DKIM: d=convivian.com s=default c=simple/simple a=rsa-sha256 b=1024 t=1517535248 [verification failed - body hash mismatch (body probably modified in transit)]
 1999-03-02 09:44:33 10HmbP-0005vi-00 arc_state: <fail>
-1999-03-02 09:44:33 10HmbP-0005vi-00 domains:   <>
+1999-03-02 09:44:33 10HmbP-0005vi-00 domains:   <convivian.com>
 1999-03-02 09:44:33 10HmbP-0005vi-00 reason:    <AMS body hash miscompare>
 1999-03-02 09:44:33 10HmbP-0005vi-00 <= CALLER@??? H=(xxx) [127.0.0.1] P=smtp S=sss DKIM=dmarc.org id=1426665656.110316.1517535248039.JavaMail.zimbra@??? for za@???
 1999-03-02 09:44:33 Start queue run: pid=pppp
 1999-03-02 09:44:33 10HmbQ-0005vi-00 DKIM: d=dmarc.org s=clochette c=simple/simple a=rsa-sha256 b=1024 t=1517535263 [verification succeeded]
 1999-03-02 09:44:33 10HmbQ-0005vi-00 DKIM: d=convivian.com s=default c=simple/simple a=rsa-sha256 b=1024 t=1517535248 [verification failed - body hash mismatch (body probably modified in transit)]
 1999-03-02 09:44:33 10HmbQ-0005vi-00 arc_state: <fail>
-1999-03-02 09:44:33 10HmbQ-0005vi-00 domains:   <>
+1999-03-02 09:44:33 10HmbQ-0005vi-00 domains:   <convivian.com:test.ex>
 1999-03-02 09:44:33 10HmbQ-0005vi-00 reason:    <i=2 (cv, sequence or missing header)>
 1999-03-02 09:44:33 10HmbQ-0005vi-00 <= CALLER@??? H=localhost (test.ex) [127.0.0.1] P=esmtp S=sss DKIM=dmarc.org id=1426665656.110316.1517535248039.JavaMail.zimbra@??? for a@???
 1999-03-02 09:44:33 10HmbP-0005vi-00 => a@??? <za@???> R=fwd T=tsmtp H=127.0.0.1 [127.0.0.1] C="250 OK id=10HmbQ-0005vi-00"
diff --git a/test/log/4561 b/test/log/4561
index 07c8ed1..59c644f 100644
--- a/test/log/4561
+++ b/test/log/4561
@@ -2,7 +2,7 @@
 ******** 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 10HmaX-0005vi-00 arc_state: <fail>
-1999-03-02 09:44:33 10HmaX-0005vi-00 domains:   <>
+1999-03-02 09:44:33 10HmaX-0005vi-00 domains:   <::test.ex>
 1999-03-02 09:44:33 10HmaX-0005vi-00 reason:    <i=2 (cv, sequence or missing header)>
 1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@??? H=(xxx) [127.0.0.1] P=smtp S=sss id=3885245d-3bae-66a2-7a1e-0dbceae2fb50@??? for a@???
 1999-03-02 09:44:33 Start queue run: pid=pppp