Make router_name and transport_name usable for the expansions
authorJeremy Harris <jgh146exb@wizmail.org>
Sat, 6 Jul 2013 18:50:45 +0000 (19:50 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Sat, 6 Jul 2013 18:50:45 +0000 (19:50 +0100)
src/src/deliver.c
src/src/transports/smtp.c
test/confs/5700
test/log/5700

index ac120451bd2681baaaf9e09fbd18b9e7a97c9810..29ce056537ca16b693a6fbc755f560b343d63a88 100644 (file)
@@ -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;
index 04bee7fab3d26ccdbfdcb2319d065aca81351379..ac24f5f09ab3a4a0e4b82ec49855f3551cd455b4 100644 (file)
@@ -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
 
index a30098b52d3bc17d79718ff4763e9320d353a9e8..17241660534955601a1495e08baec2ad5238d525 100644 (file)
@@ -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> \
index ee6603733dd65b7d1bc85a61d263027405a0d71f..edfb932b03431d04021cdd2887ae26cdaea1f1c9 100644 (file)
@@ -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 <userx> domain <domain1> 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 <userx> domain <domain1> confirmation <250 OK> errno <0> errstr <> router <others> transport <smtp>
 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 <userx> domain <domain1.com> confirmation <> errno <110> errstr <SMTP timeout while connected to 127.0.0.1 [127.0.0.1] after EHLO the.local.host.name: Connection timed out> router <> transport <smtp>
+1999-03-02 09:44:33 10HmaY-0005vi-00 deferral ip <127.0.0.1> port <1224> fqdn <127.0.0.1> local_part <userx> domain <domain1.com> confirmation <> errno <110> errstr <SMTP timeout while connected to 127.0.0.1 [127.0.0.1] after EHLO the.local.host.name: Connection timed out> router <others> transport <smtp>
 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 <CALLER> domain <the.local.host.name> confirmation <> errno <110> errstr <SMTP timeout while connected to 127.0.0.1 [127.0.0.1] after initial connection: Connection timed out> router <> transport <smtp>
+1999-03-02 09:44:33 10HmaZ-0005vi-00 deferral ip <127.0.0.1> port <1224> fqdn <127.0.0.1> local_part <CALLER> domain <the.local.host.name> confirmation <> errno <110> errstr <SMTP timeout while connected to 127.0.0.1 [127.0.0.1] after initial connection: Connection timed out> router <others> transport <smtp>
 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