Make transport name available in verify-callouts. Add verify_mode variable
authorJeremy Harris <jgh146exb@wizmail.org>
Thu, 23 Oct 2014 17:18:43 +0000 (18:18 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Sat, 25 Oct 2014 20:37:59 +0000 (21:37 +0100)
doc/doc-docbook/spec.xfpt
doc/doc-txt/ChangeLog
doc/doc-txt/experimental-spec.txt
src/src/expand.c
src/src/globals.c
src/src/globals.h
src/src/verify.c

index e3df0854e192b21a691346fcfa7a449053ee5163..d3a28a40aead7ead59b8dfe81ada8ccca5690cfb 100644 (file)
@@ -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.
 
 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.
 .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 &<<SECTrouprecon>>& for a list of the order in which preconditions
 are evaluated.
 or testing recipient verification using &%-bv%&.
 See section &<<SECTrouprecon>>& for a list of the order in which preconditions
 are evaluated.
+See also the &$verify_mode$& variable.
 
 
 .option verify_sender routers&!? boolean true
 
 
 .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 &<<SECTrouprecon>>& for a list of the order in which preconditions
 are evaluated.
 or testing sender verification using &%-bvs%&.
 See section &<<SECTrouprecon>>& for a list of the order in which preconditions
 are evaluated.
+See also the &$verify_mode$& variable.
 .ecindex IIDgenoprou1
 .ecindex IIDgenoprou2
 
 .ecindex IIDgenoprou1
 .ecindex IIDgenoprou2
 
index 9fece77645df6372fb59b52699e3c6eddff80ea0..50a6e49b32256aee9e13c511dd0ac9b63048da86 100644 (file)
@@ -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
 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
 
 
 Exim version 4.84
index 2d34de0f76d2e9a7c5c3f29e30ee90c2e8143070..1d3715f78cda4a9d8d1c8ee89eee9be3a1405aa5 100644 (file)
@@ -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
        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:
 
 
 An example might look like:
index 623d3f224443dcf1fb64a170fd20681f0be3bff8..ae901d63a6e3a69fa2d99d93657bc3c532c6c731 100644 (file)
@@ -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 },
   { "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 },
   { "version_number",      vtype_stringptr,   &version_string },
   { "warn_message_delay",  vtype_stringptr,   &warnmsg_delay },
   { "warn_message_recipient",vtype_stringptr, &warnmsg_recipients },
index fb3ea32a99bee0b52b43a397008a2b6192c03e2b..1eae4a8306e726a915b6aba5eecaad6d3f16b188 100644 (file)
@@ -1448,11 +1448,7 @@ uschar *uucp_from_pattern      = US
 
 uschar *uucp_from_sender       = US"$1";
 
 
 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";
 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 *version_cnumber        = US"????";
 uschar *version_string         = US"?";
 
+uschar *warn_message_file      = NULL;
 int     warning_count          = 0;
 int     warning_count          = 0;
+uschar *warnmsg_delay          = NULL;
+uschar *warnmsg_recipients     = NULL;
+BOOL    write_rejectlog        = TRUE;
+
 
 /*  End of globals.c */
 
 /*  End of globals.c */
index c335c343be4331a3869f93ad177ab7b59054d995..f4baa0bb0d24e46360ec5da05c04a645c81a873e 100644 (file)
@@ -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 *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 */
 extern uschar *version_copyright;      /* Copyright notice */
 extern uschar *version_date;           /* Date of compilation */
 extern uschar *version_cnumber;        /* Compile number */
index dba09164ed3f40ccc16d107d69c7925778bb4e01..f8e176b27e84047506ed2c58b83fbf155181a624 100644 (file)
@@ -468,6 +468,7 @@ else
     deliver_host_address = host->address;
     deliver_host_port = host->port;
     deliver_domain = addr->domain;
     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") ||
 
     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));
       {
       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;
       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)
         /* If accepted, we aren't going to do any further tests below. */
 
         if (random_ok)
-          {
           new_domain_record.random_result = ccache_accept;
           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
 
         /* 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
 #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);
           rc = do_callout(addr, host_list, &tf, callout, callout_overall,
             callout_connect, options, se_mailfrom, pm_mailfrom);
+         verify_mode = NULL;
           }
         }
       else
           }
         }
       else