Log expansion failures
authorJeremy Harris <jgh146exb@wizmail.org>
Sun, 21 Jul 2013 22:30:27 +0000 (23:30 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Sun, 21 Jul 2013 23:07:42 +0000 (00:07 +0100)
src/src/deliver.c
src/src/expand.c
src/src/transports/smtp.c
test/confs/5700
test/log/5700
test/paniclog/5700 [new file with mode: 0644]
test/scripts/5700-tpt-post-dlv-action/5700
test/stderr/5700 [new file with mode: 0644]
test/stdout/5700

index a3030b5f023068d5b05a655194b107b69bf4fc77..bc6a69fbf5e1ca266b0fda6ce821a93c66344d0f 100644 (file)
@@ -860,7 +860,9 @@ if (addr->transport->tpda_delivery_action)
 
   router_name =    addr->router->name;
   transport_name = addr->transport->name;
-  expand_string(addr->transport->tpda_delivery_action);
+  if (!expand_string(addr->transport->tpda_delivery_action) && *expand_string_message)
+    log_write(0, LOG_MAIN|LOG_PANIC, "failed to expand tpda_deliver_action in %s: %s\n",
+      transport_name, expand_string_message);
   router_name = NULL;
   transport_name = NULL;
   }
index ec60082e1ebbef105e874595f5759c7772a2df2f..ac914707ad1e2a18dc5d22671e9c25bf2f936796 100644 (file)
@@ -1908,7 +1908,7 @@ while (i < nsub)
 DEBUG(D_expand)
   debug_printf("expanding: acl: %s  arg: %s%s\n",
     sub[0],
-    acl_narg>0 ? sub[1]   : US"<none>",
+    acl_narg>0 ? acl_arg[0]   : US"<none>",
     acl_narg>1 ? " +more" : "");
 
 ret = acl_eval(acl_where, sub[0], user_msgp, &tmp);
index d37b2a3dca16eda508db38593a7c4022afafe40b..4d941c51153ac2d93bd9a47ea2f9f4aa764f8987 100644 (file)
@@ -628,7 +628,9 @@ DEBUG(D_transport)
 
 router_name =    addr->router->name;
 transport_name = addr->transport->name;
-expand_string(action);
+if (!expand_string(action) && *expand_string_message)
+  log_write(0, LOG_MAIN|LOG_PANIC, "failed to expand tpda_defer_action in %s: %s\n",
+    transport_name, expand_string_message);
 router_name = transport_name = NULL;
 }
 #endif
index dec90620a0317e70ca21e6ae555131058d666384..52b28018a1964efb32ce632dfaa1d9cc99068c1e 100644 (file)
@@ -19,7 +19,8 @@ acl_smtp_data = accept
 begin acl
 
 logger:
-    accept logwrite = \
+    accept condition = ${if eq {$acl_arg2}{domain1}}
+          logwrite = \
            $acl_arg1 \
            ip <$tpda_delivery_ip> \
            port <$tpda_delivery_port> \
@@ -32,11 +33,17 @@ logger:
            router <$router_name> \
            transport <$transport_name>
 
+    accept logwrite = $this_expansion_will_fail
 
 # ----- Routers -----
 
 begin routers
 
+dump_bounces:
+  driver = redirect
+  senders = :
+  data = :blackhole:
+
 others:
   driver = manualroute
   route_list = * 127.0.0.1 byname
@@ -54,7 +61,7 @@ smtp:
   port = PORT_S
   command_timeout = 1s
   final_timeout = 1s
-  tpda_delivery_action =   ${acl {logger}{delivery}}
-  tpda_host_defer_action = ${acl {logger}{deferral}}
+  tpda_delivery_action =   ${acl {logger} {delivery} {$domain} }
+  tpda_host_defer_action = ${acl {logger} {deferral} {$domain} }
 
 # End
index edfb932b03431d04021cdd2887ae26cdaea1f1c9..d1193657112ab74f0947f0003574afa7949df06a 100644 (file)
@@ -1,19 +1,22 @@
+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 Start queue run: pid=pppp -qqf
+1999-03-02 09:44:33 10HmaY-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 10HmaY-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 10HmaY-0005vi-00 Completed
+1999-03-02 09:44:33 End queue run: pid=pppp -qqf
 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 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 => userx@domain2 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 failed to expand tpda_deliver_action in smtp: error from acl "logger"
+
 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 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 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
+1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@the.local.host.name U=CALLER 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 EHLO the.local.host.name: Connection timed out
+1999-03-02 09:44:33 10HmaZ-0005vi-00 deferral ip <127.0.0.1> port <1224> fqdn <127.0.0.1> local_part <userx> domain <domain1> 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 10HmaZ-0005vi-00 == userx@domain1 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 10HmaZ-0005vi-00 ** userx@domain1: retry timeout exceeded
+1999-03-02 09:44:33 10HmbA-0005vi-00 <= <> R=10HmaZ-0005vi-00 U=EXIMUSER P=local S=sss
+1999-03-02 09:44:33 10HmbA-0005vi-00 => :blackhole: <CALLER@the.local.host.name> R=dump_bounces
+1999-03-02 09:44:33 10HmbA-0005vi-00 Completed
 1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed
-1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
diff --git a/test/paniclog/5700 b/test/paniclog/5700
new file mode 100644 (file)
index 0000000..4f28d19
--- /dev/null
@@ -0,0 +1,2 @@
+1999-03-02 09:44:33 10HmaX-0005vi-00 failed to expand tpda_deliver_action in smtp: error from acl "logger"
+
index dccf02ca563016fd4600fa84540b7c69735e03ae..b85231b6e9073990c09b9451f0244db35d49ed7a 100644 (file)
@@ -1,5 +1,5 @@
 # Arbtirary expansion after transport
-# (EXPERIMENTAL_BDL - database logging)
+# (EXPERIMENTAL_TPDA)
 #
 need_ipv4
 #
@@ -27,13 +27,38 @@ exim -qqf
 #
 #
 #
+#
+exim -odq userx@domain2
+A deliverable message which will hit a coding error in the config
+****
+server PORT_S
+220 ESMTP
+EHLO
+250-OK
+250 HELP
+MAIL
+250 OK
+RCPT
+250 OK
+DATA
+354 More...
+.
+250 OK
+QUIT
+220 OK
+****
+exim -qqf
+****
+#
+#
+#
 server PORT_S
 220 ESMTP
 EHLO
 *sleep 4
 ****
-exim -odi userx@domain1.com
-A message which will hit a timeout
+exim -odi userx@domain1
+A message which will hit a timeout at the destination server
 .
 ****
-
+#
diff --git a/test/stderr/5700 b/test/stderr/5700
new file mode 100644 (file)
index 0000000..4f28d19
--- /dev/null
@@ -0,0 +1,2 @@
+1999-03-02 09:44:33 10HmaX-0005vi-00 failed to expand tpda_deliver_action in smtp: error from acl "logger"
+
index 32c3c89481d259ab2866cacbaa85a7f54cd60622..a45b44c87fa31ee15c83c9f542f785d99e95a2bc 100644 (file)
@@ -14,9 +14,9 @@ DATA
 354 More...
 Received: from CALLER by the.local.host.name with local (Exim x.yz)
        (envelope-from <CALLER@the.local.host.name>)
-       id 10HmaX-0005vi-00
+       id 10HmaY-0005vi-00
        for userx@domain1; Tue, 2 Mar 1999 09:44:33 +0000
-Message-Id: <E10HmaX-0005vi-00@the.local.host.name>
+Message-Id: <E10HmaY-0005vi-00@the.local.host.name>
 From: CALLER_NAME <CALLER@the.local.host.name>
 Date: Tue, 2 Mar 1999 09:44:33 +0000
 
@@ -30,5 +30,31 @@ Listening on port 1224 ...
 Connection request from [127.0.0.1]
 220 ESMTP
 EHLO the.local.host.name
+250-OK
+250 HELP
+MAIL FROM:<CALLER@the.local.host.name>
+250 OK
+RCPT TO:<userx@domain2>
+250 OK
+DATA
+354 More...
+Received: from CALLER by the.local.host.name with local (Exim x.yz)
+       (envelope-from <CALLER@the.local.host.name>)
+       id 10HmaX-0005vi-00
+       for userx@domain2; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaX-0005vi-00@the.local.host.name>
+From: CALLER_NAME <CALLER@the.local.host.name>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+A deliverable message which will hit a coding error in the config
+.
+250 OK
+QUIT
+220 OK
+End of script
+Listening on port 1224 ... 
+Connection request from [127.0.0.1]
+220 ESMTP
+EHLO the.local.host.name
 *sleep 4
 End of script