[exim-cvs] Cutthrough: logging of return_path

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] Cutthrough: logging of return_path
Gitweb: https://git.exim.org/exim.git/commitdiff/9adabf8d8efffb166745c8bba2041e9856b20f01
Commit:     9adabf8d8efffb166745c8bba2041e9856b20f01
Parent:     6ff2c5232200a73ed503a258e1a51e9d541f4b81
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Mon Dec 16 15:28:49 2024 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Tue Dec 17 11:26:00 2024 +0000


    Cutthrough: logging of return_path
---
 src/src/deliver.c | 18 +++++++++---------
 src/src/structs.h |  1 +
 src/src/verify.c  |  6 +++++-
 test/confs/5400   |  2 +-
 test/log/5400     | 32 ++++++++++++++++----------------
 5 files changed, 32 insertions(+), 27 deletions(-)


diff --git a/src/src/deliver.c b/src/src/deliver.c
index 7e51048f2..cbf5268c2 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -77,7 +77,6 @@ static pardata *parlist = NULL;
static struct pollfd *parpoll;
static int return_count;
static uschar *frozen_info = US"";
-static const uschar * used_return_path = NULL;



@@ -1172,8 +1171,8 @@ delivery; indeed, I did for some time, until this statement crashed. The case
when it is not set is for a delivery to /dev/null which is optimised by not
being run at all. */

-if (used_return_path && LOGGING(return_path_on_delivery))
- g = string_append(g, 3, US" P=<", used_return_path, US">");
+if (addr->return_path && LOGGING(return_path_on_delivery))
+ g = string_append(g, 3, US" P=<", addr->return_path, US">");

if (msg)
g = string_append(g, 2, US" ", msg);
@@ -1406,8 +1405,8 @@ if (*queue_name)

/* Return path may not be set if no delivery actually happened */

-if (used_return_path && LOGGING(return_path_on_delivery))
- g = string_append(g, 3, US" P=<", used_return_path, US">");
+if (addr->return_path && LOGGING(return_path_on_delivery))
+ g = string_append(g, 3, US" P=<", addr->return_path, US">");

if (addr->router)
g = string_append(g, 2, US" R=", addr->router->drinst.name);
@@ -2175,7 +2174,7 @@ if (tp->return_path)
/* For local deliveries, one at a time, the value used for logging can just be
set directly, once and for all. */

-used_return_path = return_path;
+addr->return_path = return_path;

/* Sort out the uid, gid, and initgroups flag. If an error occurs, the message
gets put into the address(es), and the expansions are unset, so we can just
@@ -3957,7 +3956,7 @@ static address_item *
par_wait(void)
{
int poffset, status;
-address_item * addr, * addrlist;
+address_item * addrlist;
pid_t pid;

 set_process_info("delivering %s: waiting for a remote delivery subprocess "
@@ -4167,7 +4166,7 @@ if ((status & 0xffff) != 0)
   if (msb != 0 || (code != SIGTERM && code != SIGKILL && code != SIGQUIT))
     addrlist->special_action = SPECIAL_FREEZE;


-  for (addr = addrlist; addr; addr = addr->next)
+  for (address_item * addr = addrlist; addr; addr = addr->next)
     {
     addr->transport_return = DEFER;
     addr->message = msg;
@@ -4186,7 +4185,8 @@ else if (!parlist[poffset].done)
 decrement the count of subprocesses, and return the address chain. */


 transport_count = parlist[poffset].transport_count;
-used_return_path = parlist[poffset].return_path;
+for (address_item * addr = addrlist; addr; addr = addr->next)
+  addr->return_path = parlist[poffset].return_path;
 parlist[poffset].pid = 0;
 parcount--;
 return addrlist;
