summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2019-06-26 11:17:52 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2019-06-26 12:41:59 +0100
commit6b88f51ac13b4fa834796ce12d12c55c95eacc4a (patch)
tree863335502a8f55863e79dd77822cbea07e3fcfdb
parent40fe3ea73eb7524a6143755854633ed8392d39b4 (diff)
downloadexim4-6b88f51ac13b4fa834796ce12d12c55c95eacc4a.tar.gz
Fix DSN Final-Recipient: field
(cherry picked from commits 436bda2ac0c4 and 98d4eb7a84)
-rw-r--r--doc/doc-txt/ChangeLog5
-rw-r--r--src/src/deliver.c39
-rw-r--r--test/mail/0015.CALLER4
-rw-r--r--test/mail/0037.CALLER4
-rw-r--r--test/mail/0048.CALLER10
-rw-r--r--test/mail/0098.CALLER6
-rw-r--r--test/mail/0103.CALLER2
-rw-r--r--test/mail/0136.forwarder4
-rw-r--r--test/mail/0164.CALLER4
-rw-r--r--test/mail/0165.CALLER4
-rw-r--r--test/mail/0224.CALLER10
-rw-r--r--test/mail/0226.CALLER6
-rw-r--r--test/mail/0237.CALLER6
-rw-r--r--test/mail/0383.CALLER6
-rw-r--r--test/mail/0428.CALLER4
-rw-r--r--test/mail/0508.postmaster2
16 files changed, 66 insertions, 50 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 73fefdeb3..d5c1c4f5f 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -71,6 +71,11 @@ JH/27 Bug 2404: Use the main-section configuration option "dsn_from" for
PP/01 Unbreak heimdal_gssapi, broken in 4.92.
+JH/29 Fix DSN Final-Recipient: field. Previously it was the post-routing
+ delivery address, which leaked information of the results of local
+ forwarding. Change to the original envelope recipient address, per
+ standards.
+
Exim version 4.92
-----------------
diff --git a/src/src/deliver.c b/src/src/deliver.c
index 4720f596a..53562dd5c 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -5507,6 +5507,25 @@ while ((addr = *anchor))
+/************************************************/
+
+static void
+print_dsn_addr_action(FILE * f, address_item * addr,
+ uschar * action, uschar * status)
+{
+address_item * pa;
+
+if (addr->dsn_orcpt)
+ fprintf(f,"Original-Recipient: %s\n", addr->dsn_orcpt);
+
+for (pa = addr; pa->parent; ) pa = pa->parent;
+fprintf(f, "Action: %s\n"
+ "Final-Recipient: rfc822;%s\n"
+ "Status: %s\n",
+ action, pa->address, status);
+}
+
+
/*************************************************
* Deliver one message *
*************************************************/
@@ -7410,10 +7429,7 @@ if (addr_senddsn)
if (addr_dsntmp->dsn_orcpt)
fprintf(f,"Original-Recipient: %s\n", addr_dsntmp->dsn_orcpt);
- fprintf(f, "Action: delivered\n"
- "Final-Recipient: rfc822;%s\n"
- "Status: 2.0.0\n",
- addr_dsntmp->address);
+ print_dsn_addr_action(f, addr_dsntmp, US"delivered", US"2.0.0");
if (addr_dsntmp->host_used && addr_dsntmp->host_used->name)
fprintf(f, "Remote-MTA: dns; %s\nDiagnostic-Code: smtp; 250 Ok\n\n",
@@ -7798,10 +7814,9 @@ wording. */
for (addr = handled_addr; addr; addr = addr->next)
{
host_item * hu;
- fprintf(fp, "Action: failed\n"
- "Final-Recipient: rfc822;%s\n"
- "Status: 5.0.0\n",
- addr->address);
+
+ print_dsn_addr_action(fp, addr, US"failed", US"5.0.0");
+
if ((hu = addr->host_used) && hu->name)
{
fprintf(fp, "Remote-MTA: dns; %s\n", hu->name);
@@ -8343,13 +8358,9 @@ else if (addr_defer != (address_item *)(+1))
for ( ; addr_dsndefer; addr_dsndefer = addr_dsndefer->next)
{
- if (addr_dsndefer->dsn_orcpt)
- fprintf(f, "Original-Recipient: %s\n", addr_dsndefer->dsn_orcpt);
- fprintf(f, "Action: delayed\n"
- "Final-Recipient: rfc822;%s\n"
- "Status: 4.0.0\n",
- addr_dsndefer->address);
+ print_dsn_addr_action(f, addr_dsndefer, US"delayed", US"4.0.0");
+
if (addr_dsndefer->host_used && addr_dsndefer->host_used->name)
{
fprintf(f, "Remote-MTA: dns; %s\n",
diff --git a/test/mail/0015.CALLER b/test/mail/0015.CALLER
index 01ec97713..f251d9711 100644
--- a/test/mail/0015.CALLER
+++ b/test/mail/0015.CALLER
@@ -34,7 +34,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;|callpager
+Final-Recipient: rfc822;page+userx@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -90,7 +90,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;|callpager
+Final-Recipient: rfc822;page+ux@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
diff --git a/test/mail/0037.CALLER b/test/mail/0037.CALLER
index 4ba7eef27..1985986ea 100644
--- a/test/mail/0037.CALLER
+++ b/test/mail/0037.CALLER
@@ -118,7 +118,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;|cat
+Final-Recipient: rfc822;filter-pipe@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -172,7 +172,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;/tmp/junk
+Final-Recipient: rfc822;filter-file@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
diff --git a/test/mail/0048.CALLER b/test/mail/0048.CALLER
index 5df13656b..fc1201e10 100644
--- a/test/mail/0048.CALLER
+++ b/test/mail/0048.CALLER
@@ -76,7 +76,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv
+Final-Recipient: rfc822;pipe@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -173,7 +173,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv
+Final-Recipient: rfc822;prefixed+pipe@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -270,7 +270,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv
+Final-Recipient: rfc822;pipe-suffixed@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -367,7 +367,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv
+Final-Recipient: rfc822;prefixed+pipe-suffixed@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -464,7 +464,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv
+Final-Recipient: rfc822;pipe@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
diff --git a/test/mail/0098.CALLER b/test/mail/0098.CALLER
index 722955ecf..2f83f9116 100644
--- a/test/mail/0098.CALLER
+++ b/test/mail/0098.CALLER
@@ -42,7 +42,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: delayed
-Final-Recipient: rfc822;|/non/existing/file
+Final-Recipient: rfc822;userx@test.ex
Status: 4.0.0
Action: delayed
@@ -172,7 +172,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: delayed
-Final-Recipient: rfc822;|/non/existing/file
+Final-Recipient: rfc822;userx@test.ex
Status: 4.0.0
Action: delayed
@@ -232,7 +232,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: delayed
-Final-Recipient: rfc822;|/non/existing/file
+Final-Recipient: rfc822;userx@test.ex
Status: 4.0.0
Action: delayed
diff --git a/test/mail/0103.CALLER b/test/mail/0103.CALLER
index 64ca04d47..5461909ff 100644
--- a/test/mail/0103.CALLER
+++ b/test/mail/0103.CALLER
@@ -30,7 +30,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;WASabc@x.y.zWAS
+Final-Recipient: rfc822;"abc@x.y.z"@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
diff --git a/test/mail/0136.forwarder b/test/mail/0136.forwarder
index 1aa46d600..511ecab32 100644
--- a/test/mail/0136.forwarder
+++ b/test/mail/0136.forwarder
@@ -34,7 +34,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;unknown@test.ex
+Final-Recipient: rfc822;forwarder@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -88,7 +88,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;unknown@test.ex
+Final-Recipient: rfc822;forwarder@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
diff --git a/test/mail/0164.CALLER b/test/mail/0164.CALLER
index 3a1b3d13e..dbc44d510 100644
--- a/test/mail/0164.CALLER
+++ b/test/mail/0164.CALLER
@@ -73,7 +73,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv $recipients
+Final-Recipient: rfc822;system-filter
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -165,7 +165,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv $recipients
+Final-Recipient: rfc822;system-filter
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
diff --git a/test/mail/0165.CALLER b/test/mail/0165.CALLER
index 0c1cd6817..30f63c990 100644
--- a/test/mail/0165.CALLER
+++ b/test/mail/0165.CALLER
@@ -73,7 +73,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv $recipients
+Final-Recipient: rfc822;system-filter
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -167,7 +167,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv $recipients
+Final-Recipient: rfc822;system-filter
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
diff --git a/test/mail/0224.CALLER b/test/mail/0224.CALLER
index b05090732..090003e8e 100644
--- a/test/mail/0224.CALLER
+++ b/test/mail/0224.CALLER
@@ -35,11 +35,11 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;hbounce@test.ex
+Final-Recipient: rfc822;useryx@test.ex
Status: 5.0.0
Action: failed
-Final-Recipient: rfc822;bounce@test.ex
+Final-Recipient: rfc822;userxx@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -105,15 +105,15 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: delayed
-Final-Recipient: rfc822;/no/such/file
+Final-Recipient: rfc822;file@test.ex
Status: 4.0.0
Action: delayed
-Final-Recipient: rfc822;defer@test.ex
+Final-Recipient: rfc822;userxy@test.ex
Status: 4.0.0
Action: delayed
-Final-Recipient: rfc822;hdefer@test.ex
+Final-Recipient: rfc822;useryy@test.ex
Status: 4.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
diff --git a/test/mail/0226.CALLER b/test/mail/0226.CALLER
index 6fdc064f2..0b5653691 100644
--- a/test/mail/0226.CALLER
+++ b/test/mail/0226.CALLER
@@ -32,11 +32,11 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;/a/b/c
+Final-Recipient: rfc822;/a/b/c@no.test.ex
Status: 5.0.0
Action: failed
-Final-Recipient: rfc822;|/p/q/r
+Final-Recipient: rfc822;|/p/q/r@no.test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -128,7 +128,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv
+Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv@yes.test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
diff --git a/test/mail/0237.CALLER b/test/mail/0237.CALLER
index 2fa164320..9bd9e578c 100644
--- a/test/mail/0237.CALLER
+++ b/test/mail/0237.CALLER
@@ -30,11 +30,11 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;/a/b/c
+Final-Recipient: rfc822;/a/b/c@no.test.ex
Status: 5.0.0
Action: failed
-Final-Recipient: rfc822;|/p/q/r
+Final-Recipient: rfc822;|/p/q/r@no.test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -125,7 +125,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; the.local.host.name
Action: failed
-Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv
+Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv@yes.test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
diff --git a/test/mail/0383.CALLER b/test/mail/0383.CALLER
index d2e55b657..5fa158a16 100644
--- a/test/mail/0383.CALLER
+++ b/test/mail/0383.CALLER
@@ -75,7 +75,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; myhost.test.ex
Action: failed
-Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv $thisaddress $1
+Final-Recipient: rfc822;system-filter
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -170,7 +170,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; myhost.test.ex
Action: failed
-Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv $1
+Final-Recipient: rfc822;system-filter
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -266,7 +266,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; myhost.test.ex
Action: failed
-Final-Recipient: rfc822;|TESTSUITE/aux-fixed/showenv $thisaddress $1
+Final-Recipient: rfc822;redking@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
diff --git a/test/mail/0428.CALLER b/test/mail/0428.CALLER
index ff0af0de3..8feca08bc 100644
--- a/test/mail/0428.CALLER
+++ b/test/mail/0428.CALLER
@@ -32,7 +32,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; mail.test.ex
Action: failed
-Final-Recipient: rfc822;userx-extra
+Final-Recipient: rfc822;restrict-userx@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
@@ -86,7 +86,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; mail.test.ex
Action: failed
-Final-Recipient: rfc822;inbox
+Final-Recipient: rfc822;restrict-userx@test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM
diff --git a/test/mail/0508.postmaster b/test/mail/0508.postmaster
index 4ff758a5b..bd36b3d63 100644
--- a/test/mail/0508.postmaster
+++ b/test/mail/0508.postmaster
@@ -40,7 +40,7 @@ Content-type: message/delivery-status
Reporting-MTA: dns; myhost.test.ex
Action: failed
-Final-Recipient: rfc822;|/bin/echo "Some pipe output"
+Final-Recipient: rfc822;userx@myhost.test.ex
Status: 5.0.0
--NNNNNNNNNN-eximdsn-MMMMMMMMMM