Fix DSN Final-Recipient: field
authorJeremy Harris <jgh146exb@wizmail.org>
Wed, 26 Jun 2019 10:17:52 +0000 (11:17 +0100)
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Mon, 2 Sep 2019 22:17:58 +0000 (00:17 +0200)
(cherry picked from commits 436bda2ac0c4 and 98d4eb7a84)

(cherry picked from commit 6b88f51ac13b4fa834796ce12d12c55c95eacc4a)
(cherry picked from commit ce4d8eca9d3940bb439cdb74a250090fee5538d4)

16 files changed:
doc/doc-txt/ChangeLog
src/src/deliver.c
test/mail/0015.CALLER
test/mail/0037.CALLER
test/mail/0048.CALLER
test/mail/0098.CALLER
test/mail/0103.CALLER
test/mail/0136.forwarder
test/mail/0164.CALLER
test/mail/0165.CALLER
test/mail/0224.CALLER
test/mail/0226.CALLER
test/mail/0237.CALLER
test/mail/0383.CALLER
test/mail/0428.CALLER
test/mail/0508.postmaster

index 67dfafa7a10379570aa84ac08d62b5cae04f43ed..3b36c87b9e5f3c8cde789fbd48b77cafe005f7a6 100644 (file)
@@ -82,6 +82,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
 -----------------
index 4720f596a91eddbcd75ebd42a4edb53ffbe714ed..53562dd5c6e24f93226e7872b442c91fcd37b61e 100644 (file)
@@ -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",
index 01ec9771302f926fd66882a014f7bcd6902b213c..f251d97114b8f32e245b1808eb8bf118121d9eca 100644 (file)
@@ -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
index 4ba7eef27de70b6d696fed31904faaf2b7a58997..1985986ea8e46040b6ae7d1a492b1f8feb3347f7 100644 (file)
@@ -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
index 5df13656bab8d8942b84d0c8120bf77334250b2a..fc1201e1079e8f960f2820326a56081b8b40dfff 100644 (file)
@@ -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
index 722955ecffb210c5838cc9c132903b88c5605ddb..2f83f91163f167289e98d5dcc6e9e86a6d1ba27a 100644 (file)
@@ -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
index 64ca04d479dffe3a2757d8fac4eaef7e065fedd4..5461909ffe011a27927d17c70d0acb351a87225f 100644 (file)
@@ -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
index 1aa46d600d18d40c06f124daa8009c5d46ce867c..511ecab32fc3da36287dc6cbd1057868e6ce40e1 100644 (file)
@@ -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
index 3a1b3d13e8910ca327f1765c0d021bea34ebd38c..dbc44d5106a4d3389329d594cee126f5e794c07e 100644 (file)
@@ -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
index 0c1cd6817230aae56e7f1c0b963e6170e543a6aa..30f63c990ab0d50b6afa3415a033a2cbcb2538ca 100644 (file)
@@ -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
index b050907324e5c21e3af4ca2b5eaa05e0f6dd2550..090003e8e8f1e0aa7a1f8852f2ae530f8b0375a3 100644 (file)
@@ -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
index 6fdc064f2a8048c5007edce252c6855f3a999302..0b5653691eded9c0f6c91f15144da8591f77a272 100644 (file)
@@ -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
index 2fa164320f26a7e1966d8ccbdc199d89db5fff44..9bd9e578cf271c4a882765ef8373b45536bc4f3b 100644 (file)
@@ -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
index d2e55b65778e5d621a5af27bdb2b22526160666d..5fa158a16c29b4bf6afb0366cd35373b0e5174de 100644 (file)
@@ -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
index ff0af0de3d34635df6c5b046992f655e07d84f6b..8feca08bc72e423bbbcd56bbe8194c8ee8ef706e 100644 (file)
@@ -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
index 4ff758a5b48bf8fb9116bbcdee1afd52a6fe7cf2..bd36b3d63a3543ba93c271dca63adb248e9003a7 100644 (file)
@@ -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