From: Simon Arlott Date: Sun, 11 Mar 2018 16:25:28 +0000 (+0000) Subject: PRDR: append overall DATA acceptance message to delivery log line "C=" item. Bug... X-Git-Tag: exim-4_91_RC1~16 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/2556b3c619956593f4ac43b30a7b4e15228888d6?ds=sidebyside;hp=8b77d27a46e94c347172941fc7a07b17f1e4da25 PRDR: append overall DATA acceptance message to delivery log line "C=" item. Bug 2253 It can have useful tracking info from the destination, eg. their message Id. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 060a4ffe4..06ed2eeb5 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -130,6 +130,11 @@ JH/24 Bug 2242: Fix exim_dbmbuild to permit directoryless filenames. JH/25 Fix utf8_downconvert propagation through a redirect router. Previously it was not propagated. +JH/26 Bug 2253: For logging delivery lines under PRDR, append the overall + DATA response info to the (existing) per-recipient response info for + the "C=" log element. It can have useful tracking info from the + destination system. Patch from Simon Arlott. + Exim version 4.90 ----------------- diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index add425326..c4a6c0283 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -3224,8 +3224,11 @@ else #ifndef DISABLE_PRDR if (sx.prdr_active) { + const uschar * overall_message; + /* PRDR - get the final, overall response. For any non-success upgrade all the address statuses. */ + sx.ok = smtp_read_response(&sx.inblock, sx.buffer, sizeof(sx.buffer), '2', sx.ob->final_timeout); if (!sx.ok) @@ -3241,7 +3244,14 @@ else goto RESPONSE_FAILED; } - /* Update the journal, or setup retry. */ + /* Append the overall response to the individual PRDR response for logging + and update the journal, or setup retry. */ + + overall_message = string_printing(sx.buffer); + for (addr = addrlist; addr != sx.first_addr; addr = addr->next) + if (addr->transport_return == OK) + addr->message = string_sprintf("%s\\n%s", addr->message, overall_message); + for (addr = addrlist; addr != sx.first_addr; addr = addr->next) if (addr->transport_return == OK) { diff --git a/test/log/4550 b/test/log/4550 index 05d1dea5a..a57779f1f 100644 --- a/test/log/4550 +++ b/test/log/4550 @@ -1,20 +1,20 @@ 1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss 1999-03-02 09:44:33 10HmaX-0005vi-00 ** baduser@test.ex R=client T=send_to_server H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4]: PRDR error after DATA: 550 PRDR R= refusal -1999-03-02 09:44:33 10HmaX-0005vi-00 => okuser@test.ex R=client T=send_to_server H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4] PRDR C="250 PRDR R= acceptance" -1999-03-02 09:44:33 10HmaY-0005vi-00 <= <> R=10HmaX-0005vi-00 U=EXIMUSER P=local S=sss -1999-03-02 09:44:33 10HmaY-0005vi-00 => CALLER@myhost.test.ex R=client T=send_to_server H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4] C="250 OK id=10HmaZ-0005vi-00" -1999-03-02 09:44:33 10HmaY-0005vi-00 Completed +1999-03-02 09:44:33 10HmaX-0005vi-00 => okuser@test.ex R=client T=send_to_server H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4] PRDR C="250 PRDR R= acceptance\\n250 id=10HmaY-0005vi-00 message accepted for some recipients" +1999-03-02 09:44:33 10HmaZ-0005vi-00 <= <> R=10HmaX-0005vi-00 U=EXIMUSER P=local S=sss +1999-03-02 09:44:33 10HmaZ-0005vi-00 => CALLER@myhost.test.ex R=client T=send_to_server H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4] C="250 OK id=10HmbA-0005vi-00" +1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed ******** 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 10HmbA-0005vi-00 signer: test.ex bits: 1024 h=From -1999-03-02 09:44:33 10HmbA-0005vi-00 DKIM: d=test.ex s=sel c=relaxed/relaxed a=rsa-sha256 b=1024 [verification succeeded] -1999-03-02 09:44:33 10HmbA-0005vi-00 PRDR R= refusal -1999-03-02 09:44:33 10HmbA-0005vi-00 PRDR R= acceptance -1999-03-02 09:44:33 10HmbA-0005vi-00 <= CALLER@myhost.test.ex H=the.local.host.name (myhost.test.ex) [ip4.ip4.ip4.ip4] P=esmtp PRDR S=sss DKIM=test.ex id=E10HmaX-0005vi-00@myhost.test.ex -1999-03-02 09:44:33 10HmbA-0005vi-00 => :blackhole: R=server_dump +1999-03-02 09:44:33 10HmaY-0005vi-00 signer: test.ex bits: 1024 h=From +1999-03-02 09:44:33 10HmaY-0005vi-00 DKIM: d=test.ex s=sel c=relaxed/relaxed a=rsa-sha256 b=1024 [verification succeeded] +1999-03-02 09:44:33 10HmaY-0005vi-00 PRDR R= refusal +1999-03-02 09:44:33 10HmaY-0005vi-00 PRDR R= acceptance +1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@myhost.test.ex H=the.local.host.name (myhost.test.ex) [ip4.ip4.ip4.ip4] P=esmtp PRDR S=sss DKIM=test.ex id=E10HmaX-0005vi-00@myhost.test.ex +1999-03-02 09:44:33 10HmaY-0005vi-00 => :blackhole: R=server_dump +1999-03-02 09:44:33 10HmaY-0005vi-00 Completed +1999-03-02 09:44:33 10HmbA-0005vi-00 <= <> H=the.local.host.name (myhost.test.ex) [ip4.ip4.ip4.ip4] P=esmtp S=sss id=E10HmaZ-0005vi-00@myhost.test.ex +1999-03-02 09:44:33 10HmbA-0005vi-00 => CALLER R=server_store T=store 1999-03-02 09:44:33 10HmbA-0005vi-00 Completed -1999-03-02 09:44:33 10HmaZ-0005vi-00 <= <> H=the.local.host.name (myhost.test.ex) [ip4.ip4.ip4.ip4] P=esmtp S=sss id=E10HmaY-0005vi-00@myhost.test.ex -1999-03-02 09:44:33 10HmaZ-0005vi-00 => CALLER R=server_store T=store -1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed diff --git a/test/log/5510 b/test/log/5510 index 84065d076..fa2e79d19 100644 --- a/test/log/5510 +++ b/test/log/5510 @@ -1,16 +1,16 @@ 1999-03-02 09:44:33 10HmaX-0005vi-00 <= userx@test.ex U=CALLER P=local S=sss -1999-03-02 09:44:33 10HmaX-0005vi-00 => usery@test.ex R=r0 T=t1 H=127.0.0.1 [127.0.0.1] PRDR C="250 first rcpt was good" -1999-03-02 09:44:33 10HmaX-0005vi-00 -> userz@test.ex R=r0 T=t1 H=127.0.0.1 [127.0.0.1] PRDR C="250 second rcpt was good" +1999-03-02 09:44:33 10HmaX-0005vi-00 => usery@test.ex R=r0 T=t1 H=127.0.0.1 [127.0.0.1] PRDR C="250 first rcpt was good\\n250 OK, overall" +1999-03-02 09:44:33 10HmaX-0005vi-00 -> userz@test.ex R=r0 T=t1 H=127.0.0.1 [127.0.0.1] PRDR C="250 second rcpt was good\\n250 OK, overall" 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed 1999-03-02 09:44:33 10HmaY-0005vi-00 <= userx@test.ex U=CALLER P=local S=sss 1999-03-02 09:44:33 10HmaY-0005vi-00 => user2.1@test.ex R=r0 T=t1 H=127.0.0.1 [127.0.0.1] C="250 OK got that" 1999-03-02 09:44:33 10HmaY-0005vi-00 -> user2.2@test.ex R=r0 T=t1 H=127.0.0.1 [127.0.0.1] C="250 OK got that" 1999-03-02 09:44:33 10HmaY-0005vi-00 Completed 1999-03-02 09:44:33 10HmaZ-0005vi-00 <= userx@test.ex U=CALLER P=local S=sss -1999-03-02 09:44:33 10HmaZ-0005vi-00 => usery@test.ex R=r0 T=t1 H=127.0.0.1 [127.0.0.1] PRDR C="250 first rcpt was good" +1999-03-02 09:44:33 10HmaZ-0005vi-00 => usery@test.ex R=r0 T=t1 H=127.0.0.1 [127.0.0.1] PRDR C="250 first rcpt was good\\n250 OK, overall" 1999-03-02 09:44:33 10HmaZ-0005vi-00 == userz@test.ex R=r0 T=t1 defer (0) H=127.0.0.1 [127.0.0.1]: PRDR error after DATA: 450 cannot handle second rcpt right now 1999-03-02 09:44:33 10HmbA-0005vi-00 <= <> U=CALLER P=local S=sss -1999-03-02 09:44:33 10HmbA-0005vi-00 => userp@test.ex R=r0 T=t1 H=127.0.0.1 [127.0.0.1] PRDR C="250 first rcpt was good" +1999-03-02 09:44:33 10HmbA-0005vi-00 => userp@test.ex R=r0 T=t1 H=127.0.0.1 [127.0.0.1] PRDR C="250 first rcpt was good\\n250 OK, overall" 1999-03-02 09:44:33 10HmbA-0005vi-00 ** userq@test.ex R=r0 T=t1 H=127.0.0.1 [127.0.0.1]: PRDR error after DATA: 550 second rcpt does not like content 1999-03-02 09:44:33 10HmbA-0005vi-00 Frozen (delivery error message) 1999-03-02 09:44:33 10HmaZ-0005vi-00 == userz@test.ex routing defer (-51): retry time not reached diff --git a/test/log/5591 b/test/log/5591 index c8cdf557c..f5dd6534b 100644 --- a/test/log/5591 +++ b/test/log/5591 @@ -1,4 +1,4 @@ 1999-03-02 09:44:33 10HmaX-0005vi-00 <= sender@dom U=root P=local-bsmtp S=sss for usery@testhost.test.ex userz@testhost.test.ex -1999-03-02 09:44:33 10HmaX-0005vi-00 => usery@testhost.test.ex R=to_server T=remote_smtp H=127.0.0.1 [127.0.0.1] PRDR K C="250 first rcpt was good" -1999-03-02 09:44:33 10HmaX-0005vi-00 -> userz@testhost.test.ex R=to_server T=remote_smtp H=127.0.0.1 [127.0.0.1] PRDR K C="250 second rcpt was good" +1999-03-02 09:44:33 10HmaX-0005vi-00 => usery@testhost.test.ex R=to_server T=remote_smtp H=127.0.0.1 [127.0.0.1] PRDR K C="250 first rcpt was good\\n250 OK, overall" +1999-03-02 09:44:33 10HmaX-0005vi-00 -> userz@testhost.test.ex R=to_server T=remote_smtp H=127.0.0.1 [127.0.0.1] PRDR K C="250 second rcpt was good\\n250 OK, overall" 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed diff --git a/test/mail/4550.store b/test/mail/4550.store index d117b34c6..bb8afeb2a 100644 --- a/test/mail/4550.store +++ b/test/mail/4550.store @@ -2,10 +2,10 @@ From MAILER-DAEMON Tue Mar 02 09:44:33 1999 Return-path: <> Received: from the.local.host.name ([ip4.ip4.ip4.ip4] helo=myhost.test.ex) by myhost.test.ex with esmtp (Exim x.yz) - id 10HmaZ-0005vi-00 + id 10HmbA-0005vi-00 for CALLER@myhost.test.ex; Tue, 2 Mar 1999 09:44:33 +0000 Received: from EXIMUSER by myhost.test.ex with local (Exim x.yz) - id 10HmaY-0005vi-00 + id 10HmaZ-0005vi-00 for CALLER@myhost.test.ex; Tue, 2 Mar 1999 09:44:33 +0000 X-Failed-Recipients: baduser@test.ex Auto-Submitted: auto-replied @@ -14,7 +14,7 @@ To: CALLER@myhost.test.ex Content-Type: multipart/report; report-type=delivery-status; boundary=NNNNNNNNNN-eximdsn-MMMMMMMMMM MIME-Version: 1.0 Subject: Mail delivery failed: returning message to sender -Message-Id: +Message-Id: Date: Tue, 2 Mar 1999 09:44:33 +0000 --NNNNNNNNNN-eximdsn-MMMMMMMMMM