From: Jeremy Harris Date: Sat, 6 Jul 2013 18:50:45 +0000 (+0100) Subject: Make router_name and transport_name usable for the expansions X-Git-Url: https://git.exim.org/users/jgh/exim.git/commitdiff_plain/993e3ef1b0190835fbb69a537c30990db232b4ae?ds=sidebyside;hp=-c Make router_name and transport_name usable for the expansions --- 993e3ef1b0190835fbb69a537c30990db232b4ae diff --git a/src/src/deliver.c b/src/src/deliver.c index ac120451b..29ce05653 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -841,12 +841,18 @@ store we used to build the line after writing it. */ s[ptr] = 0; log_write(0, flags, "%s", s); #ifdef EXPERIMENTAL_DBL -DEBUG(D_deliver) - { - debug_printf(" DBL(Delivery): dbl_delivery_query=|%s| dbl_delivery_IP=%s\n", dbl_delivery_query, dbl_delivery_ip); - } if (dbl_delivery_ip != NULL && dbl_delivery_query != NULL) + { + DEBUG(D_deliver) + { + debug_printf(" DBL(Delivery): dbl_delivery_query=|%s| dbl_delivery_IP=%s\n", dbl_delivery_query, dbl_delivery_ip); + } + router_name = addr->router->name; + transport_name = addr->transport->name; expand_string(dbl_delivery_query); + router_name = NULL; + transport_name = NULL; + } #endif store_reset(reset_point); return; diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 04bee7fab..ac24f5f09 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -589,7 +589,8 @@ else * Write error message to database log * *************************************************/ -/* This writes to the database log +/* This expands an arbitrary per-transport string. + It might, for example, be used to write to the database log. Arguments: dbl_host_defer_query dbl_host_defer_query from the transport options block @@ -612,19 +613,22 @@ dbl_delivery_local_part = string_copy(addr->local_part); dbl_delivery_domain = string_copy(addr->domain); dbl_defer_errno = addr->basic_errno; -dbl_defer_errstr = NULL; -if (addr->message != NULL) - if (addr->basic_errno > 0) - dbl_defer_errstr = string_sprintf("%s: %s", addr->message, strerror(addr->basic_errno)); - else - dbl_defer_errstr = string_copy(addr->message); -else if (addr->basic_errno > 0) - dbl_defer_errstr = string_copy(strerror(addr->basic_errno)); +dbl_defer_errstr = (addr->message != NULL) + ? (addr->basic_errno > 0) + ? string_sprintf("%s: %s", addr->message, strerror(addr->basic_errno)) + : string_copy(addr->message) + : (addr->basic_errno > 0) + ? string_copy(strerror(addr->basic_errno)) + : NULL; DEBUG(D_transport) { debug_printf(" DBL(host defer): dbl_host_defer_query=|%s| dbl_delivery_IP=%s\n", dbl_host_defer_query, dbl_delivery_ip); } + +router_name = addr->router->name; +transport_name = addr->transport->name; expand_string(dbl_host_defer_query); +router_name = transport_name = NULL; } #endif diff --git a/test/confs/5700 b/test/confs/5700 index a30098b52..172416605 100644 --- a/test/confs/5700 +++ b/test/confs/5700 @@ -23,9 +23,9 @@ begin acl logger: accept logwrite = \ $acl_arg1 \ - delivery_ip <$dbl_delivery_ip> \ - deliver_port <$dbl_delivery_port> \ - delivery_fqdn <$dbl_delivery_fqdn> \ + ip <$dbl_delivery_ip> \ + port <$dbl_delivery_port> \ + fqdn <$dbl_delivery_fqdn> \ local_part <$dbl_delivery_local_part> \ domain <$dbl_delivery_domain> \ confirmation <$dbl_delivery_confirmation> \ diff --git a/test/log/5700 b/test/log/5700 index ee6603733..edfb932b0 100644 --- a/test/log/5700 +++ b/test/log/5700 @@ -1,17 +1,17 @@ 1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@the.local.host.name U=CALLER P=local S=sss 1999-03-02 09:44:33 Start queue run: pid=pppp -qqf 1999-03-02 09:44:33 10HmaX-0005vi-00 => userx@domain1 R=others T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK" -1999-03-02 09:44:33 10HmaX-0005vi-00 delivery delivery_ip <127.0.0.1> deliver_port <1224> delivery_fqdn <127.0.0.1> local_part domain confirmation <250 OK> errno <0> errstr <> router <> transport <> +1999-03-02 09:44:33 10HmaX-0005vi-00 delivery ip <127.0.0.1> port <1224> fqdn <127.0.0.1> local_part domain confirmation <250 OK> errno <0> errstr <> router transport 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed 1999-03-02 09:44:33 End queue run: pid=pppp -qqf 1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@the.local.host.name U=CALLER P=local S=sss 1999-03-02 09:44:33 10HmaY-0005vi-00 SMTP timeout while connected to 127.0.0.1 [127.0.0.1] after EHLO the.local.host.name: Connection timed out -1999-03-02 09:44:33 10HmaY-0005vi-00 deferral delivery_ip <127.0.0.1> deliver_port <1224> delivery_fqdn <127.0.0.1> local_part domain confirmation <> errno <110> errstr router <> transport +1999-03-02 09:44:33 10HmaY-0005vi-00 deferral ip <127.0.0.1> port <1224> fqdn <127.0.0.1> local_part domain confirmation <> errno <110> errstr router transport 1999-03-02 09:44:33 10HmaY-0005vi-00 == userx@domain1.com R=others T=smtp defer (dd): Connection timed out: SMTP timeout while connected to 127.0.0.1 [127.0.0.1] after EHLO the.local.host.name 1999-03-02 09:44:33 10HmaY-0005vi-00 ** userx@domain1.com: retry timeout exceeded 1999-03-02 09:44:33 10HmaZ-0005vi-00 <= <> R=10HmaY-0005vi-00 U=EXIMUSER P=local S=sss 1999-03-02 09:44:33 10HmaZ-0005vi-00 SMTP timeout while connected to 127.0.0.1 [127.0.0.1] after initial connection: Connection timed out -1999-03-02 09:44:33 10HmaZ-0005vi-00 deferral delivery_ip <127.0.0.1> deliver_port <1224> delivery_fqdn <127.0.0.1> local_part domain confirmation <> errno <110> errstr router <> transport +1999-03-02 09:44:33 10HmaZ-0005vi-00 deferral ip <127.0.0.1> port <1224> fqdn <127.0.0.1> local_part domain confirmation <> errno <110> errstr router transport 1999-03-02 09:44:33 10HmaZ-0005vi-00 == CALLER@the.local.host.name R=others T=smtp defer (dd): Connection timed out: SMTP timeout while connected to 127.0.0.1 [127.0.0.1] after initial connection 1999-03-02 09:44:33 10HmaZ-0005vi-00 ** CALLER@the.local.host.name: retry timeout exceeded 1999-03-02 09:44:33 10HmaZ-0005vi-00 CALLER@the.local.host.name: error ignored