diff --git a/src/src/structs.h b/src/src/structs.h
index 4c74608b3..7a7f7a02c 100644
--- a/src/src/structs.h
+++ b/src/src/structs.h
@@ -550,6 +550,7 @@ typedef struct address_item {
   const uschar *suffix_v;      /*  variable part of above */
   const uschar *domain;           /* working domain (lower cased) */


+  const uschar *return_path;      /* mailfrom, for logging */
   uschar *address_retry_key;      /* retry key including full address */
   uschar *domain_retry_key;       /* retry key for domain only */


diff --git a/src/src/verify.c b/src/src/verify.c
index 33929e023..08c3deb51 100644
--- a/src/src/verify.c
+++ b/src/src/verify.c
@@ -528,7 +528,11 @@ if (options & vopt_is_recipient)
     {
     from_address = sender_address;
     address_key = string_sprintf("%s/<%s>", addr->address, sender_address);
-    if (cutthrough.delivery) options |= vopt_callout_no_cache;
+    if (cutthrough.delivery)            /* cutthrough previously req. */
+      {
+      options |= vopt_callout_no_cache;        /* in case called by verify= */
+      addr->return_path = from_address;        /* for cutthrough logging */
+      }
     }
   else if (options & vopt_callout_recippmaster)
     {
diff --git a/test/confs/5400 b/test/confs/5400
index 9693818b1..1906e819d 100644
--- a/test/confs/5400
+++ b/test/confs/5400
@@ -10,7 +10,7 @@ OPT=


primary_hostname = myhost.test.ex

-log_selector = +received_recipients +all_parents
+log_selector = +received_recipients +all_parents +return_path_on_delivery
queue_only

# ----- Main settings -----
diff --git a/test/log/5400 b/test/log/5400
index 099075990..43873a680 100644
--- a/test/log/5400
+++ b/test/log/5400
@@ -1,59 +1,59 @@
**NOTE: The delivery lines in this file have been sorted.
1999-03-02 09:44:33 rcpt for userx@???
-1999-03-02 09:44:33 10HmaX-000000005vi-0000 >> userx@??? R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmaX-000000005vi-0000 >> userx@??? P=<CALLER@???> R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
1999-03-02 09:44:33 10HmaX-000000005vi-0000 <= CALLER@??? U=CALLER P=local-esmtp S=sss for userx@???
1999-03-02 09:44:33 10HmaX-000000005vi-0000 Completed
1999-03-02 09:44:33 rcpt for userz@???
-1999-03-02 09:44:33 10HmaY-000000005vi-0000 >> userz@??? R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmaY-000000005vi-0000 >> userz@??? P=<CALLER@???> R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
1999-03-02 09:44:33 10HmaY-000000005vi-0000 <= CALLER@??? U=CALLER P=local-esmtp S=sss for userz@???
1999-03-02 09:44:33 10HmaY-000000005vi-0000 Completed
1999-03-02 09:44:33 rcpt for usery@???
1999-03-02 09:44:33 rcpt for userx@???
-1999-03-02 09:44:33 10HmaZ-000000005vi-0000 >> userx@??? R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
-1999-03-02 09:44:33 10HmaZ-000000005vi-0000 >> usery@??? R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmaZ-000000005vi-0000 >> userx@??? P=<CALLER@???> R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmaZ-000000005vi-0000 >> usery@??? P=<CALLER@???> R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
1999-03-02 09:44:33 10HmaZ-000000005vi-0000 <= CALLER@??? U=CALLER P=local-esmtp S=sss for usery@??? userx@???
1999-03-02 09:44:33 10HmaZ-000000005vi-0000 Completed
1999-03-02 09:44:33 rcpt for userx@???
-1999-03-02 09:44:33 10HmbA-000000005vi-0000 >> userx@??? R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmbA-000000005vi-0000 >> userx@??? P=<CALLER@???> R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
1999-03-02 09:44:33 10HmbA-000000005vi-0000 <= CALLER@??? U=CALLER P=local-esmtp S=sss for userx@???
1999-03-02 09:44:33 10HmbA-000000005vi-0000 Completed
1999-03-02 09:44:33 rcpt for no@???
1999-03-02 09:44:33 U=CALLER F=<CALLER@???> rejected RCPT <no@???>
1999-03-02 09:44:33 rcpt for userx@???
1999-03-02 09:44:33 10HmbB-000000005vi-0000 <= CALLER@??? U=CALLER P=local-esmtp S=sss for userx@???
-1999-03-02 09:44:33 10HmbB-000000005vi-0000 => userx@??? R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmbB-000000005vi-0000 => userx@??? P=<> R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
1999-03-02 09:44:33 10HmbB-000000005vi-0000 Completed
1999-03-02 09:44:33 rcpt for userx@???
1999-03-02 09:44:33 rcpt for no@???
1999-03-02 09:44:33 U=CALLER F=<CALLER@???> rejected RCPT <no@???>
1999-03-02 09:44:33 10HmbC-000000005vi-0000 <= CALLER@??? U=CALLER P=local-esmtp S=sss for userx@???
-1999-03-02 09:44:33 10HmbC-000000005vi-0000 => userx@??? R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmbC-000000005vi-0000 => userx@??? P=<> R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
1999-03-02 09:44:33 10HmbC-000000005vi-0000 Completed
1999-03-02 09:44:33 rcpt for userx@???
1999-03-02 09:44:33 rcpt for special_tpt@???
1999-03-02 09:44:33 10HmbD-000000005vi-0000 <= CALLER@??? U=CALLER P=local-esmtp S=sss for userx@??? special_tpt@???
-1999-03-02 09:44:33 10HmbD-000000005vi-0000 => special_tpt@??? R=all T=smtp2 H=127.0.0.1 [127.0.0.1] C="250 OK"
-1999-03-02 09:44:33 10HmbD-000000005vi-0000 => userx@??? R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmbD-000000005vi-0000 => special_tpt@??? P=<> R=all T=smtp2 H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmbD-000000005vi-0000 => userx@??? P=<> R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
1999-03-02 09:44:33 10HmbD-000000005vi-0000 Completed
1999-03-02 09:44:33 rcpt for userx@???
1999-03-02 09:44:33 rcpt for usery@???
-1999-03-02 09:44:33 10HmbE-000000005vi-0000 >> usery@??? R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
-1999-03-02 09:44:33 10HmbE-000000005vi-0000 >> userx@??? R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmbE-000000005vi-0000 >> usery@??? P=<CALLER@???> R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmbE-000000005vi-0000 >> userx@??? P=<CALLER@???> R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
1999-03-02 09:44:33 10HmbE-000000005vi-0000 <= CALLER@??? U=CALLER P=local-esmtp S=sss for userx@??? usery@???
1999-03-02 09:44:33 10HmbE-000000005vi-0000 Completed
1999-03-02 09:44:33 rcpt for userx@???
1999-03-02 09:44:33 rcpt for usery@???
1999-03-02 09:44:33 10HmbF-000000005vi-0000 <= CALLER@??? U=CALLER P=local-esmtp S=sss for userx@??? usery@???
-1999-03-02 09:44:33 10HmbF-000000005vi-0000 => userx@??? R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
-1999-03-02 09:44:33 10HmbF-000000005vi-0000 => usery@??? R=all T=smtp H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4] C="250 OK"
+1999-03-02 09:44:33 10HmbF-000000005vi-0000 => userx@??? P=<> R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmbF-000000005vi-0000 => usery@??? P=<> R=all T=smtp H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4] C="250 OK"
1999-03-02 09:44:33 10HmbF-000000005vi-0000 Completed
1999-03-02 09:44:33 rcpt for userx@???
1999-03-02 09:44:33 rcpt for usery@???
-1999-03-02 09:44:33 10HmbG-000000005vi-0000 >> usery@??? R=dns T=smtp H=localhost4.test.ex [127.0.0.1] C="250 OK"
-1999-03-02 09:44:33 10HmbG-000000005vi-0000 >> userx@??? R=dns T=smtp H=localhost4.test.ex [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmbG-000000005vi-0000 >> usery@??? P=<CALLER@???> R=dns T=smtp H=localhost4.test.ex [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmbG-000000005vi-0000 >> userx@??? P=<CALLER@???> R=dns T=smtp H=localhost4.test.ex [127.0.0.1] C="250 OK"
1999-03-02 09:44:33 10HmbG-000000005vi-0000 <= CALLER@??? U=CALLER P=local-esmtp S=sss for userx@??? usery@???
1999-03-02 09:44:33 10HmbG-000000005vi-0000 Completed
1999-03-02 09:44:33 rcpt for userx@???
-1999-03-02 09:44:33 10HmbH-000000005vi-0000 >> userx@??? R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmbH-000000005vi-0000 >> userx@??? P=<CALLER@???> R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
1999-03-02 09:44:33 10HmbH-000000005vi-0000 <= CALLER@??? U=CALLER P=local-esmtp S=sss for userx@???
1999-03-02 09:44:33 10HmbH-000000005vi-0000 Completed

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-cvs.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-cvs-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/