diff options
author | Jasen Betts <jasen@xnet.co.nz> | 2015-11-10 16:58:33 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2015-11-14 15:59:47 +0000 |
commit | 5ef5dd52d1ded8b0ffdf4708e1d00e4ef458b86a (patch) | |
tree | 4fd7869ff05a48ef7601ae7167be8084eb1a4a9e /src | |
parent | 240c288fabd47aa8daf34c06b77a40fd37add470 (diff) |
Events: add recipient-deferred events, both per-host and all-hosts.
Diffstat (limited to 'src')
-rw-r--r-- | src/src/acl.c | 7 | ||||
-rw-r--r-- | src/src/deliver.c | 12 | ||||
-rw-r--r-- | src/src/functions.h | 1 | ||||
-rw-r--r-- | src/src/transports/smtp.c | 10 |
4 files changed, 26 insertions, 4 deletions
diff --git a/src/src/acl.c b/src/src/acl.c index 064ee6ccb..911ecfed2 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -3743,7 +3743,12 @@ for (; cb != NULL; cb = cb->next) case ACLC_SET: { int old_pool = store_pool; - if (cb->u.varname[0] == 'c') store_pool = POOL_PERM; + if ( cb->u.varname[0] == 'c' +#ifdef EXPERIMENTAL_EVENT + || event_name /* An event is being delivered */ +#endif + ) + store_pool = POOL_PERM; acl_var_create(cb->u.varname)->data.ptr = string_copy(arg); store_pool = old_pool; } diff --git a/src/src/deliver.c b/src/src/deliver.c index e1f4e0e29..65f148c07 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -785,12 +785,14 @@ if (action) return NULL; } -static void +void msg_event_raise(const uschar * event, const address_item * addr) { const uschar * save_domain = deliver_domain; uschar * save_local = deliver_localpart; const uschar * save_host = deliver_host; +const uschar * save_address = deliver_host_address; +const int save_port = deliver_host_port; if (!addr->transport) return; @@ -802,9 +804,13 @@ 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, "lmtp") == 0 - ? addr->message : NULL); + addr->host_used + || Ustrcmp(addr->transport->driver_name, "smtp") == 0 + || Ustrcmp(addr->transport->driver_name, "lmtp") == 0 + ? addr->message : NULL); +deliver_host_port = save_port; +deliver_host_address = save_address; deliver_host = save_host; deliver_localpart = save_local; deliver_domain = save_domain; diff --git a/src/src/functions.h b/src/src/functions.h index 6f6c643b8..e9f7ab658 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -166,6 +166,7 @@ extern void enq_end(uschar *); extern BOOL enq_start(uschar *, unsigned); #ifdef EXPERIMENTAL_EVENT extern uschar *event_raise(uschar *, const uschar *, uschar *); +extern void msg_event_raise(const uschar *, const address_item *); #endif extern void exim_exit(int); extern void exim_nullstd(void); diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 59afe42aa..66d632fad 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -919,12 +919,22 @@ while (count-- > 0) addr->basic_errno = ERRNO_RCPT4XX; addr->more_errno |= ((buffer[1] - '0')*10 + buffer[2] - '0') << 8; +#ifdef EXPERIMENTAL_EVENT + event_defer_errno = addr->more_errno; + msg_event_raise(US"msg:rcpt:host:defer", addr); +#endif + /* Log temporary errors if there are more hosts to be tried. If not, log this last one in the == line. */ if (host->next) log_write(0, LOG_MAIN, "H=%s [%s]: %s", host->name, host->address, addr->message); +#ifdef EXPERIMENTAL_EVENT + else + msg_event_raise(US"msg:rcpt:defer", addr); +#endif + /* Do not put this message on the list of those waiting for specific hosts, as otherwise it is likely to be tried too often. */ |