[exim-cvs] Add $router_name and $transport_name variables. B…

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Exim Git Commits Mailing List
Date:  
À: exim-cvs
Sujet: [exim-cvs] Add $router_name and $transport_name variables. Bug 308.
Gitweb: http://git.exim.org/exim.git/commitdiff/181d9bf8a602a2573d566427803a4c5288a56008
Commit:     181d9bf8a602a2573d566427803a4c5288a56008
Parent:     c3eacdb0bc1ab24331b781dc3f08b075aa52e329
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sat Oct 6 23:20:08 2012 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Tue Dec 25 19:58:32 2012 +0000


    Add $router_name and $transport_name variables.  Bug 308.
---
 doc/doc-docbook/spec.xfpt    |   19 ++++++++++++++++++-
 doc/doc-txt/ChangeLog        |    2 ++
 doc/doc-txt/NewStuff         |    7 +++++++
 src/src/deliver.c            |    4 ++++
 src/src/expand.c             |    2 ++
 src/src/globals.c            |    3 +++
 src/src/globals.h            |    2 ++
 src/src/route.c              |    1 +
 test/confs/0143              |    7 ++++---
 test/confs/0227              |   10 +++++++---
 test/confs/0325              |    8 ++++----
 test/confs/0410              |    2 ++
 test/log/0143                |    2 +-
 test/log/0227                |   25 ++++++++++++++++---------
 test/rejectlog/0227          |   18 +++++++++---------
 test/scripts/0000-Basic/0143 |    2 +-
 test/scripts/0000-Basic/0227 |    2 +-
 test/scripts/0000-Basic/0325 |    2 +-
 test/scripts/0000-Basic/0410 |    2 +-
 test/stderr/0143             |    7 ++++---
 test/stderr/0227             |   32 +++++++++++++++++++++++---------
 21 files changed, 113 insertions(+), 46 deletions(-)


diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt
index e049936..0d258ec 100644
--- a/doc/doc-docbook/spec.xfpt
+++ b/doc/doc-docbook/spec.xfpt
@@ -11750,6 +11750,13 @@ envelope sender.
.vindex "&$return_size_limit$&"
This is an obsolete name for &$bounce_return_size_limit$&.

+.vitem &$router_name$&
+.cindex "router" "name"
+.cindex "name" "of router"
+.vindex "&$router_name$&"
+During the running of a router, and any transport it runs, this variable
+contains the name of the router.
+
.vitem &$runrc$&
.cindex "return code" "from &%run%& expansion"
.vindex "&$runrc$&"
@@ -12204,6 +12211,12 @@ This variable contains the numerical value of the local timezone, for example:
This variable contains the UTC date and time in &"Zulu"& format, as specified
by ISO 8601, for example: 20030221154023Z.

+.vitem &$transport_name$&
+.cindex "transport" "name"
+.cindex "name" "of transport"
+.vindex "&$transport_name$&"
+During the running of a transport, this variable contains its name.
+
.vitem &$value$&
.vindex "&$value$&"
This variable contains the result of an expansion lookup, extraction operation,
@@ -16420,7 +16433,8 @@ be specified using &%condition%&.
.option debug_print routers string&!! unset
.cindex "testing" "variables in drivers"
If this option is set and debugging is enabled (see the &%-d%& command line
-option), the string is expanded and included in the debugging output.
+option) or in address-testing mode (see the &%-bt%& command line option),
+the string is expanded and included in the debugging output.
If expansion of the string fails, the error message is written to the debugging
output, and Exim carries on processing.
This option is provided to help with checking out the values of variables and
@@ -16429,6 +16443,7 @@ option appears not to be working, &%debug_print%& can be used to output the
variables it references. The output happens after checks for &%domains%&,
&%local_parts%&, and &%check_local_user%& but before any other preconditions
are tested. A newline is added to the text if it does not end with one.
+The variable &$router_name$& contains the name of the router.



