From: Jeremy Harris Date: Wed, 25 Apr 2018 20:02:39 +0000 (+0100) Subject: ARC: support $arc_domains also for verify fails X-Git-Tag: exim-4.92-RC1~195 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=08bd2689bdeceb41f161a7d54fc1af4abcbbb8c1;p=exim.git ARC: support $arc_domains also for verify fails --- diff --git a/doc/doc-txt/experimental-spec.txt b/doc/doc-txt/experimental-spec.txt index 845430870..481af1a9b 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 7ad00fc9f..9d8f7d5db 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 2e8d6dcc5..c94ef10e7 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: -1999-03-02 09:44:33 10HmbK-0005vi-00 domains: <> +1999-03-02 09:44:33 10HmbK-0005vi-00 domains: 1999-03-02 09:44:33 10HmbK-0005vi-00 reason: 1999-03-02 09:44:33 10HmbK-0005vi-00 <= CALLER@bloggs.com H=localhost (test.ex) [127.0.0.1] P=esmtp S=sss for za@test.ex 1999-03-02 09:44:33 10HmbJ-0005vi-00 => za@test.ex 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: -1999-03-02 09:44:33 10HmbL-0005vi-00 domains: <> +1999-03-02 09:44:33 10HmbL-0005vi-00 domains: 1999-03-02 09:44:33 10HmbL-0005vi-00 reason: 1999-03-02 09:44:33 10HmbL-0005vi-00 <= CALLER@bloggs.com H=localhost (test.ex) [127.0.0.1] P=esmtp S=sss for a@test.ex 1999-03-02 09:44:33 10HmbK-0005vi-00 => a@test.ex 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: -1999-03-02 09:44:33 10HmbP-0005vi-00 domains: <> +1999-03-02 09:44:33 10HmbP-0005vi-00 domains: 1999-03-02 09:44:33 10HmbP-0005vi-00 reason: 1999-03-02 09:44:33 10HmbP-0005vi-00 <= CALLER@bloggs.com H=(xxx) [127.0.0.1] P=smtp S=sss DKIM=dmarc.org id=1426665656.110316.1517535248039.JavaMail.zimbra@convivian.com for za@test.ex 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: -1999-03-02 09:44:33 10HmbQ-0005vi-00 domains: <> +1999-03-02 09:44:33 10HmbQ-0005vi-00 domains: 1999-03-02 09:44:33 10HmbQ-0005vi-00 reason: 1999-03-02 09:44:33 10HmbQ-0005vi-00 <= CALLER@bloggs.com H=localhost (test.ex) [127.0.0.1] P=esmtp S=sss DKIM=dmarc.org id=1426665656.110316.1517535248039.JavaMail.zimbra@convivian.com for a@test.ex 1999-03-02 09:44:33 10HmbP-0005vi-00 => a@test.ex 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 07c8ed110..59c644f30 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: -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: 1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@bloggs.com H=(xxx) [127.0.0.1] P=smtp S=sss id=3885245d-3bae-66a2-7a1e-0dbceae2fb50@test.ex for a@test.ex 1999-03-02 09:44:33 Start queue run: pid=pppp