[exim-cvs] Make transport name available in verify-callouts.…

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Exim Git Commits Mailing List
Dátum:  
Címzett: exim-cvs
Tárgy: [exim-cvs] Make transport name available in verify-callouts. Add verify_mode variable
Gitweb: http://git.exim.org/exim.git/commitdiff/aec45841f9139404fd61122e3db1401b13ebb0a8
Commit:     aec45841f9139404fd61122e3db1401b13ebb0a8
Parent:     774ef2d7d0f7fffbfd114271b8567e36485898dc
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Thu Oct 23 18:18:43 2014 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Sat Oct 25 21:37:59 2014 +0100


    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 e3df085..d3a28a4 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 &<<SECTrouprecon>>& 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 &<<SECTrouprecon>>& 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 9fece77..50a6e49 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 2d34de0..1d3715f 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 623d3f2..ae901d6 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 fb3ea32..1eae4a8 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 c335c34..f4baa0b 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 dba0916..f8e176b 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