git://git.exim.org
/
users
/
jgh
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
de41aff
)
Events: add msg:defer Bug 2477
author
Jeremy Harris
<jgh146exb@wizmail.org>
Sat, 14 Dec 2019 23:01:03 +0000
(23:01 +0000)
committer
Jeremy Harris
<jgh146exb@wizmail.org>
Sun, 15 Dec 2019 13:28:47 +0000
(13:28 +0000)
doc/doc-docbook/spec.xfpt
patch
|
blob
|
history
doc/doc-txt/NewStuff
patch
|
blob
|
history
src/src/transports/smtp.c
patch
|
blob
|
history
test/aux-fixed/event-logger-acl
patch
|
blob
|
history
test/runtest
patch
|
blob
|
history
test/scripts/5700-events/5700
patch
|
blob
|
history
diff --git
a/doc/doc-docbook/spec.xfpt
b/doc/doc-docbook/spec.xfpt
index a92ac9151d23cbd822efc895e5ca7d713177e6a7..55ab7f25b9070b15c986b4b40c5d554327abb576 100644
(file)
--- a/
doc/doc-docbook/spec.xfpt
+++ b/
doc/doc-docbook/spec.xfpt
@@
-41059,14
+41059,17
@@
Events have names which correspond to the point in process at which they fire.
The name is placed in the variable &$event_name$& and the event action
expansion must check this, as it will be called for every possible event type.
The name is placed in the variable &$event_name$& and the event action
expansion must check this, as it will be called for every possible event type.
+.new
The current list of events is:
The current list of events is:
+.wen
.display
&`dane:fail after transport `& per connection
&`msg:complete after main `& per message
.display
&`dane:fail after transport `& per connection
&`msg:complete after main `& per message
+&`msg:defer after transport `& per message per delivery try
&`msg:delivery after transport `& per recipient
&`msg:rcpt:host:defer after transport `& per recipient per host
&`msg:rcpt:defer after transport `& per recipient
&`msg:delivery after transport `& per recipient
&`msg:rcpt:host:defer after transport `& per recipient per host
&`msg:rcpt:defer after transport `& per recipient
-&`msg:host:defer after transport `& per
attempt
+&`msg:host:defer after transport `& per
host per delivery try; host errors
&`msg:fail:delivery after transport `& per recipient
&`msg:fail:internal after main `& per recipient
&`tcp:connect before transport `& per connection
&`msg:fail:delivery after transport `& per recipient
&`msg:fail:internal after main `& per recipient
&`tcp:connect before transport `& per connection
@@
-41092,12
+41095,13
@@
An additional variable, &$event_data$&, is filled with information varying
with the event type:
.display
&`dane:fail `& failure reason
with the event type:
.display
&`dane:fail `& failure reason
+&`msg:defer `& error string
&`msg:delivery `& smtp confirmation message
&`msg:fail:internal `& failure reason
&`msg:fail:delivery `& smtp error message
&`msg:delivery `& smtp confirmation message
&`msg:fail:internal `& failure reason
&`msg:fail:delivery `& smtp error message
+&`msg:host:defer `& error string
&`msg:rcpt:host:defer `& error string
&`msg:rcpt:defer `& error string
&`msg:rcpt:host:defer `& error string
&`msg:rcpt:defer `& error string
-&`msg:host:defer `& error string
&`tls:cert `& verification chain depth
&`smtp:connect `& smtp banner
&`smtp:ehlo `& smtp ehlo response
&`tls:cert `& verification chain depth
&`smtp:connect `& smtp banner
&`smtp:ehlo `& smtp ehlo response
diff --git
a/doc/doc-txt/NewStuff
b/doc/doc-txt/NewStuff
index 763a806a579bc37f78c436954d19245772e05ad6..cd380a3f3c567635793ad605eec7d85cd1fcdf5c 100644
(file)
--- a/
doc/doc-txt/NewStuff
+++ b/
doc/doc-txt/NewStuff
@@
-15,6
+15,8
@@
Version 4.94
2. Channel-binding for authenticators is now supported under OpenSSL.
Previously it was GnuTLS-only.
2. Channel-binding for authenticators is now supported under OpenSSL.
Previously it was GnuTLS-only.
+ 3. A msg:defer event.
+
Version 4.93
------------
Version 4.93
------------
diff --git
a/src/src/transports/smtp.c
b/src/src/transports/smtp.c
index 99b793bb50055abb2b232c6be883be1da2a99b52..92723a2c1186067f8d6c6bb18993388d63bf913d 100644
(file)
--- a/
src/src/transports/smtp.c
+++ b/
src/src/transports/smtp.c
@@
-766,12
+766,13
@@
deliver_msglog("%s H=%s [%s] %s\n", tod_stamp(tod_log),
Arguments:
addr the address item containing error information
host the current host
Arguments:
addr the address item containing error information
host the current host
+ evstr the event
Returns: nothing
*/
static void
Returns: nothing
*/
static void
-deferred_event_raise(address_item *
addr, host_item *host
)
+deferred_event_raise(address_item *
addr, host_item * host, uschar * evstr
)
{
uschar * action = addr->transport->event_action;
const uschar * save_domain;
{
uschar * action = addr->transport->event_action;
const uschar * save_domain;
@@
-793,7
+794,7
@@
transport_name = addr->transport->name;
deliver_domain = addr->domain;
deliver_localpart = addr->local_part;
deliver_domain = addr->domain;
deliver_localpart = addr->local_part;
-(void) event_raise(action,
US"msg:host:defer"
,
+(void) event_raise(action,
evstr
,
addr->message
? addr->basic_errno > 0
? string_sprintf("%s: %s", addr->message, strerror(addr->basic_errno))
addr->message
? addr->basic_errno > 0
? string_sprintf("%s: %s", addr->message, strerror(addr->basic_errno))
@@
-5150,7
+5151,7
@@
retry_non_continued:
#ifndef DISABLE_EVENT
if (rc == DEFER)
#ifndef DISABLE_EVENT
if (rc == DEFER)
-
deferred_event_raise(first_addr, host
);
+
deferred_event_raise(first_addr, host, US"msg:host:defer"
);
#endif
/* If STARTTLS was accepted, but there was a failure in setting up the
#endif
/* If STARTTLS was accepted, but there was a failure in setting up the
@@
-5178,11
+5179,18
@@
retry_non_continued:
if (rc == DEFER && first_addr->basic_errno != ERRNO_AUTHFAIL)
write_logs(host, first_addr->message, first_addr->basic_errno);
# ifndef DISABLE_EVENT
if (rc == DEFER && first_addr->basic_errno != ERRNO_AUTHFAIL)
write_logs(host, first_addr->message, first_addr->basic_errno);
# ifndef DISABLE_EVENT
-
if (rc == DEFER)
-
deferred_event_raise(first_addr, host
);
+ if (rc == DEFER)
+
deferred_event_raise(first_addr, host, US"msg:host:defer"
);
# endif
}
#endif /*DISABLE_TLS*/
# endif
}
#endif /*DISABLE_TLS*/
+
+#ifndef DISABLE_EVENT
+ /* If the last host gave a defer raise a per-message event */
+
+ if (!nexthost && (message_defer || rc == DEFER))
+ deferred_event_raise(first_addr, host, US"msg:defer");
+#endif
}
/* Delivery attempt finished */
}
/* Delivery attempt finished */
diff --git
a/test/aux-fixed/event-logger-acl
b/test/aux-fixed/event-logger-acl
index 980d47f1145dd5896ed8af857436a48face3e397..15321724efb62f7fa442ae513186c468a536850c 100644
(file)
--- a/
test/aux-fixed/event-logger-acl
+++ b/
test/aux-fixed/event-logger-acl
@@
-54,6
+54,10
@@
ev_msg:
accept condition = ${if eq {$event_name}{msg:delivery}}
acl = ev_msg_log delivery "confirmation <$event_data>"
accept condition = ${if eq {$event_name}{msg:delivery}}
acl = ev_msg_log delivery "confirmation <$event_data>"
+ accept condition = ${if eq {$event_name}{msg:defer}}
+ acl = ev_msg_log "message deferral" \
+ "errno <$event_defer_errno> errstr <$event_data>"
+
accept condition = ${if eq {$event_name}{msg:host:defer}}
acl = ev_msg_log "host deferral" \
"errno <$event_defer_errno> errstr <$event_data>"
accept condition = ${if eq {$event_name}{msg:host:defer}}
acl = ev_msg_log "host deferral" \
"errno <$event_defer_errno> errstr <$event_data>"
diff --git
a/test/runtest
b/test/runtest
index d678abda6cdc93fef7bcbddebce5af1af53fa998..14601c671eff9135995f7bbd64f9067b5089dff4 100755
(executable)
--- a/
test/runtest
+++ b/
test/runtest
@@
-1830,7
+1830,7
@@
$munges =
},
'timeout_errno' => # actual errno differs Solaris vs. Linux
},
'timeout_errno' => # actual errno differs Solaris vs. Linux
- { 'mainlog' => 's/(
host
deferral .* errno) <\d+> /$1 <EEE> /' },
+ { 'mainlog' => 's/(
(?:host|message)
deferral .* errno) <\d+> /$1 <EEE> /' },
'peer_terminated_conn' => # actual error differs FreedBSD vs. Linux
{ 'stderr' => 's/^( SMTP\()Connection reset by peer(\)<<)$/$1closed$2/' },
'peer_terminated_conn' => # actual error differs FreedBSD vs. Linux
{ 'stderr' => 's/^( SMTP\()Connection reset by peer(\)<<)$/$1closed$2/' },
diff --git
a/test/scripts/5700-events/5700
b/test/scripts/5700-events/5700
index 89b0c5cd59ea1b10d12752ab07916a2efcab7443..c6b6e76ff096b57d8c0e75725dbdb3be5f4282d2 100644
(file)
--- a/
test/scripts/5700-events/5700
+++ b/
test/scripts/5700-events/5700
@@
-102,6
+102,28
@@
QUIT
****
exim -qqf
****
****
exim -qqf
****
+exim -odq userx@domain1
+A message which will get deferred after data
+****
+server PORT_S
+220 ESMTP
+EHLO
+250-OK
+250 HELP
+MAIL
+250 OK
+RCPT
+250 OK
+DATA
+354
+.
+450 post-data problem
+QUIT
+220 OK
+****
+exim -qqf
+****
+#
#
#
#
#
#
#