@@ -19589,6 +19604,8 @@ so on when debugging driver configurations. For example, if a &%headers_add%&
option is not working properly, &%debug_print%& could be used to output the
variables it references. A newline is added to the text if it does not end with
one.
+The variables &$transport_name$ and &&$router_name$& contain the name of the
+transport and the router that called it.


 .option delivery_date_add transports boolean false
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index bf81413..a8b2dfa 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -80,6 +80,8 @@ JH/09 Add $headers_added variable, with content from use of ACL modifier
 JH/10 Add 8bitmime log_selector, for 8bitmime status on the received line.
       Pulled from Bugzilla 817 by Wolfgang Breyha.


+JH/11 Add $router_name and $transport_name variables.  Bugzilla 308.
+
 PP/11 SECURITY: protect DKIM DNS decoding from remote exploit.
       CVE-2012-5671


diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff
index 974ebeb..cf40148 100644
--- a/doc/doc-txt/NewStuff
+++ b/doc/doc-txt/NewStuff
@@ -120,8 +120,15 @@ Version 4.82

15. New 8bitmime status logging option for received messages. Log field "M8S".

+
16. New authenticated_sender logging option, adding to log field "A".

+17. New expansion variables $router_name and $transport_name.  Useful
+    particularly for debug_print as -bt commandline option does not
+    require privilege whereas -d does.  As a side-effect the router accepting
+    for verification is visible in ACLs.
+
+


Version 4.80
------------
diff --git a/src/src/deliver.c b/src/src/deliver.c
index 79d431b..55bfa0d 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -2190,6 +2190,8 @@ while (addr_local != NULL)

if (previously_transported(addr, FALSE)) continue;

+ transport_name = tp->name;
+
/* There are weird cases where logging is disabled */

disable_logging = tp->disable_logging;
@@ -3530,6 +3532,8 @@ for (delivery_count = 0; addr_remote != NULL; delivery_count++)

if (previously_transported(addr, FALSE)) continue;

+ transport_name = tp->name;
+
/* Force failure if the message is too big. */

   if (tp->message_size_limit != NULL)
diff --git a/src/src/expand.c b/src/src/expand.c
index c7dc274..464c6f6 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -571,6 +571,7 @@ static var_entry var_table[] = {
   { "reply_address",       vtype_reply,       NULL },
   { "return_path",         vtype_stringptr,   &return_path },
   { "return_size_limit",   vtype_int,         &bounce_return_size_limit },
+  { "router_name",         vtype_stringptr,   &router_name },
   { "runrc",               vtype_int,         &runrc },
   { "self_hostname",       vtype_stringptr,   &self_hostname },
   { "sender_address",      vtype_stringptr,   &sender_address },
@@ -667,6 +668,7 @@ static var_entry var_table[] = {
   { "tod_logfile",         vtype_todlf,       NULL },
   { "tod_zone",            vtype_todzone,     NULL },
   { "tod_zulu",            vtype_todzulu,     NULL },
+  { "transport_name",      vtype_stringptr,   &transport_name },
   { "value",               vtype_stringptr,   &lookup_value },
   { "version_number",      vtype_stringptr,   &version_string },
   { "warn_message_delay",  vtype_stringptr,   &warnmsg_delay },
diff --git a/src/src/globals.c b/src/src/globals.c
index 616a235..43cf73d 100644
--- a/src/src/globals.c
+++ b/src/src/globals.c
@@ -1071,6 +1071,8 @@ router_instance  router_defaults = {
     NULL                       /* redirect_router */
 };


+uschar *router_name            = NULL;
+
 ip_address_item *running_interfaces = NULL;
 BOOL    running_in_test_harness = FALSE;


@@ -1305,6 +1307,7 @@ transport_instance transport_defaults = {
};

 int     transport_count;
+uschar *transport_name          = NULL;
 int     transport_newlines;
 uschar **transport_filter_argv  = NULL;
 int     transport_filter_timeout;
diff --git a/src/src/globals.h b/src/src/globals.h
index 325a916..06cbf31 100644
--- a/src/src/globals.h
+++ b/src/src/globals.h
@@ -657,6 +657,7 @@ extern uid_t   root_uid;               /* The uid for root */
 extern router_info routers_available[];/* Vector of available routers */
 extern router_instance *routers;       /* Chain of instantiated routers */
 extern router_instance router_defaults;/* Default values */
+extern uschar *router_name;            /* Name of router last started */
 extern BOOL    running_in_test_harness; /*TRUE when running_status is patched */
 extern ip_address_item *running_interfaces; /* Host's running interfaces */
 extern uschar *running_status;         /* Flag string for testing */
@@ -812,6 +813,7 @@ extern int     test_harness_load_avg;  /* For use when testing */
 extern int     thismessage_size_limit; /* Limit for this message */
 extern int     timeout_frozen_after;   /* Max time to keep frozen messages */
 extern BOOL    timestamps_utc;         /* Use UTC for all times */
+extern uschar *transport_name;         /* Name of transport last started */
 extern int     transport_count;        /* Count of bytes transported */
 extern int     transport_newlines;     /* Accurate count of number of newline chars transported */
 extern uschar **transport_filter_argv; /* For on-the-fly filtering */
diff --git a/src/src/route.c b/src/src/route.c
index 32dbd60..f8bacf1 100644
--- a/src/src/route.c
+++ b/src/src/route.c
@@ -1512,6 +1512,7 @@ for (r = (addr->start_router == NULL)? routers : addr->start_router;
   int rc;


DEBUG(D_route) debug_printf("--------> %s router <--------\n", r->name);
+ router_name = r->name;

/* Reset any search error message from the previous router. */

diff --git a/test/confs/0143 b/test/confs/0143
index c853c80..08eb3f6 100644
--- a/test/confs/0143
+++ b/test/confs/0143
@@ -18,12 +18,12 @@ domainlist local_domains = test.ex : *.test.ex

begin routers

-all:
+my_main_router:
driver = manualroute
domains = ! +local_domains
route_list = * 127.0.0.1
self = send
- transport = smtp
+ transport = my_smtp
no_more


@@ -31,10 +31,11 @@ all:

begin transports

-smtp:
+my_smtp:
driver = smtp
interface = HOSTIPV4
port = PORT_S
+ debug_print = transport_name <$transport_name> from router <$router_name>


 # End
diff --git a/test/confs/0227 b/test/confs/0227
index 17f49eb..2f21781 100644
--- a/test/confs/0227
+++ b/test/confs/0227
@@ -26,21 +26,25 @@ check_recipient:
           control  = no_multiline_responses
   accept  hosts    = V4NET.0.0.4
   deny    hosts    = V4NET.0.0.1
+          log_message = ($sender_verify_failure) R:$router_name
          !verify   = sender/callout=no_cache
   deny    hosts    = V4NET.0.0.3
-          log_message = ($recipient_verify_failure)
+          log_message = ($recipient_verify_failure) R:$router_name
          !verify   = recipient/callout=no_cache
+  warn    logwrite = verify recipient used R:$router_name
   deny    hosts    = V4NET.0.0.5
-          log_message = ($sender_verify_failure)
+          log_message = ($sender_verify_failure) R:$router_name
          !verify   = sender/callout=no_cache/check_postmaster
   require verify   = sender
+          logwrite = verify sender used R:$router_name
   accept  domains  = +local_domains
   deny    message  = relay not permitted


 check_data:
   deny    hosts = V4NET.0.0.4
+          log_message = header_sender R:$router_name
          !verify = header_sender/callout=no_cache
-  accept
+  accept logwrite = verify header_sender used R:$router_name



 # ----- Routers -----
diff --git a/test/confs/0325 b/test/confs/0325
index f56b01b..5310dcc 100644
--- a/test/confs/0325
+++ b/test/confs/0325
@@ -41,7 +41,7 @@ r1:
   local_parts = lsearch;DIR/aux-fixed/TESTNUM.data
   data =
   debug_print = r1: \$domain_data = $domain_data\n\
-                r1: \$local_part_data = $local_part_data
+                $router_name: \$local_part_data = $local_part_data


 r2:
   driver = redirect
@@ -49,7 +49,7 @@ r2:
   local_parts = lsearch;DIR/aux-fixed/TESTNUM.data
   data =
   debug_print = r2: \$domain_data = $domain_data\n\
-                r2: \$local_part_data = $local_part_data
+                $router_name: \$local_part_data = $local_part_data


 r3:
   driver = redirect
@@ -57,7 +57,7 @@ r3:
   local_parts = +test_local_parts
   data =
   debug_print = r3: \$domain_data = $domain_data\n\
-                r3: \$local_part_data = $local_part_data
+                $router_name: \$local_part_data = $local_part_data


 r4:
   driver = accept
@@ -65,7 +65,7 @@ r4:
   local_parts = +test_local_parts
   transport = t1
   debug_print = r4: \$domain_data = $domain_data\n\
-                r4: \$local_part_data = $local_part_data
+                $router_name: \$local_part_data = $local_part_data



# ----- Transports -----
diff --git a/test/confs/0410 b/test/confs/0410
index b8da514..934d8a1 100644
--- a/test/confs/0410
+++ b/test/confs/0410
@@ -22,7 +22,9 @@ begin ACL

 rcpt:
   accept verify = recipient
+     logwrite = rcpt R:$router_name
          verify = sender
+     logwrite = sndr R:$router_name
          condition = ${if eq {$address_data}{ADDRESS_DATA_STRING}{yes}{no}}
          condition = ${if eq {$sender_address_data}{SENDER_ADDRESS_DATA_STRING}{yes}{no}}


diff --git a/test/log/0143 b/test/log/0143
index c21deee..1f177b3 100644
--- a/test/log/0143
+++ b/test/log/0143
@@ -1,3 +1,3 @@
 1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss
-1999-03-02 09:44:33 10HmaX-0005vi-00 => userx@??? R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmaX-0005vi-00 => userx@??? R=my_main_router T=my_smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
diff --git a/test/log/0227 b/test/log/0227
index b976ec2..00d940b 100644
--- a/test/log/0227
+++ b/test/log/0227
@@ -1,20 +1,27 @@
+1999-03-02 09:44:33 verify recipient used R:all
+1999-03-02 09:44:33 verify sender used R:all
+1999-03-02 09:44:33 verify recipient used R:
+1999-03-02 09:44:33 verify sender used R:all
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root sender verify fail for <bad@localhost>: response to "RCPT TO:<bad@localhost>" from 127.0.0.1 [127.0.0.1] was: 550 Unknown user
-1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<bad@localhost> rejected RCPT <z@???>: Sender verify failed
+1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<bad@localhost> rejected RCPT <z@???>: (recipient) R:all: Sender verify failed
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root sender verify defer for <uncheckable@localhost1>: response to "RCPT TO:<uncheckable@localhost1>" from 127.0.0.1 [127.0.0.1] was: 450 Temporary error
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<uncheckable@localhost1> temporarily rejected RCPT <z@???>: Could not complete sender verify callout
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root sender verify fail for <uncheckable2@localhost1>: response to "MAIL FROM:<>" from 127.0.0.1 [127.0.0.1] was: 550 Error for <>
-1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<uncheckable2@localhost1> rejected RCPT <z@???>: Sender verify failed
+1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<uncheckable2@localhost1> rejected RCPT <z@???>: (mail) R:localhost1: Sender verify failed
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root sender verify fail for <uncheckable@localhost1>: response to "MAIL FROM:<>" from 127.0.0.1 [127.0.0.1] was: 550-Multiline error for <>\n550 Here's the second line
-1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: Sender verify failed
-1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient): response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550 Recipient not liked
-1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient): response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550-Recipient not liked on two lines\n550 Here's the second
+1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (mail) R:localhost1: Sender verify failed
+1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient) R:all: response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550 Recipient not liked
+1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient) R:all: response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550-Recipient not liked on two lines\n550 Here's the second
 1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> temporarily rejected RCPT <z@???>: Could not complete recipient verify callout
-1999-03-02 09:44:33 10HmaX-0005vi-00 H=[V4NET.0.0.4] U=root F=<uncheckable@localhost1> rejected after DATA: there is no valid sender in any header line
-1999-03-02 09:44:33 10HmaY-0005vi-00 H=[V4NET.0.0.4] U=root F=<uncheckable@localhost1> rejected after DATA: there is no valid sender in any header line
+1999-03-02 09:44:33 10HmaX-0005vi-00 H=[V4NET.0.0.4] U=root F=<uncheckable@localhost1> rejected after DATA: header_sender R:all: there is no valid sender in any header line
+1999-03-02 09:44:33 10HmaY-0005vi-00 H=[V4NET.0.0.4] U=root F=<uncheckable@localhost1> rejected after DATA: header_sender R:all: there is no valid sender in any header line
+1999-03-02 09:44:33 verify recipient used R:
+1999-03-02 09:44:33 verify sender used R:localhost1
 1999-03-02 09:44:33 H=[V4NET.0.0.5] U=root F=<ok@localhost1> rejected RCPT <z@???>: relay not permitted
+1999-03-02 09:44:33 verify recipient used R:
 1999-03-02 09:44:33 H=[V4NET.0.0.5] U=root sender verify fail for <ok@localhost1>: response to "RCPT TO:<postmaster@localhost1>" from 127.0.0.1 [127.0.0.1] was: 550 Don't like postmaster
-1999-03-02 09:44:33 H=[V4NET.0.0.5] U=root F=<ok@localhost1> rejected RCPT <z@???>: (postmaster): Sender verify failed
-1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient): response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550 Recipient not liked
+1999-03-02 09:44:33 H=[V4NET.0.0.5] U=root F=<ok@localhost1> rejected RCPT <z@???>: (postmaster) R:localhost1: Sender verify failed
+1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient) R:lmtp: response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550 Recipient not liked
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root sender verify defer for <bad@localhost1>: response to "initial connection" from 127.0.0.1 [127.0.0.1] was: connection dropped
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<bad@localhost1> temporarily rejected RCPT <z@???>: Could not complete sender verify callout
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root sender verify defer for <bad@localhost1>: could not connect to 127.0.0.1 [127.0.0.1]: Connection refused
diff --git a/test/rejectlog/0227 b/test/rejectlog/0227
index bc1480b..f622569 100644
--- a/test/rejectlog/0227
+++ b/test/rejectlog/0227
@@ -1,15 +1,15 @@
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root sender verify fail for <bad@localhost>: response to "RCPT TO:<bad@localhost>" from 127.0.0.1 [127.0.0.1] was: 550 Unknown user
-1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<bad@localhost> rejected RCPT <z@???>: Sender verify failed
+1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<bad@localhost> rejected RCPT <z@???>: (recipient) R:all: Sender verify failed
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root sender verify defer for <uncheckable@localhost1>: response to "RCPT TO:<uncheckable@localhost1>" from 127.0.0.1 [127.0.0.1] was: 450 Temporary error
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<uncheckable@localhost1> temporarily rejected RCPT <z@???>: Could not complete sender verify callout
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root sender verify fail for <uncheckable2@localhost1>: response to "MAIL FROM:<>" from 127.0.0.1 [127.0.0.1] was: 550 Error for <>
-1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<uncheckable2@localhost1> rejected RCPT <z@???>: Sender verify failed
+1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<uncheckable2@localhost1> rejected RCPT <z@???>: (mail) R:localhost1: Sender verify failed
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root sender verify fail for <uncheckable@localhost1>: response to "MAIL FROM:<>" from 127.0.0.1 [127.0.0.1] was: 550-Multiline error for <>\n550 Here's the second line
-1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: Sender verify failed
-1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient): response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550 Recipient not liked
-1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient): response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550-Recipient not liked on two lines\n550 Here's the second
+1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (mail) R:localhost1: Sender verify failed
+1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient) R:all: response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550 Recipient not liked
+1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient) R:all: response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550-Recipient not liked on two lines\n550 Here's the second
 1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> temporarily rejected RCPT <z@???>: Could not complete recipient verify callout
-1999-03-02 09:44:33 10HmaX-0005vi-00 H=[V4NET.0.0.4] U=root F=<uncheckable@localhost1> rejected after DATA: there is no valid sender in any header line
+1999-03-02 09:44:33 10HmaX-0005vi-00 H=[V4NET.0.0.4] U=root F=<uncheckable@localhost1> rejected after DATA: header_sender R:all: there is no valid sender in any header line
 Envelope-from: <uncheckable@localhost1>
 Envelope-to: <z@???>
 P Received: from [V4NET.0.0.4] (ident=root)
@@ -18,7 +18,7 @@ P Received: from [V4NET.0.0.4] (ident=root)
     id 10HmaX-0005vi-00
     for z@???; Tue, 2 Mar 1999 09:44:33 +0000
 F From: abcd@???
-1999-03-02 09:44:33 10HmaY-0005vi-00 H=[V4NET.0.0.4] U=root F=<uncheckable@localhost1> rejected after DATA: there is no valid sender in any header line
+1999-03-02 09:44:33 10HmaY-0005vi-00 H=[V4NET.0.0.4] U=root F=<uncheckable@localhost1> rejected after DATA: header_sender R:all: there is no valid sender in any header line
 Envelope-from: <uncheckable@localhost1>
 Envelope-to: <z@???>
 P Received: from [V4NET.0.0.4] (ident=root)
@@ -29,8 +29,8 @@ P Received: from [V4NET.0.0.4] (ident=root)
 F From: abcd@???
 1999-03-02 09:44:33 H=[V4NET.0.0.5] U=root F=<ok@localhost1> rejected RCPT <z@???>: relay not permitted
 1999-03-02 09:44:33 H=[V4NET.0.0.5] U=root sender verify fail for <ok@localhost1>: response to "RCPT TO:<postmaster@localhost1>" from 127.0.0.1 [127.0.0.1] was: 550 Don't like postmaster
-1999-03-02 09:44:33 H=[V4NET.0.0.5] U=root F=<ok@localhost1> rejected RCPT <z@???>: (postmaster): Sender verify failed
-1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient): response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550 Recipient not liked
+1999-03-02 09:44:33 H=[V4NET.0.0.5] U=root F=<ok@localhost1> rejected RCPT <z@???>: (postmaster) R:localhost1: Sender verify failed
+1999-03-02 09:44:33 H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient) R:lmtp: response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550 Recipient not liked
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root sender verify defer for <bad@localhost1>: response to "initial connection" from 127.0.0.1 [127.0.0.1] was: connection dropped
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root F=<bad@localhost1> temporarily rejected RCPT <z@???>: Could not complete sender verify callout
 1999-03-02 09:44:33 H=[V4NET.0.0.1] U=root sender verify defer for <bad@localhost1>: could not connect to 127.0.0.1 [127.0.0.1]: Connection refused
diff --git a/test/scripts/0000-Basic/0143 b/test/scripts/0000-Basic/0143
index 41596d6..7ab54f1 100644
--- a/test/scripts/0000-Basic/0143
+++ b/test/scripts/0000-Basic/0143
@@ -1,4 +1,4 @@
-# smtp client "interface" option
+# smtp client "interface" option, $transport_name and $router_name
 need_ipv4
 #
 server PORT_S
diff --git a/test/scripts/0000-Basic/0227 b/test/scripts/0000-Basic/0227
index 7b091de..59adba7 100644
--- a/test/scripts/0000-Basic/0227
+++ b/test/scripts/0000-Basic/0227
@@ -1,4 +1,4 @@
-# callout verification (no caching)
+# callout verification (no caching) and $router_name
 need_ipv4
 #
 server PORT_S
diff --git a/test/scripts/0000-Basic/0325 b/test/scripts/0000-Basic/0325
index b2109f0..a81abd6 100644
--- a/test/scripts/0000-Basic/0325
+++ b/test/scripts/0000-Basic/0325
@@ -1,4 +1,4 @@
-# $domain_data and $local_part_data
+# $domain_data, $local_part_data and $router_name
 exim -v -bt xxx@???
 ****
 exim -bh V4NET.0.0.0
diff --git a/test/scripts/0000-Basic/0410 b/test/scripts/0000-Basic/0410
index 5124845..8d9c240 100644
--- a/test/scripts/0000-Basic/0410
+++ b/test/scripts/0000-Basic/0410
@@ -1,4 +1,4 @@
-# address_data in ACLs after verification
+# address_data and router_name in ACLs after verification
 exim -bs
 MAIL FROM:<oksender@y>
 rcpt to:<child@???>
diff --git a/test/stderr/0143 b/test/stderr/0143
index 3373ded..bcf7ecc 100644
--- a/test/stderr/0143
+++ b/test/stderr/0143
@@ -10,7 +10,8 @@ trusted user
 admin user

>>>>>>>>>>>>>>>> Remote deliveries >>>>>>>>>>>>>>>>

--------> userx@??? <--------
-smtp transport entered
+transport_name <my_smtp> from router <my_main_router>
+my_smtp transport entered
userx@???
checking status of 127.0.0.1
127.0.0.1 [127.0.0.1]:1111 status = usable
@@ -36,9 +37,9 @@ transport_check_waiting entered
sequence=1 local_max=500 global_max=-1
no messages waiting for 127.0.0.1
SMTP>> QUIT
-Leaving smtp transport
+Leaving my_smtp transport
LOG: MAIN
- => userx@??? R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+ => userx@??? R=my_main_router T=my_smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
LOG: MAIN
Completed
>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>

diff --git a/test/stderr/0227 b/test/stderr/0227
index 31f5b58..2530d7c 100644
--- a/test/stderr/0227
+++ b/test/stderr/0227
@@ -9,10 +9,18 @@ Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
   SMTP>> RCPT TO:<ok@localhost>
   SMTP<< 250 OK
   SMTP>> QUIT
+LOG: MAIN
+  verify recipient used R:all
+LOG: MAIN
+  verify sender used R:all
 LOG: smtp_connection MAIN
   SMTP connection from root closed by QUIT
 LOG: smtp_connection MAIN
   SMTP connection from root
+LOG: MAIN
+  verify recipient used R:
+LOG: MAIN
+  verify sender used R:all
 LOG: smtp_connection MAIN
   SMTP connection from root closed by QUIT
 LOG: smtp_connection MAIN
@@ -29,7 +37,7 @@ Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
 LOG: MAIN REJECT
   H=[V4NET.0.0.1] U=root sender verify fail for <bad@localhost>: response to "RCPT TO:<bad@localhost>" from 127.0.0.1 [127.0.0.1] was: 550 Unknown user
 LOG: MAIN REJECT
-  H=[V4NET.0.0.1] U=root F=<bad@localhost> rejected RCPT <z@???>: Sender verify failed
+  H=[V4NET.0.0.1] U=root F=<bad@localhost> rejected RCPT <z@???>: (recipient) R:all: Sender verify failed
 LOG: smtp_connection MAIN
   SMTP connection from root closed by QUIT
 LOG: smtp_connection MAIN
@@ -61,7 +69,7 @@ Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
 LOG: MAIN REJECT
   H=[V4NET.0.0.1] U=root sender verify fail for <uncheckable2@localhost1>: response to "MAIL FROM:<>" from 127.0.0.1 [127.0.0.1] was: 550 Error for <>
 LOG: MAIN REJECT
-  H=[V4NET.0.0.1] U=root F=<uncheckable2@localhost1> rejected RCPT <z@???>: Sender verify failed
+  H=[V4NET.0.0.1] U=root F=<uncheckable2@localhost1> rejected RCPT <z@???>: (mail) R:localhost1: Sender verify failed
 LOG: smtp_connection MAIN
   SMTP connection from root closed by QUIT
 LOG: smtp_connection MAIN
@@ -77,7 +85,7 @@ Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
 LOG: MAIN REJECT
   H=[V4NET.0.0.1] U=root sender verify fail for <uncheckable@localhost1>: response to "MAIL FROM:<>" from 127.0.0.1 [127.0.0.1] was: 550-Multiline error for <>\n550 Here's the second line
 LOG: MAIN REJECT
-  H=[V4NET.0.0.1] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: Sender verify failed
+  H=[V4NET.0.0.1] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (mail) R:localhost1: Sender verify failed
 LOG: smtp_connection MAIN
   SMTP connection from root closed by QUIT
 LOG: smtp_connection MAIN
@@ -92,7 +100,7 @@ Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
   SMTP<< 550 Recipient not liked
   SMTP>> QUIT
 LOG: MAIN REJECT
