Gitweb:
https://git.exim.org/exim.git/commitdiff/a31b8b2c91b548cc11f9e482315beb2373211b5e
Commit: a31b8b2c91b548cc11f9e482315beb2373211b5e
Parent: 24cda181fb88542cf38db2beae5d0ddb37f59c5c
Author: Jeremy Harris <jgh146exb@???>
AuthorDate: Sun Mar 26 16:17:16 2023 +0100
Committer: Jeremy Harris <jgh146exb@???>
CommitDate: Sun Mar 26 16:18:07 2023 +0100
Make $router_name usable from transport
---
doc/doc-docbook/spec.xfpt | 3 ++-
src/src/deliver.c | 8 ++++++--
test/confs/0143 | 2 +-
test/stderr/0143 | 2 +-
4 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt
index fed13f23d..8055daebe 100644
--- a/doc/doc-docbook/spec.xfpt
+++ b/doc/doc-docbook/spec.xfpt
@@ -13450,7 +13450,8 @@ This is an obsolete name for &$bounce_return_size_limit$&.
.cindex "router" "name"
.cindex "name" "of router"
.vindex "&$router_name$&"
-During the running of a router this variable contains its name.
+During the running of a router, or a transport called,
+this variable contains the router name.
.vitem &$runrc$&
.cindex "return code" "from &%run%& expansion"
diff --git a/src/src/deliver.c b/src/src/deliver.c
index f3a406990..ad045c8cc 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -2371,7 +2371,9 @@ if ((pid = exim_fork(US"delivery-local")) == 0)
addr->local_part, tp->name);
/* Setting these globals in the subprocess means we need never clear them */
- transport_name = addr->transport->name;
+
+ transport_name = tp->name;
+ if (addr->router) router_name = addr->router->name;
driver_srcfile = tp->srcfile;
driver_srcline = tp->srcline;
@@ -4663,7 +4665,9 @@ all pipes, so I do not see a reason to use non-blocking IO here
host_item *h;
/* Setting these globals in the subprocess means we need never clear them */
- transport_name = addr->transport->name;
+
+ transport_name = tp->name;
+ if (addr->router) router_name = addr->router->name;
driver_srcfile = tp->srcfile;
driver_srcline = tp->srcline;
diff --git a/test/confs/0143 b/test/confs/0143
index 8f0300aa0..f451be394 100644
--- a/test/confs/0143
+++ b/test/confs/0143
@@ -32,7 +32,7 @@ my_smtp:
interface = HOSTIPV4
port = PORT_S
hosts_try_fastopen = :
- debug_print = transport_name <$transport_name>
+ debug_print = transport_name <$transport_name> from router <$router_name>
# End
diff --git a/test/stderr/0143 b/test/stderr/0143
index 158e97d53..9feb83a4b 100644
--- a/test/stderr/0143
+++ b/test/stderr/0143
@@ -12,7 +12,7 @@ dropping to exim gid; retaining priv uid
router_name <my_main_router>
>>>>>>>>>>>>>>>> Remote deliveries >>>>>>>>>>>>>>>>
--------> userx@??? <--------
-transport_name <my_smtp>
+transport_name <my_smtp> from router <my_main_router>
my_smtp transport entered
userx@???
hostlist: