summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Kurz <m.kurz@irregular.at>2018-09-28 23:05:02 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2018-09-28 23:18:42 +0100
commit4e9287801772d5aae181a9db0ef1dd1b514b2129 (patch)
tree976a3b004a49751745f202a99a60b9f1747bb049 /src
parentffbc20ed9c9ed09a68ff0a608f623c3c83d521a8 (diff)
Events: Fire msg:fail:internal for a non-system filter "fail" command. Bug 2322
Diffstat (limited to 'src')
-rw-r--r--src/src/deliver.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/src/deliver.c b/src/src/deliver.c
index bba343c55..24c4048f6 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -877,21 +877,33 @@ const uschar * save_host = deliver_host;
const uschar * save_address = deliver_host_address;
const int save_port = deliver_host_port;
-if (!addr->transport)
- return;
-
router_name = addr->router ? addr->router->name : NULL;
-transport_name = addr->transport->name;
deliver_domain = addr->domain;
deliver_localpart = addr->local_part;
deliver_host = addr->host_used ? addr->host_used->name : NULL;
-(void) event_raise(addr->transport->event_action, event,
- addr->host_used
- || Ustrcmp(addr->transport->driver_name, "smtp") == 0
- || Ustrcmp(addr->transport->driver_name, "lmtp") == 0
- || Ustrcmp(addr->transport->driver_name, "autoreply") == 0
- ? addr->message : NULL);
+if (!addr->transport)
+ {
+ if (Ustrcmp(event, "msg:fail:delivery") == 0)
+ {
+ /* An address failed with no transport involved. This happens when
+ a filter was used which triggered a fail command (in such a case
+ a transport isn't needed). Convert it to an internal fail event. */
+
+ (void) event_raise(event_action, US"msg:fail:internal", addr->message);
+ }
+ }
+else
+ {
+ transport_name = addr->transport->name;
+
+ (void) event_raise(addr->transport->event_action, event,
+ addr->host_used
+ || Ustrcmp(addr->transport->driver_name, "smtp") == 0
+ || Ustrcmp(addr->transport->driver_name, "lmtp") == 0
+ || Ustrcmp(addr->transport->driver_name, "autoreply") == 0
+ ? addr->message : NULL);
+ }
deliver_host_port = save_port;
deliver_host_address = save_address;