-  H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient): response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550 Recipient not liked
+  H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient) R:all: response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550 Recipient not liked
 LOG: smtp_connection MAIN
   SMTP connection from root closed by QUIT
 LOG: smtp_connection MAIN
@@ -108,7 +116,7 @@ Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
          550 Here's the second
   SMTP>> QUIT
 LOG: MAIN REJECT
-  H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient): response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550-Recipient not liked on two lines\n550 Here's the second
+  H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient) R:all: response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550-Recipient not liked on two lines\n550 Here's the second
 LOG: smtp_connection MAIN
   SMTP connection from root closed by QUIT
 LOG: smtp_connection MAIN
@@ -131,7 +139,7 @@ Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
   SMTP<< 550 Not liked
   SMTP>> QUIT
 LOG: MAIN REJECT
-  H=[V4NET.0.0.4] U=root F=<uncheckable@localhost1> rejected after DATA: there is no valid sender in any header line
+  H=[V4NET.0.0.4] U=root F=<uncheckable@localhost1> rejected after DATA: header_sender R:all: there is no valid sender in any header line
 LOG: smtp_connection MAIN
   SMTP connection from root closed by QUIT
 LOG: smtp_connection MAIN
@@ -146,11 +154,13 @@ Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
   SMTP<< 550 Not liked
   SMTP>> QUIT
 LOG: MAIN REJECT
-  H=[V4NET.0.0.4] U=root F=<uncheckable@localhost1> rejected after DATA: there is no valid sender in any header line
+  H=[V4NET.0.0.4] U=root F=<uncheckable@localhost1> rejected after DATA: header_sender R:all: there is no valid sender in any header line
 LOG: smtp_connection MAIN
   SMTP connection from root closed by QUIT
 LOG: smtp_connection MAIN
   SMTP connection from root
+LOG: MAIN
+  verify recipient used R:
 Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
   SMTP<< 220 Server ready
   SMTP>> EHLO myhost.test.ex
@@ -167,12 +177,16 @@ Cutthrough cancelled by presence of postmaster verify
   SMTP>> RCPT TO:<postmaster@localhost1>
   SMTP<< 250 OK
   SMTP>> QUIT
+LOG: MAIN
+  verify sender used R:localhost1
 LOG: MAIN REJECT
   H=[V4NET.0.0.5] U=root F=<ok@localhost1> rejected RCPT <z@???>: relay not permitted
 LOG: smtp_connection MAIN
   SMTP connection from root closed by QUIT
 LOG: smtp_connection MAIN
   SMTP connection from root
+LOG: MAIN
+  verify recipient used R:
 Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
   SMTP<< 220 Server ready
   SMTP>> EHLO myhost.test.ex
@@ -192,7 +206,7 @@ Cutthrough cancelled by presence of postmaster verify
 LOG: MAIN REJECT
   H=[V4NET.0.0.5] U=root sender verify fail for <ok@localhost1>: response to "RCPT TO:<postmaster@localhost1>" from 127.0.0.1 [127.0.0.1] was: 550 Don't like postmaster
 LOG: MAIN REJECT
-  H=[V4NET.0.0.5] U=root F=<ok@localhost1> rejected RCPT <z@???>: (postmaster): Sender verify failed
+  H=[V4NET.0.0.5] U=root F=<ok@localhost1> rejected RCPT <z@???>: (postmaster) R:localhost1: Sender verify failed
 LOG: smtp_connection MAIN
   SMTP connection from root closed by QUIT
 LOG: smtp_connection MAIN
@@ -207,7 +221,7 @@ Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
   SMTP<< 550 Recipient not liked
   SMTP>> QUIT
 LOG: MAIN REJECT
-  H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient): response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550 Recipient not liked
+  H=[V4NET.0.0.3] U=root F=<uncheckable@localhost1> rejected RCPT <z@???>: (recipient) R:lmtp: response to "RCPT TO:<z@???>" from 127.0.0.1 [127.0.0.1] was: 550 Recipient not liked
 LOG: smtp_connection MAIN
   SMTP connection from root closed by QUIT
 LOG: smtp_connection MAIN