summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2012-10-06 23:20:08 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2012-12-25 19:58:32 +0000
commit181d9bf8a602a2573d566427803a4c5288a56008 (patch)
tree1c1effe575f5be7f6a7a8a39f231617367f5de8a /src
parentc3eacdb0bc1ab24331b781dc3f08b075aa52e329 (diff)
Add $router_name and $transport_name variables. Bug 308.
Diffstat (limited to 'src')
-rw-r--r--src/src/deliver.c4
-rw-r--r--src/src/expand.c2
-rw-r--r--src/src/globals.c3
-rw-r--r--src/src/globals.h2
-rw-r--r--src/src/route.c1
5 files changed, 12 insertions, 0 deletions
diff --git a/src/src/deliver.c b/src/src/deliver.c
index 79d431b37..55bfa0dd0 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 c7dc2742c..464c6f6fc 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 616a2350d..43cf73d5b 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 325a9161d..06cbf312b 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 32dbd60ab..f8bacf11b 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. */