From aec45841f9139404fd61122e3db1401b13ebb0a8 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Thu, 23 Oct 2014 18:18:43 +0100 Subject: [PATCH] Make transport name available in verify-callouts. Add verify_mode variable --- doc/doc-docbook/spec.xfpt | 9 +++++++++ doc/doc-txt/ChangeLog | 3 ++- doc/doc-txt/experimental-spec.txt | 2 +- src/src/expand.c | 1 + src/src/globals.c | 11 ++++++----- src/src/globals.h | 1 + src/src/verify.c | 6 ++++-- 7 files changed, 24 insertions(+), 9 deletions(-) diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index e3df0854e..d3a28a40a 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -12592,6 +12592,13 @@ This variable contains the result of an expansion lookup, extraction operation, or external command, as described above. It is also used during a &*reduce*& expansion. +.vitem &$verify_mode$& +.vindex "&$verify_mode$&" +While a router or transport is being run in verify mode +or for cutthrough delivery, +contains "S" for sender-verification or "R" for recipient-verification. +Otherwise, empty. + .vitem &$version_number$& .vindex "&$version_number$&" The version number of Exim. @@ -17779,6 +17786,7 @@ delivering in cutthrough mode or testing recipient verification using &%-bv%&. See section &<>& for a list of the order in which preconditions are evaluated. +See also the &$verify_mode$& variable. .option verify_sender routers&!? boolean true @@ -17786,6 +17794,7 @@ If this option is false, the router is skipped when verifying sender addresses or testing sender verification using &%-bvs%&. See section &<>& for a list of the order in which preconditions are evaluated. +See also the &$verify_mode$& variable. .ecindex IIDgenoprou1 .ecindex IIDgenoprou2 diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 9fece7764..50a6e49b3 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -54,7 +54,8 @@ JH/07 Add support for directories of certificates when compiled with a GnuTLS JH/08 Rename the TPDA expermimental facility to Event Actions. The #ifdef is EXPERIMENTAL_EVENT, the main-configuration and transport options both become "event_action", the variables become $event_name, $event_data - and $event_defer_errno. + and $event_defer_errno. There is a new variable $verify_mode, usable in + routers, transports and related events. Exim version 4.84 diff --git a/doc/doc-txt/experimental-spec.txt b/doc/doc-txt/experimental-spec.txt index 2d34de0f7..1d3715f78 100644 --- a/doc/doc-txt/experimental-spec.txt +++ b/doc/doc-txt/experimental-spec.txt @@ -816,7 +816,7 @@ The following variables are likely to be useful depending on the event type: tls_out_peercert lookup_dnssec_authenticated, tls_out_dane sending_ip_address, sending_port - message_exim_id + message_exim_id, verify_mode An example might look like: diff --git a/src/src/expand.c b/src/src/expand.c index 623d3f224..ae901d63a 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -724,6 +724,7 @@ static var_entry var_table[] = { { "tod_zulu", vtype_todzulu, NULL }, { "transport_name", vtype_stringptr, &transport_name }, { "value", vtype_stringptr, &lookup_value }, + { "verify_mode", vtype_stringptr, &verify_mode }, { "version_number", vtype_stringptr, &version_string }, { "warn_message_delay", vtype_stringptr, &warnmsg_delay }, { "warn_message_recipient",vtype_stringptr, &warnmsg_recipients }, diff --git a/src/src/globals.c b/src/src/globals.c index fb3ea32a9..1eae4a830 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1448,11 +1448,7 @@ uschar *uucp_from_pattern = US uschar *uucp_from_sender = US"$1"; -uschar *warn_message_file = NULL; -uschar *warnmsg_delay = NULL; -uschar *warnmsg_recipients = NULL; -BOOL write_rejectlog = TRUE; - +uschar *verify_mode = NULL; uschar *version_copyright = US"Copyright (c) University of Cambridge, 1995 - 2014\n" "(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007 - 2014"; @@ -1460,6 +1456,11 @@ uschar *version_date = US"?"; uschar *version_cnumber = US"????"; uschar *version_string = US"?"; +uschar *warn_message_file = NULL; int warning_count = 0; +uschar *warnmsg_delay = NULL; +uschar *warnmsg_recipients = NULL; +BOOL write_rejectlog = TRUE; + /* End of globals.c */ diff --git a/src/src/globals.h b/src/src/globals.h index c335c343b..f4baa0bb0 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -919,6 +919,7 @@ extern uschar *warnmsg_delay; /* String form of delay time */ extern uschar *warnmsg_recipients; /* Recipients of warning message */ extern BOOL write_rejectlog; /* Control of reject logging */ +extern uschar *verify_mode; /* Running a router in verify mode */ extern uschar *version_copyright; /* Copyright notice */ extern uschar *version_date; /* Date of compilation */ extern uschar *version_cnumber; /* Compile number */ diff --git a/src/src/verify.c b/src/src/verify.c index dba09164e..f8e176b27 100644 --- a/src/src/verify.c +++ b/src/src/verify.c @@ -468,6 +468,7 @@ else deliver_host_address = host->address; deliver_host_port = host->port; deliver_domain = addr->domain; + transport_name = addr->transport->name; if (!smtp_get_interface(tf->interface, host_af, addr, NULL, &interface, US"callout") || @@ -548,6 +549,7 @@ else { addr->message = string_sprintf("could not connect to %s [%s]: %s", host->name, host->address, strerror(errno)); + transport_name = NULL; deliver_host = deliver_host_address = NULL; deliver_domain = save_deliver_domain; continue; @@ -879,9 +881,7 @@ else /* If accepted, we aren't going to do any further tests below. */ if (random_ok) - { new_domain_record.random_result = ccache_accept; - } /* Otherwise, cache a real negative response, and get back to the right state to send RCPT. Unless there's some problem such as a dropped @@ -1852,8 +1852,10 @@ while (addr_new != NULL) #ifdef SUPPORT_TLS deliver_set_expansions(addr); #endif + verify_mode = is_recipient ? US"R" : US"S"; rc = do_callout(addr, host_list, &tf, callout, callout_overall, callout_connect, options, se_mailfrom, pm_mailfrom); + verify_mode = NULL; } } else -- 2.30.2