Copyright updates:
[exim.git] / doc / doc-docbook / spec.xfpt
index da9d616aecc5a98960298b20d5ecd794a059cfdf..73624a7bc59eba10c3ac1e8df8004daf71ea8914 100644 (file)
 . Update the Copyright year (only) when changing content.
 . /////////////////////////////////////////////////////////////////////////////
 
-.set previousversion "4.92"
+.set previousversion "4.93"
 .include ./local_params
 
 .set ACL "access control lists (ACLs)"
 .set I   "    "
 
 .macro copyyear
-2018
+2020
 .endmacro
 
 . /////////////////////////////////////////////////////////////////////////////
@@ -371,11 +371,13 @@ contributors.
 .section "Exim documentation" "SECID1"
 . Keep this example change bar when updating the documentation!
 
+.new
 .cindex "documentation"
 This edition of the Exim specification applies to version &version() of Exim.
 Substantive changes from the &previousversion; edition are marked in some
 renditions of this document; this paragraph is so marked if the rendition is
 capable of showing a change indicator.
+.wen
 
 This document is very much a reference manual; it is not a tutorial. The reader
 is expected to have some familiarity with the SMTP mail transfer protocol and
@@ -1397,16 +1399,21 @@ If the &%domains%& option is set, the domain of the address must be in the set
 of domains that it defines.
 .next
 .vindex "&$local_part_prefix$&"
+.vindex "&$local_part_prefix_v$&"
 .vindex "&$local_part$&"
 .vindex "&$local_part_suffix$&"
+.vindex "&$local_part_suffix_v$&"
 .cindex affix "router precondition"
 If the &%local_parts%& option is set, the local part of the address must be in
 the set of local parts that it defines. If &%local_part_prefix%& or
 &%local_part_suffix%& is in use, the prefix or suffix is removed from the local
 part before this check. If you want to do precondition tests on local parts
 that include affixes, you can do so by using a &%condition%& option (see below)
-that uses the variables &$local_part$&, &$local_part_prefix$&, and
-&$local_part_suffix$& as necessary.
+.new
+that uses the variables &$local_part$&, &$local_part_prefix$&,
+&$local_part_prefix_v$&, &$local_part_suffix$&
+and &$local_part_suffix_v$& as necessary.
+.wen
 .next
 .vindex "&$local_user_uid$&"
 .vindex "&$local_user_gid$&"
@@ -1886,11 +1893,10 @@ to your &_Local/Makefile_& and rebuild Exim.
 .section "Including TLS/SSL encryption support" "SECTinctlsssl"
 .cindex "TLS" "including support for TLS"
 .cindex "encryption" "including support for"
-.cindex "SUPPORT_TLS"
 .cindex "OpenSSL" "building Exim with"
 .cindex "GnuTLS" "building Exim with"
-Exim can be built to support encrypted SMTP connections, using the STARTTLS
-command as per RFC 2487. It can also support legacy clients that expect to
+Exim is usually built to support encrypted SMTP connections, using the STARTTLS
+command as per RFC 2487. It can also support clients that expect to
 start a TLS session immediately on connection to a non-standard port (see the
 &%tls_on_connect_ports%& runtime option and the &%-tls-on-connect%& command
 line option).
@@ -1899,35 +1905,39 @@ If you want to build Exim with TLS support, you must first install either the
 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
 implementing SSL.
 
+If you do not want TLS support you should set
+.code
+DISABLE_TLS=yes
+.endd
+in &_Local/Makefile_&.
+
 If OpenSSL is installed, you should set
 .code
-SUPPORT_TLS=yes
+USE_OPENSL=yes
 TLS_LIBS=-lssl -lcrypto
 .endd
 in &_Local/Makefile_&. You may also need to specify the locations of the
 OpenSSL library and include files. For example:
 .code
-SUPPORT_TLS=yes
+USE_OPENSSL=yes
 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
 TLS_INCLUDE=-I/usr/local/openssl/include/
 .endd
 .cindex "pkg-config" "OpenSSL"
 If you have &'pkg-config'& available, then instead you can just use:
 .code
-SUPPORT_TLS=yes
+USE_OPENSSL=yes
 USE_OPENSSL_PC=openssl
 .endd
 .cindex "USE_GNUTLS"
 If GnuTLS is installed, you should set
 .code
-SUPPORT_TLS=yes
 USE_GNUTLS=yes
 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
 .endd
 in &_Local/Makefile_&, and again you may need to specify the locations of the
 library and include files. For example:
 .code
-SUPPORT_TLS=yes
 USE_GNUTLS=yes
 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
 TLS_INCLUDE=-I/usr/gnu/include
@@ -1935,7 +1945,6 @@ TLS_INCLUDE=-I/usr/gnu/include
 .cindex "pkg-config" "GnuTLS"
 If you have &'pkg-config'& available, then instead you can just use:
 .code
-SUPPORT_TLS=yes
 USE_GNUTLS=yes
 USE_GNUTLS_PC=gnutls
 .endd
@@ -3862,6 +3871,14 @@ This option is not intended for use by external callers. It is used internally
 by Exim in conjunction with the &%-MC%& option. It signifies that the
 remote host supports the ESMTP &_DSN_& extension.
 
+.new
+.vitem &%-MCd%&
+.oindex "&%-MCd%&"
+This option is not intended for use by external callers. It is used internally
+by Exim in conjunction with the &%-d%& option
+to pass on an information string on the purpose of the process.
+.wen
+
 .vitem &%-MCG%&&~<&'queue&~name'&>
 .oindex "&%-MCG%&"
 This option is not intended for use by external callers. It is used internally
@@ -3959,6 +3976,18 @@ is sent to the sender, containing the text &"cancelled by administrator"&.
 Bounce messages are just discarded. This option can be used only by an admin
 user.
 
+.vitem &%-MG%&&~<&'queue&~name'&>&~<&'message&~id'&>&~<&'message&~id'&>&~...
+.oindex "&%-MG%&"
+.cindex queue named
+.cindex "named queues" "moving messages"
+.cindex "queue" "moving messages"
+This option requests that each listed message be moved from its current
+queue to the given named queue.
+The destination queue name argument is required, but can be an empty
+string to define the default queue.
+If the messages are not currently located in the default queue,
+a &%-qG<name>%& option will be required to define the source queue.
+
 .vitem &%-Mmad%&&~<&'message&~id'&>&~<&'message&~id'&>&~...
 .oindex "&%-Mmad%&"
 .cindex "delivery" "cancelling all"
@@ -4169,6 +4198,7 @@ forces queueing.
 .vitem &%-odqs%&
 .oindex "&%-odqs%&"
 .cindex "SMTP" "delaying delivery"
+.cindex "first pass routing"
 This option is a hybrid between &%-odb%&/&%-odi%& and &%-odq%&.
 However, like &%-odb%& and &%-odi%&, this option has no effect if
 &%queue_only_override%& is false and one of the queueing options in the
@@ -4367,6 +4397,17 @@ written. When &%-oX%& is used with &%-bd%&, or when &%-q%& with a time is used
 without &%-bd%&, this is the only way of causing Exim to write a pid file,
 because in those cases, the normal pid file is not used.
 
+.new
+.vitem &%-oPX%&
+.oindex "&%-oPX%&"
+.cindex "pid (process id)" "of daemon"
+.cindex "daemon" "process id (pid)"
+This option is not intended for general use.
+The daemon uses it when terminating due to a SIGTEM, possibly in
+combination with &%-oP%&&~<&'path'&>.
+It causes the pid file to be removed.
+.wen
+
 .vitem &%-or%&&~<&'time'&>
 .oindex "&%-or%&"
 .cindex "timeout" "for non-SMTP input"
@@ -4476,11 +4517,16 @@ appear in the correct order. Each flag is described in a separate item below.
 .cindex "queue" "double scanning"
 .cindex "queue" "routing"
 .cindex "routing" "whole queue before delivery"
+.cindex "first pass routing"
 An option starting with &%-qq%& requests a two-stage queue run. In the first
 stage, the queue is scanned as if the &%queue_smtp_domains%& option matched
 every domain. Addresses are routed, local deliveries happen, but no remote
 transports are run.
 
+.new
+Performance will be best if the &%queue_run_in_order%& option is false.
+.wen
+
 .cindex "hints database" "remembering routing"
 The hints database that remembers which messages are waiting for specific hosts
 is updated, as if delivery to those hosts had been deferred. After this is
@@ -4526,7 +4572,7 @@ for later delivery.
 .vitem &%-q[q][i][f[f]][l][G<name>[/<time>]]]%&
 .oindex "&%-qG%&"
 .cindex queue named
-.cindex "named queues"
+.cindex "named queues" "deliver from"
 .cindex "queue" "delivering specific messages"
 If the &'G'& flag and a name is present, the queue runner operates on the
 queue with the given name rather than the default queue.
@@ -6109,9 +6155,6 @@ dnslookup:
   domains = ! +local_domains
   transport = remote_smtp
   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
-.ifdef _HAVE_DNSSEC
-  dnssec_request_domains = *
-.endif
   no_more
 .endd
 The &%domains%& option behaves as per smarthost, above.
@@ -6262,9 +6305,6 @@ Two remote transports and four local transports are defined.
 remote_smtp:
   driver = smtp
   message_size_limit = ${if > {$max_received_linelength}{998} {1}{0}}
-.ifdef _HAVE_DANE
-  hosts_try_dane = *
-.endif
 .ifdef _HAVE_PRDR
   hosts_try_prdr = *
 .endif
@@ -6272,9 +6312,7 @@ remote_smtp:
 This transport is used for delivering messages over SMTP connections.
 The list of remote hosts comes from the router.
 The &%message_size_limit%& usage is a hack to avoid sending on messages
-with over-long lines.  The built-in macro _HAVE_DANE guards configuration
-to use DANE for delivery;
-see section &<<SECDANE>>& for more details.
+with over-long lines.
 
 The &%hosts_try_prdr%& option enables an efficiency SMTP option.  It is
 negotiated between client and server and not expected to cause problems
@@ -6343,7 +6381,7 @@ All other options are defaulted.
 .code
 local_delivery:
   driver = appendfile
-  file = /var/mail/$local_part
+  file = /var/mail/$local_part_verified
   delivery_date_add
   envelope_to_add
   return_path_add
@@ -6351,7 +6389,17 @@ local_delivery:
 # mode = 0660
 .endd
 This &(appendfile)& transport is used for local delivery to user mailboxes in
-traditional BSD mailbox format. By default it runs under the uid and gid of the
+traditional BSD mailbox format.
+
+.new
+We prefer to avoid using &$local_part$& directly to define the mailbox filename,
+as it is provided by a potential bad actor.
+Instead we use &$local_part_verified$&,
+the result of looking up &$local_part$& in the user database
+(done by using &%check_local_user%& in the the router).
+.wen
+
+By default &(appendfile)& runs under the uid and gid of the
 local user, which requires the sticky bit to be set on the &_/var/mail_&
 directory. Some systems use the alternative approach of running mail deliveries
 under a particular group instead of using the sticky bit. The commented options
@@ -6627,6 +6675,10 @@ Two different types of data lookup are implemented:
 The &'single-key'& type requires the specification of a file in which to look,
 and a single key to search for. The key must be a non-empty string for the
 lookup to succeed. The lookup type determines how the file is searched.
+.new
+.cindex "tainted data" "single-key lookups"
+The file string may not be tainted
+.wen
 .next
 .cindex "query-style lookup" "definition of"
 The &'query-style'& type accepts a generalized database query. No particular
@@ -6665,11 +6717,10 @@ aliases or other indexed data referenced by an MTA. Information about cdb and
 tools for building the files can be found in several places:
 .display
 &url(https://cr.yp.to/cdb.html)
-&url(http://www.corpit.ru/mjt/tinycdb.html)
+&url(https://www.corpit.ru/mjt/tinycdb.html)
 &url(https://packages.debian.org/stable/utils/freecdb)
 &url(https://github.com/philpennock/cdbtools) (in Go)
 .endd
-. --- 2018-09-07: corpit.ru http:-only
 A cdb distribution is not needed in order to build Exim with cdb support,
 because the code for reading cdb files is included directly in Exim itself.
 However, no means of building or testing cdb files is provided with Exim, so
@@ -6719,11 +6770,42 @@ by default, but has an option to omit them (see section &<<SECTdbmbuild>>&).
 .next
 .cindex "lookup" "dsearch"
 .cindex "dsearch lookup type"
-&(dsearch)&: The given file must be a directory; this is searched for an entry
-whose name is the key by calling the &[lstat()]& function. The key may not
-contain any forward slash characters. If &[lstat()]& succeeds, the result of
-the lookup is the name of the entry, which may be a file, directory,
-symbolic link, or any other kind of directory entry. An example of how this
+&(dsearch)&: The given file must be an
+.new
+absolute
+.wen
+directory path; this is searched for an entry
+whose name is the key by calling the &[lstat()]& function.
+The key may not
+contain any forward slash characters.
+If &[lstat()]& succeeds then so does the lookup.
+.new
+.cindex "tainted data" "dsearch result"
+The result is regarded as untainted.
+
+Options for the lookup can be given by appending them after the word "dsearch",
+separated by a comma.  Options, if present, are a comma-separated list having
+each element starting with a tag name and an equals.
+
+Two options are supported, for the return value and for filtering match
+candidates.
+The "ret" option requests an alternate result value of
+the entire path for the entry. Example:
+.code
+${lookup {passwd} dsearch,ret=full {/etc}}
+.endd
+The default result is just the requested entry.
+The "filter" option requests that only directory entries of a given type
+are matched. The match value is one of "file", "dir" or "subdir" (the latter
+not matching "." or ".."). Example:
+.code
+${lookup {passwd} dsearch,filter=file {/etc}}
+.endd
+The default matching is for any entry type, including directories
+and symlinks.
+.wen
+
+An example of how this
 lookup can be used to support virtual domains is given in section
 &<<SECTvirtualdomains>>&.
 .next
@@ -6754,13 +6836,10 @@ lookup types support only literal keys.
 the implicit key is the host's IP address rather than its name (see section
 &<<SECThoslispatsikey>>&).
 
-.new
 &*Warning 3*&: Do not use an IPv4-mapped IPv6 address for a key; use the
 IPv4, in dotted-quad form. (Exim converts IPv4-mapped IPv6 addresses to this
 notation before executing the lookup.)
-.wen
 .next
-.new
 .cindex lookup json
 .cindex json "lookup type"
 .cindex JSON expansions
@@ -6777,7 +6856,6 @@ The final resulting element can be a simple JSON type or a JSON object
 or array; for the latter two a string-representation os the JSON
 is returned.
 For elements of type string, the returned value is de-quoted.
-.wen
 .next
 .cindex "linear search"
 .cindex "lookup" "lsearch"
@@ -6972,7 +7050,11 @@ passed to a Redis database. See section &<<SECTsql>>&.
 .next
 .cindex "sqlite lookup type"
 .cindex "lookup" "sqlite"
-&(sqlite)&: The format of the query is a filename followed by an SQL statement
+&(sqlite)&: The format of the query is
+new
+an optional filename
+.wen
+followed by an SQL statement
 that is passed to an SQLite database. See section &<<SECTsqlite>>&.
 
 .next
@@ -7879,6 +7961,11 @@ If any MySQL, PostgreSQL, Oracle, InterBase or Redis lookups are used, the
 or &%redis_servers%&
 option (as appropriate) must be set to a colon-separated list of server
 information.
+.oindex &%mysql_servers%&
+.oindex &%pgsql_servers%&
+.oindex &%oracle_servers%&
+.oindex &%ibase_servers%&
+.oindex &%redis_servers%&
 (For MySQL and PostgreSQL, the global option need not be set if all
 queries contain their own server information &-- see section
 &<<SECTspeserque>>&.)
@@ -7929,12 +8016,14 @@ The &%quote_redis%& expansion operator
 escapes whitespace and backslash characters with a backslash.
 
 .section "Specifying the server in the query" "SECTspeserque"
+.new
 For MySQL, PostgreSQL and Redis lookups (but not currently for Oracle and InterBase),
 it is possible to specify a list of servers with an individual query. This is
-done by starting the query with
+done by appending a comma-separated option to the query type:
 .display
-&`servers=`&&'server1:server2:server3:...'&&`;`&
 .endd
+&`,servers=`&&'server1:server2:server3:...'&
+.wen
 Each item in the list may take one of two forms:
 .olist
 If it contains no slashes it is assumed to be just a host name. The appropriate
@@ -7959,14 +8048,25 @@ mysql_servers = slave1/db/name/pw:\
 .endd
 In an updating lookup, you could then write:
 .code
-${lookup mysql{servers=master; UPDATE ...} }
+${lookup mysql,servers=master {UPDATE ...} }
 .endd
 That query would then be sent only to the master server. If, on the other hand,
 the master is not to be used for reading, and so is not present in the global
 option, you can still update it by a query of this form:
 .code
-${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
+${lookup pgsql,servers=master/db/name/pw {UPDATE ...} }
+.endd
+
+.new
+An older syntax places the servers speciification before the qury,
+semicolon separated:
+.code
+${lookup mysql{servers=master; UPDATE ...} }
 .endd
+The new version avoids potential issues with tainted
+arguments in the query, for explicit expansion.
+&*Note*&: server specifications in list-style lookups are still problematic.
+.wen
 
 
 .section "Special MySQL features" "SECID73"
@@ -8016,19 +8116,35 @@ affected.
 .cindex "sqlite lookup type"
 SQLite is different to the other SQL lookups because a filename is required in
 addition to the SQL query. An SQLite database is a single file, and there is no
-daemon as in the other SQL databases. The interface to Exim requires the name
-of the file, as an absolute path, to be given at the start of the query. It is
-separated from the query by white space. This means that the path name cannot
-contain white space. Here is a lookup expansion example:
+daemon as in the other SQL databases.
+
+.new
+.oindex &%sqlite_dbfile%&
+The preferred way of specifying the file is by using the
+&%sqlite_dbfile%& option, set to
+an absolute path.
+.wen
+A deprecated method is available, prefixing the query with the filename
+separated by white space.
+This means that the path name cannot contain white space.
+.cindex "tainted data" "sqlite file"
+It also means that the query cannot use any tainted values, as that taints
+the entire query including the filename - resulting in a refusal to open
+the file.
+
+.new
+Here is a lookup expansion example:
 .code
-${lookup sqlite {/some/thing/sqlitedb \
-  select name from aliases where id='userx';}}
+sqlite_dbfile = /some/thing/sqlitedb
+...
+${lookup sqlite {select name from aliases where id='userx';}}
 .endd
 In a list, the syntax is similar. For example:
 .code
-domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \
+domainlist relay_to_domains = sqlite;\
    select * from relays where ip='$sender_host_address';
 .endd
+.wen
 The only character affected by the &%quote_sqlite%& operator is a single
 quote, which it doubles.
 
@@ -8276,6 +8392,19 @@ domainlist  dom2 = !a.b : *.b
 where &'x.y'& does not match. It's best to avoid negation altogether in
 referenced lists if you can.
 
+.new
+.cindex "hiding named list values"
+.cindex "named lists" "hiding value of"
+Some named list definitions may contain sensitive data, for example, passwords for
+accessing databases. To stop non-admin users from using the &%-bP%& command
+line option to read these values, you can precede the definition with the
+word &"hide"&. For example:
+.code
+hide domainlist filter_for_domains = ldap;PASS=secret ldap::/// ...
+.endd
+.wen
+
+
 Named lists may have a performance advantage. When Exim is routing an
 address or checking an incoming message, it caches the result of tests on named
 lists. So, if you have a setting such as
@@ -8503,6 +8632,14 @@ whether or not the query succeeds. However, when a lookup is used for the
 &%domains%& option on a router, the data is preserved in the &$domain_data$&
 variable and can be referred to in other options.
 .next
+.new
+If the pattern starts with the name of a lookup type
+of either kind (single-key or query-style) it may be
+followed by a command and options,
+The options are lookup-type specific and consist of a comma-separated list.
+Each item starts with a tag and and equals "=".
+.wen
+.next
 .cindex "domain list" "matching literal domain name"
 If none of the above cases apply, a caseless textual comparison is made
 between the pattern and the domain.
@@ -8697,11 +8834,9 @@ recently implemented &(iplsearch)& files do require colons in IPv6 keys
 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
 For this reason, when the lookup type is &(iplsearch)&, IPv6 addresses are
 converted using colons and not dots.
-.new
 In all cases except IPv4-mapped IPv6, full, unabbreviated IPv6
 addresses are always used.
 The latter are converted to IPv4 addresses, in dotted-quad form.
-.wen
 
 Ideally, it would be nice to tidy up this anomalous situation by changing to
 colons in all cases, given that quoting is now available for &(lsearch)&.
@@ -9222,12 +9357,10 @@ options for which string expansion is performed are marked with &dagger; after
 the data type.  ACL rules always expand strings.  A couple of expansion
 conditions do not expand some of the brace-delimited branches, for security
 reasons,
-.new
 .cindex "tainted data" expansion
 .cindex expansion "tainted data"
 and expansion of data deriving from the sender (&"tainted data"&)
 is not permitted.
-.wen
 
 
 
@@ -9474,9 +9607,13 @@ set in &_Local/Makefile_&. Once loaded, Exim remembers the dynamically loaded
 object so that it doesn't reload the same object file in the same Exim process
 (but of course Exim does start new processes frequently).
 
-There may be from zero to eight arguments to the function. When compiling
-a local function that is to be called in this way, &_local_scan.h_& should be
-included. The Exim variables and functions that are defined by that API
+There may be from zero to eight arguments to the function.
+
+When compiling
+a local function that is to be called in this way,
+first &_DLFUNC_IMPL_& should be defined,
+and second &_local_scan.h_& should be included.
+The Exim variables and functions that are defined by that API
 are also available for dynamically loaded functions. The function itself
 must have the following type:
 .code
@@ -9585,10 +9722,8 @@ Matching of the key against the member names is done case-sensitively.
 For the &"json"& variant,
 if a returned value is a JSON string, it retains its leading and
 trailing quotes.
-.new
 For the &"jsons"& variant, which is intended for use with JSON strings, the
 leading and trailing quotes are removed from the returned value.
-.wen
 . XXX should be a UTF-8 compare
 
 The results of matching are handled as above.
@@ -9639,10 +9774,8 @@ there is no choice of field separator.
 For the &"json"& variant,
 if a returned value is a JSON string, it retains its leading and
 trailing quotes.
-.new
 For the &"jsons"& variant, which is intended for use with JSON strings, the
 leading and trailing quotes are removed from the returned value.
-.wen
 
 
 .vitem &*${filter{*&<&'string'&>&*}{*&<&'condition'&>&*}}*&
@@ -9699,7 +9832,7 @@ letters appear. For example:
        "&*$bheader_*&<&'header&~name'&>&*:*&&~or&~&&&
         &*$bh_*&<&'header&~name'&>&*:*&" &&&
        "&*$lheader_*&<&'header&~name'&>&*:*&&~or&~&&&
-        &*$lh_*&<&'header&~name'&>&*:*&"
+        &*$lh_*&<&'header&~name'&>&*:*&" &&&
        "&*$rheader_*&<&'header&~name'&>&*:*&&~or&~&&&
         &*$rh_*&<&'header&~name'&>&*:*&"
 .cindex "expansion" "header insertion"
@@ -9805,6 +9938,12 @@ newline at the very end. For the &%header%& and &%bheader%& expansion, for
 those headers that contain lists of addresses, a comma is also inserted at the
 junctions between headers. This does not happen for the &%rheader%& expansion.
 
+.new
+.cindex "tainted data"
+When the headers are from an incoming message,
+the result of expanding any of these variables is tainted.
+.wen
+
 
 .vitem &*${hmac{*&<&'hashname'&>&*}{*&<&'secret'&>&*}{*&<&'string'&>&*}}*&
 .cindex "expansion" "hmac hashing"
@@ -10146,21 +10285,37 @@ ${readsocket{/socket/name}{request string}{3s}}
 .endd
 
 The third argument is a list of options, of which the first element is the timeout
-and must be present if the argument is given.
+and must be present if any options are given.
 Further elements are options of form &'name=value'&.
-Two option types is currently recognised: shutdown and tls.
-The first defines whether (the default)
-or not a shutdown is done on the connection after sending the request.
-Example, to not do so (preferred, eg. by some webservers):
+Example:
 .code
 ${readsocket{/socket/name}{request string}{3s:shutdown=no}}
 .endd
-The second, tls, controls the use of TLS on the connection.  Example:
-.code
-${readsocket{/socket/name}{request string}{3s:tls=yes}}
-.endd
-The default is to not use TLS.
+
+.new
+The following option names are recognised:
+.ilist
+&*cache*&
+Defines if the result data can be cached for use by a later identical
+request in the same process.
+Values are &"yes"& or &"no"& (the default).
+If not, all cached results for this connection specification
+will be invalidated.
+
+.next
+&*shutdown*&
+Defines whether or not a write-shutdown is done on the connection after
+sending the request. Values are &"yes"& (the default) or &"no"&
+(preferred, eg. by some webservers).
+
+.next
+&*tls*&
+Controls the use of TLS on the connection.
+Values are &"yes"& or &"no"& (the default).
 If it is enabled, a shutdown as descripbed above is never done.
+.endlist
+.wen
+
 
 A fourth argument allows you to change any newlines that are in the data
 that is read, in the same way as for &%readfile%& (see above). This example
@@ -10989,14 +11144,12 @@ it as a 64-digit hexadecimal number, in which any letters are in upper case.
 If the string is a single variable of type certificate,
 returns the SHA-256 hash fingerprint of the certificate.
 
-.new
 The operator can also be spelled &%sha2%& and does the same as &%sha256%&
 (except for certificates, which are not supported).
 Finally, if an underbar
 and a number is appended it specifies the output length, selecting a
 member of the SHA-2 family of hash functions.
 Values of 256, 384 and 512 are accepted, with 256 being the default.
-.wen
 
 
 .vitem &*${sha3:*&<&'string'&>&*}*& &&&
@@ -11383,7 +11536,6 @@ being processed, to enable these expansion items to be nested.
 
 To scan a named list, expand it with the &*listnamed*& operator.
 
-.new
 .vitem "&*forall_json{*&<&'a JSON array'&>&*}{*&<&'a condition'&>&*}*&" &&&
        "&*forany_json{*&<&'a JSON array'&>&*}{*&<&'a condition'&>&*}*&" &&&
        "&*forall_jsons{*&<&'a JSON array'&>&*}{*&<&'a condition'&>&*}*&" &&&
@@ -11399,7 +11551,6 @@ be a JSON array.
 The array separator is not changeable.
 For the &"jsons"& variants the elements are expected to be JSON strings
 and have their quotes removed before the evaluation of the condition.
-.wen
 
 
 
@@ -12079,14 +12230,12 @@ contain the trailing slash. If &$config_file$& does not contain a slash,
 .vindex "&$config_file$&"
 The name of the main configuration file Exim is using.
 
-.new
 .vitem &$dmarc_domain_policy$& &&&
        &$dmarc_status$& &&&
        &$dmarc_status_text$& &&&
        &$dmarc_used_domains$&
 Results of DMARC verification.
 For details see section &<<SECDMARC>>&.
-.wen
 
 .vitem &$dkim_verify_status$&
 Results of DKIM verification.
@@ -12188,6 +12337,13 @@ When the &%smtp_etrn_command%& option is being expanded, &$domain$& contains
 the complete argument of the ETRN command (see section &<<SECTETRN>>&).
 .endlist
 
+.new
+.cindex "tainted data"
+If the origin of the data is an incoming message,
+the result of expanding this variable is tainted.
+See also &$domain_verified$&.
+.wen
+
 
 .vitem &$domain_data$&
 .vindex "&$domain_data$&"
@@ -12381,13 +12537,39 @@ Global address rewriting happens when a message is received, so the value of
 because a message may have many recipients and the system filter is called just
 once.
 
+.new
+.cindex "tainted data"
+If the origin of the data is an incoming message,
+the result of expanding this variable is tainted.
+
+&*Warning*&: the content of this variable is usually provided by a potential
+attacker.
+Consider carefully the implications of using it unvalidated as a name
+for file access.
+This presents issues for users' &_.forward_& and filter files.
+For traditional full user accounts, use &%check_local_users%& and the
+&$local_part_verified$& variable rather than this one.
+For virtual users, store a suitable pathname component in the database
+which is used for account name validation, and use that retrieved value
+rather than this variable.
+If needed, use a router &%address_data%& or &%set%& option for
+the retrieved data.
+.wen
+
 .vindex "&$local_part_prefix$&"
+.vindex "&$local_part_prefix_v$&"
 .vindex "&$local_part_suffix$&"
+.vindex "&$local_part_suffix_v$&"
 .cindex affix variables
 If a local part prefix or suffix has been recognized, it is not included in the
 value of &$local_part$& during routing and subsequent delivery. The values of
 any prefix or suffix are in &$local_part_prefix$& and
 &$local_part_suffix$&, respectively.
+.new
+If the affix specification included a wildcard then the portion of
+the affix matched by the wildcard is in
+&$local_part_prefix_v$& or &$local_part_suffix_v$& as appropriate.
+.wen
 
 When a message is being delivered to a file, pipe, or autoreply transport as a
 result of aliasing or forwarding, &$local_part$& is set to the local part of
@@ -12441,12 +12623,34 @@ When an address is being routed or delivered, and a
 specific prefix for the local part was recognized, it is available in this
 variable, having been removed from &$local_part$&.
 
+.new
+.vitem &$local_part_prefix_v$&
+.vindex "&$local_part_prefix_v$&"
+When &$local_part_prefix$& is valid and the prefix match used a wildcard,
+the portion matching the wildcard is available in this variable.
+.wen
+
 .vitem &$local_part_suffix$&
 .vindex "&$local_part_suffix$&"
 When an address is being routed or delivered, and a
 specific suffix for the local part was recognized, it is available in this
 variable, having been removed from &$local_part$&.
 
+.new
+.vitem &$local_part_suffix_v$&
+.vindex "&$local_part_suffix_v$&"
+When &$local_part_suffix$& is valid and the suffix match used a wildcard,
+the portion matching the wildcard is available in this variable.
+.wen
+
+.new
+.vitem &$local_part_verified$&
+.vindex "&$local_part_verified$&"
+If the router generic option &%check_local_part%& has run successfully,
+this variable has the user database version of &$local_part$&.
+Such values are not tainted and hence usable for building file names.
+.wen
+
 .vitem &$local_scan_data$&
 .vindex "&$local_scan_data$&"
 This variable contains the text returned by the &[local_scan()]& function when
@@ -12777,11 +12981,17 @@ or if not set, the value of &$qualify_domain$&.
 
 .vitem &$queue_name$&
 .vindex &$queue_name$&
-.cindex "named queues"
+.cindex "named queues" variable
 .cindex queues named
 The name of the spool queue in use; empty for the default queue.
 
-.new
+.vitem &$queue_size$&
+.vindex "&$queue_size$&"
+.cindex "queue" "size of"
+.cindex "spool" "number of messages"
+This variable contains the number of messages queued.
+It is evaluated on demand, but no more often than once every minute.
+
 .vitem &$r_...$&
 .vindex &$r_...$&
 .cindex router variables
@@ -12789,7 +12999,6 @@ Values can be placed in these variables by the &%set%& option of a router.
 They can be given any name that starts with &$r_$&.
 The values persist for the address being handled through subsequent routers
 and the eventual transport.
-.wen
 
 .vitem &$rcpt_count$&
 .vindex "&$rcpt_count$&"
@@ -13097,6 +13306,18 @@ library, by setting:
 dns_dnssec_ok = 1
 .endd
 
+.new
+In addition, on Linux with glibc 2.31 or newer the resolver library will
+default to stripping out a successful validation status.
+This will break a previously working Exim installation.
+Provided that you do trust the resolver (ie, is on localhost) you can tell
+glibc to pass through any successful validation with a new option in
+&_/etc/resolv.conf_&:
+.code
+options trust-ad
+.endd
+.wen
+
 Exim does not perform DNSSEC validation itself, instead leaving that to a
 validating resolver (e.g. unbound, or bind with suitable configuration).
 
@@ -13353,6 +13574,7 @@ or a &%def%& condition.
 &*Note*&: Under versions of OpenSSL preceding 1.1.1,
 when a list of more than one
 file is used for &%tls_certificate%&, this variable is not reliable.
+The macro "_TLS_BAD_MULTICERT_IN_OURCERT" will be defined for those versions.
 
 .vitem &$tls_in_peercert$&
 .vindex "&$tls_in_peercert$&"
@@ -13409,11 +13631,9 @@ The deprecated &$tls_cipher$& variable is the same as &$tls_in_cipher$& during m
 but in the context of an outward SMTP delivery taking place via the &(smtp)& transport
 becomes the same as &$tls_out_cipher$&.
 
-.new
 .vitem &$tls_in_cipher_std$&
 .vindex "&$tls_in_cipher_std$&"
 As above, but returning the RFC standard name for the cipher suite.
-.wen
 
 .vitem &$tls_out_cipher$&
 .vindex "&$tls_out_cipher$&"
@@ -13423,11 +13643,9 @@ and then set to the outgoing cipher suite if one is negotiated. See chapter
 &<<CHAPTLS>>& for details of TLS support and chapter &<<CHAPsmtptrans>>& for
 details of the &(smtp)& transport.
 
-,new
 .vitem &$tls_out_cipher_std$&
 .vindex "&$tls_out_cipher_std$&"
 As above, but returning the RFC standard name for the cipher suite.
-.wen
 
 .vitem &$tls_out_dane$&
 .vindex &$tls_out_dane$&
@@ -13502,6 +13720,17 @@ the transport.
 .vindex &$tls_out_tlsa_usage$&
 Bitfield of TLSA record types found.  See section &<<SECDANE>>&.
 
+.vitem &$tls_in_ver$&
+.vindex "&$tls_in_ver$&"
+When a message is received from a remote host over an encrypted SMTP connection
+this variable is set to the protocol version, eg &'TLS1.2'&.
+
+.vitem &$tls_out_ver$&
+.vindex "&$tls_out_ver$&"
+When a message is being delivered to a remote host over an encrypted SMTP connection
+this variable is set to the protocol version.
+
+
 .vitem &$tod_bsdinbox$&
 .vindex "&$tod_bsdinbox$&"
 The time of day and the date, in the format required for BSD-style mailbox
@@ -14197,6 +14426,7 @@ listed in more than one group.
 .row &%daemon_startup_sleep%&        "time to sleep between tries"
 .row &%extra_local_interfaces%&      "not necessarily listened on"
 .row &%local_interfaces%&            "on which to listen, with optional ports"
+.row &%notifier_socket%&             "override compiled-in value"
 .row &%pid_file_path%&               "override compiled-in value"
 .row &%queue_run_max%&               "maximum simultaneous queue runners"
 .endtable
@@ -14360,6 +14590,7 @@ See also the &'Policy controls'& section above.
 .table2
 .row &%dkim_verify_hashes%&          "DKIM hash methods accepted for signatures"
 .row &%dkim_verify_keytypes%&        "DKIM key types accepted for signatures"
+.row &%dkim_verify_min_keysizes%&    "DKIM key sizes accepted for signatures"
 .row &%dkim_verify_signers%&         "DKIM domains for which DKIM ACL is run"
 .row &%host_lookup%&                 "host name looked up for these hosts"
 .row &%host_lookup_order%&           "order of DNS and local name lookups"
@@ -14646,8 +14877,10 @@ received. See chapter &<<CHAPACL>>& for further details.
 
 .option add_environment main "string list" empty
 .cindex "environment" "set values"
-This option allows to set individual environment variables that the
-currently linked libraries and programs in child processes use.
+This option adds individual environment variables that the
+currently linked libraries and programs in child processes may use.
+Each list element should be of the form &"name=value"&.
+
 See &<<SECTpipeenv>>& for the environment of &(pipe)& transports.
 
 .option admin_groups main "string list&!!" unset
@@ -14698,11 +14931,9 @@ If it is set true, Exim's domain parsing function allows valid
 UTF-8 multicharacters to appear in domain name components, in addition to
 letters, digits, and hyphens.
 
-.new
 If Exim is built with internationalization support
 and the SMTPUTF8 ESMTP option is in use (see chapter &<<CHAPi18n>>&)
 this option can be left as default.
-.wen
 Without that,
 if you want to look up such domain names in the DNS, you must also
 adjust the value of &%dns_check_names_pattern%& to match the extended form. A
@@ -15113,25 +15344,40 @@ to handle IPv6 literal addresses.
 
 
 .new
-.option dkim_verify_hashes main "string list" "sha256 : sha512 : sha1"
+.option dkim_verify_hashes main "string list" "sha256 : sha512"
 .cindex DKIM "selecting signature algorithms"
 This option gives a list of hash types which are acceptable in signatures,
+.wen
 and an order of processing.
 Signatures with algorithms not in the list will be ignored.
 
-Note that the presence of sha1 violates RFC 8301.
-Signatures using the rsa-sha1 are however (as of writing) still common.
-The default inclusion of sha1 may be dropped in a future release.
+Acceptable values include:
+.code
+sha1
+sha256
+sha512
+.endd
+
+Note that the acceptance of sha1 violates RFC 8301.
 
 .option dkim_verify_keytypes main "string list" "ed25519 : rsa"
 This option gives a list of key types which are acceptable in signatures,
 and an order of processing.
 Signatures with algorithms not in the list will be ignored.
 
+
+.new
+.option dkim_verify_min_keysizes main "string list" "rsa=1024 ed25519=250"
+This option gives a list of key sizes which are acceptable in signatures.
+The list is keyed by the algorithm type for the key; the values are in bits.
+Signatures with keys smaller than given by this option will fail verification.
+
+The default enforces the RFC 8301 minimum key size for RSA signatures.
+.wen
+
 .option dkim_verify_minimal main boolean false
 If set to true, verification of signatures will terminate after the
 first success.
-.wen
 
 .option dkim_verify_signers main "domain list&!!" $dkim_signers
 .cindex DKIM "controlling calls to the ACL"
@@ -15211,6 +15457,18 @@ default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
 
 If the resolver library does not support DNSSEC then this option has no effect.
 
+.new
+On Linux with glibc 2.31 or newer this is insufficient, the resolver library
+will default to stripping out a successful validation status.
+This will break a previously working Exim installation.
+Provided that you do trust the resolver (ie, is on localhost) you can tell
+glibc to pass through any successful validation with a new option in
+&_/etc/resolv.conf_&:
+.code
+options trust-ad
+.endd
+.wen
+
 
 .option dns_ipv4_lookup main "domain list&!!" unset
 .cindex "IPv6" "DNS lookup for AAAA records"
@@ -15224,11 +15482,9 @@ domain matches this list.
 This is a fudge to help with name servers that give big delays or otherwise do
 not work for the AAAA record type. In due course, when the world's name
 servers have all been upgraded, there should be no need for this option.
-.new
 Note that all lookups, including those done for verification, are affected;
 this will result in verify failure for IPv6 connections or ones using names
 only valid for IPv6 addresses.
-.wen
 
 
 .option dns_retrans main time 0s
@@ -15435,8 +15691,8 @@ used. See chapter &<<CHAPsecurity>>& for a discussion of security issues.
 .cindex "Exim version"
 .cindex customizing "version number"
 .cindex "version number of Exim" override
-This option allows to override the &$version_number$&/&$exim_version$& Exim reports in
-various places.  Use with care, this may fool stupid security scanners.
+This option overrides the &$version_number$&/&$exim_version$& that Exim reports in
+various places.  Use with care; this may fool stupid security scanners.
 
 
 .option extra_local_interfaces main "string list" unset
@@ -16059,10 +16315,8 @@ when Exim is entered, so it can, for example, contain a reference to the host
 name. If no specific path is set for the log files at compile or runtime,
 or if the option is unset at runtime (i.e.  &`log_file_path = `&)
 they are written in a sub-directory called &_log_& in Exim's spool directory.
-.new
 A path must start with a slash.
 To send to syslog, use the word &"syslog"&.
-.wen
 Chapter &<<CHAPlog>>& contains further details about Exim's logging, and
 section &<<SECTwhelogwri>>& describes how the contents of &%log_file_path%& are
 used. If this string is fixed at your installation (contains no expansion
@@ -16269,7 +16523,25 @@ harm. This option overrides the &%pipe_as_creator%& option of the &(pipe)&
 transport driver.
 
 
-.option openssl_options main "string list" "+no_sslv2 +no_sslv3 +single_dh_use +no_ticket"
+.new
+.option notifier_socket main string "$spool_directory/exim_daemon_notify"
+This option gives the name for a unix-domain socket on which the daemon
+listens for work and information-requests.
+Only installations running multiple daemons sharing a spool directory
+should need to modify the default.
+
+The option is expanded before use.
+If the platform supports Linux-style abstract socket names, the result
+is used with a nul byte prefixed.
+Otherwise, it should be a full path name and use a directory accessible
+to Exim.
+
+If the Exim command line uses a &%-oX%& option and does not use &%-oP%&
+then a notifier socket is not created.
+.wen
+
+
+.option openssl_options main "string list" "+no_sslv2 +no_sslv3 +single_dh_use +no_ticket +no_renegotiation"
 .cindex "OpenSSL "compatibility options"
 This option allows an administrator to adjust the SSL options applied
 by OpenSSL to connections.  It is given as a space-separated list of items,
@@ -16410,9 +16682,9 @@ interpreter. See chapter &<<CHAPperl>>& for details of its use.
 This option is available only when Exim is built with an embedded Perl
 interpreter. See chapter &<<CHAPperl>>& for details of its use.
 
-.option perl_startup main boolean false
+.option perl_taintmode main boolean false
 .cindex "Perl"
-This Option enables the taint mode of the embedded Perl interpreter.
+This option enables the taint mode of the embedded Perl interpreter.
 
 
 .option pgsql_servers main "string list" unset
@@ -16449,7 +16721,6 @@ for each SMTP command and response. When PIPELINING is advertised, Exim assumes
 that clients will use it; &"out of order"& commands that are &"expected"& do
 not count as protocol errors (see &%smtp_max_synprot_errors%&).
 
-.new
 .option pipelining_connect_advertise_hosts main "host list&!!" *
 .cindex "pipelining" "early connection"
 .cindex "pipelining" PIPE_CONNECT
@@ -16462,7 +16733,6 @@ When used, the pipelining saves on roundtrip times.
 See also the &%hosts_pipe_connect%& smtp transport option.
 
 Currently the option name &"X_PIPE_CONNECT"& is used.
-.wen
 
 
 .option prdr_enable main boolean false
@@ -16687,13 +16957,14 @@ run. If you do not want queue runs to occur, omit the &%-q%&&'xx'& setting on
 the daemon's command line.
 
 .cindex queues named
-.cindex "named queues"
+.cindex "named queues" "resource limit"
 To set limits for different named queues use
 an expansion depending on the &$queue_name$& variable.
 
 .option queue_smtp_domains main "domain list&!!" unset
 .cindex "queueing incoming messages"
 .cindex "message" "queueing remote deliveries"
+.cindex "first pass routing"
 When this option is set, a delivery process is started whenever a message is
 received, routing is performed, and local deliveries take place.
 However, if any SMTP deliveries are required for domains that match
@@ -16725,7 +16996,6 @@ used. If the expansion yields an empty string, no &'Received:'& header line is
 added to the message. Otherwise, the string should start with the text
 &"Received:"& and conform to the RFC 2822 specification for &'Received:'&
 header lines.
-.new
 The default setting is:
 
 .code
@@ -16736,6 +17006,7 @@ received_header_text = Received: \
         ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
   by $primary_hostname \
   ${if def:received_protocol {with $received_protocol }}\
+  ${if def:tls_in_ver        { ($tls_in_ver)}}\
   ${if def:tls_in_cipher_std { tls $tls_in_cipher_std\n\t}}\
   (Exim $version_number)\n\t\
   ${if def:sender_address \
@@ -16743,9 +17014,9 @@ received_header_text = Received: \
   id $message_exim_id\
   ${if def:received_for {\n\tfor $received_for}}
 .endd
-.wen
 
-The reference to the TLS cipher is omitted when Exim is built without TLS
+The references to the TLS version and cipher are
+omitted when Exim is built without TLS
 support. The use of conditional expansions ensures that this works for both
 locally generated messages and messages received from remote hosts, giving
 header lines such as the following:
@@ -16922,12 +17193,6 @@ it qualifies them only if the message came from a host that matches
 &%sender_unqualified_hosts%&, or if the message was submitted locally (not
 using TCP/IP), and the &%-bnq%& option was not set.
 
-.option add_environment main "string list" empty
-.cindex "environment"
-This option allows to add individual environment variables that the
-currently linked libraries and programs in child processes use. The
-default list is empty.
-
 
 .option slow_lookup_log main integer 0
 .cindex "logging" "slow lookups"
@@ -17202,6 +17467,13 @@ example:
 smtp_etrn_command = /etc/etrn_command $domain \
                     $sender_host_address
 .endd
+.new
+If the option is not set, the argument for the ETRN command must
+be a &'#'& followed by an address string.
+In this case an &'exim -R <string>'& command is used;
+if the ETRN ACL has set up a named-queue then &'-MCG <queue>'& is appended.
+.wen
+
 A new process is created to run the command, but Exim does not wait for it to
 complete. Consequently, its status cannot be checked. If the command cannot be
 run, a line is written to the panic log, but the ETRN caller still receives
@@ -17685,9 +17957,7 @@ separator in the usual way (&<<SECTlistsepchange>>&) to avoid confusion under IP
 &*Note*&: Under versions of OpenSSL preceding 1.1.1,
 when a list of more than one
 file is used, the &$tls_in_ourcert$& variable is unreliable.
-
-&*Note*&: OCSP stapling is not usable under OpenSSL
-when a list of more than one file is used.
+The macro "_TLS_BAD_MULTICERT_IN_OURCERT" will be defined for those versions.
 
 If the option contains &$tls_out_sni$& and Exim is built against OpenSSL, then
 if the OpenSSL build supports TLS extensions and the TLS client sends the
@@ -17738,10 +18008,8 @@ larger prime than requested.
 The value of this option is expanded and indicates the source of DH parameters
 to be used by Exim.
 
-.new
 This option is ignored for GnuTLS version 3.6.0 and later.
 The library manages parameter negotiation internally.
-.wen
 
 &*Note: The Exim Maintainers strongly recommend,
 for other TLS library versions,
@@ -17840,15 +18108,14 @@ status proof for the server's certificate, as obtained from the
 Certificate Authority.
 
 Usable for GnuTLS 3.4.4 or 3.3.17 or OpenSSL 1.1.0 (or later).
+The macro "_HAVE_TLS_OCSP" will be defined for those versions.
 
-.new
 For OpenSSL 1.1.0 or later, and
-.wen
 for GnuTLS 3.5.6 or later the expanded value of this option can be a list
 of files, to match a list given for the &%tls_certificate%& option.
 The ordering of the two lists must match.
+The macro "_HAVE_TLS_OCSP_LIST" will be defined for those versions.
 
-.new
 The file(s) should be in DER format,
 except for GnuTLS 3.6.3 or later
 or for OpenSSL,
@@ -17864,7 +18131,6 @@ Although GnuTLS will accept PEM files with multiple separate
 PEM blobs (ie. separate OCSP responses), it sends them in the
 TLS Certificate record interleaved with the certificates of the chain;
 although a GnuTLS client is happy with that, an OpenSSL client is not.
-.wen
 
 .option tls_on_connect_ports main "string list" unset
 .cindex SSMTP
@@ -18173,9 +18439,7 @@ file = ${extract{mailbox}{$address_data}}
 This makes the configuration file less messy, and also reduces the number of
 lookups (though Exim does cache lookups).
 
-.new
 See also the &%set%& option below.
-.wen
 
 .vindex "&$sender_address_data$&"
 .vindex "&$address_data$&"
@@ -18590,15 +18854,19 @@ avoided. The &%repeat_use%& option of the &%redirect%& router may be of help.
 This option specifies a list of text headers,
 colon-separated (by default, changeable in the usual way &<<SECTlistsepchange>>&),
 that is associated with any addresses that are accepted by the router.
-Each item is separately expanded, at routing time.  However, this
-option has no effect when an address is just being verified. The way in which
+However, the option has no effect when an address is just being verified.
+Each list item is separately expanded, at transport time.
+.new
+If an item ends in *, it will match any header with the given prefix.
+.wen
+The way in which
 the text is used to remove header lines at transport time is described in
 section &<<SECTheadersaddrem>>&. Header lines are not actually removed until
 the message is in the process of being transported. This means that references
 to header lines in string expansions in the transport's configuration still
 &"see"& the original header lines.
 
-The &%headers_remove%& option is expanded after &%errors_to%& and
+The &%headers_remove%& option is handled after &%errors_to%& and
 &%headers_add%&, but before &%transport%&. If an item expansion is forced to fail,
 the item has no effect. Other expansion failures are treated as configuration
 errors.
@@ -18703,6 +18971,12 @@ command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
 This behaviour can be overridden by setting &%rcpt_include_affixes%& true on
 the relevant transport.
 
+.new
+.vindex &$local_part_prefix_v$&
+If wildcarding (above) was used then the part of the prefix matching the
+wildcard is available in &$local_part_prefix_v$&.
+.wen
+
 When an address is being verified, &%local_part_prefix%& affects only the
 behaviour of the router. If the callout feature of verification is in use, this
 means that the full address, including the prefix, will be used during the
@@ -18958,7 +19232,6 @@ latter kind.
 
 This option controls whether the local part is used to form the key for retry
 hints for addresses that suffer temporary errors while being handled by this
-.new
 router. The default value is true for any router that has any of
 &%check_local_user%&,
 &%local_parts%&,
@@ -18967,7 +19240,6 @@ router. The default value is true for any router that has any of
 &%local_part_suffix%&,
 &%senders%& or
 &%require_files%&
-.wen
 set, and false otherwise. Note that this option does not apply to hints keys
 for transport delays; they are controlled by a generic transport option of the
 same name.
@@ -19104,7 +19376,6 @@ SMTP VRFY command is enabled, it must be used after MAIL if the sender address
 matters.
 
 
-.new
 .option set routers "string list" unset
 .cindex router variables
 This option may be used multiple times on a router;
@@ -19112,7 +19383,7 @@ because of this the list aspect is mostly irrelevant.
 The list separator is a semicolon but can be changed in the
 usual way.
 
-Each list-element given must be of the form $"name = value"$
+Each list-element given must be of the form &"name = value"&
 and the names used must start with the string &"r_"&.
 Values containing a list-separator should have them doubled.
 When a router runs, the strings are evaluated in order,
@@ -19123,11 +19394,10 @@ The variables can be used by the router options
 (not including any preconditions)
 and by the transport.
 Later definitions of a given named variable will override former ones.
-Varible use is via the usual &$r_...$& syntax.
+Variable use is via the usual &$r_...$& syntax.
 
 This is similar to the &%address_data%& option, except that
 many independent variables can be used, with choice of naming.
-.wen
 
 
 .option translate_ip_address routers string&!! unset
@@ -20045,8 +20315,10 @@ semicolon is the default route list separator.
 
 
 .section "Format of one host item" "SECTformatonehostitem"
-Each item in the list of hosts is either a host name or an IP address,
-optionally with an attached port number. When no port is given, an IP address
+Each item in the list of hosts can be either a host name or an IP address,
+optionally with an attached port number, or it can be a single "+"
+(see &%hosts_randomize%&).
+When no port is given, an IP address
 is not enclosed in brackets. When a port is specified, it overrides the port
 specification on the transport. The port is separated from the name or address
 by a colon. This leads to some complications:
@@ -20538,6 +20810,19 @@ is not the case when the file contains syntactically valid items that happen to
 yield empty addresses, for example, items containing only RFC 2822 address
 comments.
 
+.new
+.cindex "tainted data" "in filenames"
+.cindex redirect "tainted data"
+Tainted data may not be used for a filename.
+
+&*Warning*&: It is unwise to use &$local_part$& or &$domain$&
+directly for redirection,
+as they are provided by a potential attacker.
+In the examples above, &$local_part$& is used for looking up data held locally
+on the system, and not used directly (the second example derives &$home$& via
+the passsword file or database, using &$local_part$&).
+.wen
+
 
 
 .section "Forward files and address verification" "SECID125"
@@ -20763,6 +21048,11 @@ It must be given as
 .code
 list1:   :include:/opt/lists/list1
 .endd
+.new
+.cindex "tainted data" "in filenames"
+.cindex redirect "tainted data"
+Tainted data may not be used for a filename.
+.wen
 .next
 .cindex "address redirection" "to black hole"
 .cindex "delivery" "discard"
@@ -21763,15 +22053,21 @@ checked, since this option does not automatically suppress them.
 .option headers_remove transports list&!! unset
 .cindex "header lines" "removing"
 .cindex "transport" "header lines; removing"
-This option specifies a list of header names,
-colon-separated (by default, changeable in the usual way &<<SECTlistsepchange>>&);
-these headers are omitted from the message as it is transported, as described
-in section &<<SECTheadersaddrem>>&. Header removal can also be specified by
-routers.
+This option specifies a list of text headers,
+colon-separated (by default, changeable in the usual way &<<SECTlistsepchange>>&),
+to be removed from the message.
+However, the option has no effect when an address is just being verified.
 Each list item is separately expanded.
 If the result of the expansion is an empty string, or if the expansion
 is forced to fail, no action is taken. Other expansion failures are treated as
 errors and cause the delivery to be deferred.
+.new
+If an item ends in *, it will match any header with the given prefix.
+.wen
+
+Matching headers are omitted from the message as it is transported, as described
+in section &<<SECTheadersaddrem>>&. Header removal can also be specified by
+routers.
 
 Unlike most options, &%headers_remove%& can be specified multiple times
 for a transport; all listed headers are removed.
@@ -22322,6 +22618,14 @@ If &%file%& or &%directory%& is set for a delivery from a redirection, it is
 used to determine the file or directory name for the delivery. Normally, the
 contents of &$address_file$& are used in some way in the string expansion.
 .endlist
+.new
+.cindex "tainted data" "in filenames"
+.cindex appendfile "tainted data"
+Tainted data may not be used for a file or directory name.
+This means that, for instance, &$local_part$& cannot be used directly
+as a component of a path.  It can however be used as the key for a lookup
+which returns a path (or component).
+.wen
 
 
 .cindex "Sieve filter" "configuring &(appendfile)&"
@@ -22910,14 +23214,12 @@ sometimes add other information onto the ends of message filenames.
 
 Section &<<SECID136>>& contains further information.
 
-.new
 This option should not be used when other message-handling software
 may duplicate messages by making hardlinks to the files.  When that is done Exim
 will count the message size once for each filename, in contrast with the actual
 disk usage.  When the option is not set, calculating total usage requires
 a system-call per file to get the size; the number of links is then available also
 as is used to adjust the effective size.
-.wen
 
 
 .option quota_warn_message appendfile string&!! "see below"
@@ -23761,6 +24063,12 @@ directories are also controllable. See chapter &<<CHAPenvironment>>& for
 details of the local delivery environment and chapter &<<CHAPbatching>>&
 for a discussion of local delivery batching.
 
+.new
+.cindex "tainted data" "in pipe command"
+.cindex pipe "tainted data"
+Tainted data may not be used for the command name.
+.wen
+
 
 .section "Concurrent delivery" "SECID140"
 If two messages arrive at almost the same time, and both are routed to a pipe
@@ -24736,7 +25044,6 @@ facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
 Exim will not use the SMTP PIPELINING extension when delivering to any host
 that matches this list, even if the server host advertises PIPELINING support.
 
-.new
 .option hosts_pipe_connect smtp "host list&!!" unset
 .cindex "pipelining" "early connection"
 .cindex "pipelining" PIPE_CONNECT
@@ -24760,7 +25067,6 @@ A check is made for the use of that variable, without the
 presence of a &"def:"& test on it, but suitably complex coding
 can avoid the check and produce unexpected results.
 You have been warned.
-.wen
 
 
 .option hosts_avoid_tls smtp "host list&!!" unset
@@ -24801,7 +25107,6 @@ been started will not be passed to a new delivery process for sending another
 message on the same connection. See section &<<SECTmulmessam>>& for an
 explanation of when this might be needed.
 
-.new
 .option hosts_noproxy_tls smtp "host list&!!" unset
 .cindex "TLS" "passing connection"
 .cindex "multiple SMTP deliveries"
@@ -24809,7 +25114,6 @@ explanation of when this might be needed.
 For any host that matches this list, a TLS session which has
 been started will not be passed to a new delivery process for sending another
 message on the same session.
-.wen
 
 The traditional implementation closes down TLS and re-starts it in the new
 process, on the same open TCP connection, for each successive message
@@ -24904,6 +25208,9 @@ unauthenticated. See also &%hosts_require_auth%&, and chapter
 .cindex "RFC 3030" "CHUNKING"
 This option provides a list of servers to which, provided they announce
 CHUNKING support, Exim will attempt to use BDAT commands rather than DATA.
+.new
+Unless DKIM signing is being done,
+.wen
 BDAT will not be used in conjunction with a transport filter.
 
 .option hosts_try_dane smtp "host list&!!" *
@@ -26460,10 +26767,8 @@ authentication mechanism (RFC 2195), and the second provides an interface to
 the Cyrus SASL authentication library.
 The third is an interface to Dovecot's authentication system, delegating the
 work via a socket interface.
-.new
 The fourth provides for negotiation of authentication done via non-SMTP means,
 as defined by RFC 4422 Appendix A.
-.wen
 The fifth provides an interface to the GNU SASL authentication library, which
 provides mechanisms but typically not data sources.
 The sixth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
@@ -26888,7 +27193,19 @@ security risk; you are strongly advised to insist on the use of SMTP encryption
 use unencrypted plain text, you should not use the same passwords for SMTP
 connections as you do for login accounts.
 
-.section "Plaintext options" "SECID171"
+.section "Avoiding cleartext use" "SECTplain_TLS"
+The following generic option settings will disable &(plaintext)& authenticators when
+TLS is not being used:
+.code
+  server_advertise_condition = ${if def:tls_in_cipher }
+  client_condition =           ${if def:tls_out_cipher}
+.endd
+
+&*Note*&: a plaintext SMTP AUTH done inside TLS is not vulnerable to casual snooping,
+but is still vulnerable to a Man In The Middle attack unless certificates
+(including their names) have been properly verified.
+
+.section "Plaintext server options" "SECID171"
 .cindex "options" "&(plaintext)& authenticator (server)"
 When configured as a server, &(plaintext)& uses the following options:
 
@@ -26896,7 +27213,7 @@ When configured as a server, &(plaintext)& uses the following options:
 This is actually a global authentication option, but it must be set in order to
 configure the &(plaintext)& driver as a server. Its use is described below.
 
-.option server_prompts plaintext string&!! unset
+.option server_prompts plaintext "string list&!!" unset
 The contents of this option, after expansion, must be a colon-separated list of
 prompt strings. If expansion fails, a temporary authentication rejection is
 given.
@@ -26945,7 +27262,7 @@ There are good and bad examples at the end of the next section.
 
 .section "The PLAIN authentication mechanism" "SECID172"
 .cindex "PLAIN authentication mechanism"
-.cindex "authentication" "PLAIN mechanism"
+.cindex authentication PLAIN
 .cindex "binary zero" "in &(plaintext)& authenticator"
 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
 sent as one item of data (that is, one combined string containing two NUL
@@ -27027,7 +27344,7 @@ writing the test makes the logic clearer.
 
 .section "The LOGIN authentication mechanism" "SECID173"
 .cindex "LOGIN authentication mechanism"
-.cindex "authentication" "LOGIN mechanism"
+.cindex authentication LOGIN
 The LOGIN authentication mechanism is not documented in any RFC, but is in use
 in a number of programs. No data is sent with the AUTH command. Instead, a
 user name and password are supplied separately, in response to prompts. The
@@ -27148,7 +27465,7 @@ prompts.
 .scindex IIDcramauth1 "&(cram_md5)& authenticator"
 .scindex IIDcramauth2 "authenticators" "&(cram_md5)&"
 .cindex "CRAM-MD5 authentication mechanism"
-.cindex "authentication" "CRAM-MD5 mechanism"
+.cindex authentication CRAM-MD5
 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
 sends a challenge string to the client, and the response consists of a user
 name and the CRAM-MD5 digest of the challenge string combined with a secret
@@ -27366,7 +27683,7 @@ but it is present in many binary distributions.
 .scindex IIDdcotauth1 "&(dovecot)& authenticator"
 .scindex IIDdcotauth2 "authenticators" "&(dovecot)&"
 This authenticator is an interface to the authentication facility of the
-Dovecot POP/IMAP server, which can support a number of authentication methods.
+Dovecot POP/IMAP server, which can support a number of authentication methods.
 Note that Dovecot must be configured to use auth-client not auth-userdb.
 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
 to use the same mechanisms for SMTP authentication. This is a server
@@ -27397,6 +27714,29 @@ option is passed in the Dovecot authentication command. If, for a TLS
 connection, a client certificate has been verified, the &"valid-client-cert"&
 option is passed. When authentication succeeds, the identity of the user
 who authenticated is placed in &$auth1$&.
+
+.new
+The Dovecot configuration to match the above wil look
+something like:
+.code
+conf.d/10-master.conf :-
+
+service auth {
+...
+#SASL
+  unix_listener auth-client {
+    mode = 0660
+    user = mail
+  }
+...
+}
+
+conf.d/10-auth.conf :-
+
+auth_mechanisms = plain login ntlm
+.endd
+.wen
+
 .ecindex IIDdcotauth1
 .ecindex IIDdcotauth2
 
@@ -27414,20 +27754,56 @@ who authenticated is placed in &$auth1$&.
 .cindex "authentication" "LOGIN"
 .cindex "authentication" "DIGEST-MD5"
 .cindex "authentication" "CRAM-MD5"
-.cindex "authentication" "SCRAM-SHA-1"
-The &(gsasl)& authenticator provides server integration for the GNU SASL
+.cindex "authentication" "SCRAM family"
+The &(gsasl)& authenticator provides integration for the GNU SASL
 library and the mechanisms it provides.  This is new as of the 4.80 release
 and there are a few areas where the library does not let Exim smoothly
 scale to handle future authentication mechanisms, so no guarantee can be
 made that any particular new authentication mechanism will be supported
 without code changes in Exim.
 
-Exim's &(gsasl)& authenticator does not have client-side support at this
-time; only the server-side support is implemented.  Patches welcome.
+.new
+The library is expected to add support in an upcoming
+realease for the SCRAM-SHA-256 method.
+The macro _HAVE_AUTH_GSASL_SCRAM_SHA_256 will be defined
+when this happens.
+
+
+.option client_authz gsasl string&!! unset
+This option can be used to supply an &'authorization id'&
+which is different to the &'authentication_id'& provided
+by &%client_username%& option.
+If unset or (after expansion) empty it is not used,
+which is the common case.
+
+.option client_channelbinding gsasl boolean false
+See &%server_channelbinding%& below.
+
+.option client_password gsasl string&!! unset
+This option is exapanded before use, and should result in
+the password to be used, in clear.
+
+.option client_username gsasl string&!! unset
+This option is exapanded before use, and should result in
+the account name to be used.
+.wen
+
+.new
+.option client_spassword gsasl string&!! unset
+If a SCRAM mechanism is being used and this option is set
+it is used in preference to &%client_password%&.
+The value after expansion should be
+a 40 (for SHA-1) or 64 (for SHA-256) character string
+with the PBKDF2-prepared password, hex-encoded.
+Note that this value will depend on the salt and iteration-count
+supplied by the server.
+.wen
+
 
 
 .option server_channelbinding gsasl boolean false
-Do not set this true without consulting a cryptographic engineer.
+Do not set this true and rely on the properties
+without consulting a cryptographic engineer.
 
 Some authentication mechanisms are able to use external context at both ends
 of the session to bind the authentication to that context, and fail the
@@ -27439,15 +27815,18 @@ This should have meant that certificate identity and verification becomes a
 non-issue, as a man-in-the-middle attack will cause the correct client and
 server to see different identifiers and authentication will fail.
 
-This is currently only supported when using the GnuTLS library.  This is
+.new
+This is
 only usable by mechanisms which support "channel binding"; at time of
 writing, that's the SCRAM family.
+When using this feature the "-PLUS" variants of the method names need to be used.
+.wen
 
 This defaults off to ensure smooth upgrade across Exim releases, in case
 this option causes some clients to start failing.  Some future release
 of Exim might have switched the default to be true.
 
-However, Channel Binding in TLS has proven to be broken in current versions.
+However, Channel Binding in TLS has proven to be vulnerable in current versions.
 Do not plan to rely upon this feature for security, ever, without consulting
 with a subject matter expert (a cryptographic engineer).
 
@@ -27495,16 +27874,60 @@ This specifies the SASL realm that the server claims to be in.
 Some mechanisms will use this data.
 
 
-.option server_scram_iter gsasl string&!! unset
+.option server_scram_iter gsasl string&!! 4096
 This option provides data for the SCRAM family of mechanisms.
-&$auth1$& is not available at evaluation time.
-(This may change, as we receive feedback on use)
-
+.new
+The &$auth1$&, &$auth2$& and &$auth3$& variables are available
+when this option is expanded.
+
+The result of expansion should be a decimal number,
+and represents both a lower-bound on the security, and
+a compute cost factor imposed on the client
+(if it does not cache results, or the server changes
+either the iteration count or the salt).
+A minimum value of 4096 is required by the standards
+for all current SCRAM mechanism variants.
+.wen
 
 .option server_scram_salt gsasl string&!! unset
 This option provides data for the SCRAM family of mechanisms.
-&$auth1$& is not available at evaluation time.
-(This may change, as we receive feedback on use)
+.new
+The &$auth1$&, &$auth2$& and &$auth3$& variables are available
+when this option is expanded.
+The value should be a base64-encoded string,
+of random data typically 4-to-16 bytes long.
+If unset or empty after expansion the library will provides a value for the
+protocol conversation.
+.wen
+
+
+.new
+.option server_key gsasl string&!! unset
+.option server_skey gsasl string&!! unset
+These options can be used for the SCRAM family of mechanisms
+to provide stored information related to a password,
+the storage of which is preferable to plaintext.
+
+&%server_key%& is the value defined in the SCRAM standards as ServerKey;
+&%server_skey%& is StoredKey.
+
+They are only available for version 1.9.0 (or later) of the gsasl library.
+When this is so, the macros
+_OPT_AUTHENTICATOR_GSASL_SERVER_KEY
+and _HAVE_AUTH_GSASL_SCRAM_S_KEY
+will be defined.
+
+The &$authN$& variables are available when these options are expanded.
+
+If set, the results of expansion should for each
+should be a 28 (for SHA-1) or 44 (for SHA-256) character string
+of base64-coded data, and will be used in preference to the
+&%server_password%& option.
+If unset or not of the right length, &%server_password%& will be used.
+
+The libgsasl library release includes a utility &'gsasl'& which can be used
+to generate these values.
+.wen
 
 
 .option server_service gsasl string &`smtp`&
@@ -27812,11 +28235,10 @@ of your configured trust-anchors
 (which usually means the full set of public CAs)
 and which has a mail-SAN matching the claimed identity sent by the client.
 
-Note that, up to TLS1.2, the client cert is on the wire in-clear, including the SAN,
+&*Note*&: up to TLS1.2, the client cert is on the wire in-clear, including the SAN.
 The account name is therefore guessable by an opponent.
 TLS 1.3 protects both server and client certificates, and is not vulnerable
 in this way.
-Likewise, a traditional plaintext SMTP AUTH done inside TLS is not.
 
 
 .section "Using external in a client" "SECTexternclient"
@@ -28029,16 +28451,19 @@ There is also a &%-tls-on-connect%& command line option. This overrides
 
 .section "OpenSSL vs GnuTLS" "SECTopenvsgnu"
 .cindex "TLS" "OpenSSL &'vs'& GnuTLS"
-The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
-followed later, when the first versions of GnuTLS were released. To build Exim
-to use GnuTLS, you need to set
+TLS is supported in Exim using either the OpenSSL or GnuTLS library.
+To build Exim to use OpenSSL you need to set
 .code
-USE_GNUTLS=yes
+USE_OPENSSL=yes
 .endd
-in Local/Makefile, in addition to
+in Local/Makefile.
+
+To build Exim to use GnuTLS, you need to set
 .code
-SUPPORT_TLS=yes
+USE_GNUTLS=yes
 .endd
+in Local/Makefile.
+
 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
 include files and libraries for GnuTLS can be found.
 
@@ -28596,12 +29021,10 @@ transport provide the client with a certificate, which is passed to the server
 if it requests it. If the server is Exim, it will request a certificate only if
 &%tls_verify_hosts%& or &%tls_try_verify_hosts%& matches the client.
 
-.new
-Do not use a certificate which has the OCSP-must-staple extension,
+&*Note*&: Do not use a certificate which has the OCSP-must-staple extension,
 for client use (they are usable for server use).
-As TLS has no means for the client to staple before TLS 1.3 it will result
+As the TLS protocol has no means for the client to staple before TLS 1.3 it will result
 in failed connections.
-.wen
 
 If the &%tls_verify_certificates%& option is set on the &(smtp)& transport, it
 specifies a collection of expected server certificates.
@@ -29023,7 +29446,7 @@ those who use &%hosts_require_ocsp%&, should consider the interaction with DANE
 
 For client-side DANE there are three new smtp transport options, &%hosts_try_dane%&, &%hosts_require_dane%&
 and &%dane_require_tls_ciphers%&.
-The require variant will result in failure if the target host is not
+The &"require"& variant will result in failure if the target host is not
 DNSSEC-secured. To get DNSSEC-secured hostname resolution, use
 the &%dnssec_request_domains%& router or transport option.
 
@@ -29056,7 +29479,7 @@ If DANE is not usable, whether requested or not, and CA-anchored
 verification evaluation is wanted, the above variables should be set appropriately.
 
 The router and transport option &%dnssec_request_domains%& must not be
-set to "never" and &%dnssec_require_domains%& is ignored.
+set to &"never"&, and &%dnssec_require_domains%& is ignored.
 
 If verification was successful using DANE then the "CV" item in the delivery log line will show as "CV=dane".
 
@@ -29936,7 +30359,7 @@ in several different ways. For example:
 It can be at the end of an &%accept%& statement:
 .code
     accept  ...some conditions
-            control = queue_only
+            control = queue
 .endd
 In this case, the control is applied when this statement yields &"accept"&, in
 other words, when the conditions are all true.
@@ -29945,7 +30368,7 @@ other words, when the conditions are all true.
 It can be in the middle of an &%accept%& statement:
 .code
     accept  ...some conditions...
-            control = queue_only
+            control = queue
             ...some more conditions...
 .endd
 If the first set of conditions are true, the control is applied, even if the
@@ -30375,6 +30798,13 @@ This control turns off DKIM verification processing entirely.  For details on
 the operation and configuration of DKIM, see section &<<SECDKIM>>&.
 
 
+.vitem &*control&~=&~dmarc_disable_verify*&
+.cindex "disable DMARC verify"
+.cindex "DMARC" "disable verify"
+This control turns off DMARC verification processing entirely.  For details on
+the operation and configuration of DMARC, see section &<<SECDMARC>>&.
+
+
 .vitem &*control&~=&~dscp/*&<&'value'&>
 .cindex "&ACL;" "setting DSCP value"
 .cindex "DSCP" "inbound"
@@ -30509,16 +30939,32 @@ response to an EHLO command. Therefore, it should normally appear in an ACL
 controlled by &%acl_smtp_connect%& or &%acl_smtp_helo%&. See also
 &%pipelining_advertise_hosts%&.
 
-.vitem &*control&~=&~queue_only*&
+.new
+.vitem &*control&~=&~queue/*&<&'options'&>* &&&
+       &*control&~=&~queue_only*&
+.oindex "&%queue%&"
 .oindex "&%queue_only%&"
 .cindex "queueing incoming messages"
+.cindex queueing "forcing in ACL"
+.cindex "first pass routing"
 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
 other words, only when a message is being received. If the message is accepted,
 it is placed on Exim's queue and left there for delivery by a subsequent queue
-runner. No immediate delivery process is started. In other words, it has the
-effect as the &%queue_only%& global option. However, the control applies only
-to the current message, not to any subsequent ones that may be received in the
-same SMTP connection.
+runner.
+If used with no options set,
+no immediate delivery process is started. In other words, it has the
+effect as the &%queue_only%& global option or &'-odq'& command-line option.
+
+If the &'first_pass_route'& option is given then
+the behaviour is like the command-line &'-oqds'& option;
+a delivery process is started which stops short of making
+any SMTP delivery.  The benefit is that the hints database will be updated for
+the message being waiting for a specific host, and a later queue run will be
+able to send all such messages on a single connection.
+
+The control only applies to the current message, not to any subsequent ones that
+ may be received in the same SMTP connection.
+.wen
 
 .vitem &*control&~=&~submission/*&<&'options'&>
 .cindex "message" "submission"
@@ -31118,10 +31564,8 @@ case-sensitively; domains are checked case-insensitively. If &'Resent-To:'& or
 &'Resent-Cc:'& header lines exist, they are also checked. This condition can be
 used only in a DATA or non-SMTP ACL.
 
-.new
 There is one possible option, &`case_insensitive`&.  If this is present then
 local parts are checked case-insensitively.
-.wen
 
 There are, of course, many legitimate messages that make use of blind (bcc)
 recipients. This check should not be used on its own for blocking messages.
@@ -32729,14 +33173,12 @@ It supports a &"generic"& interface to scanners called via the shell, and
 specialized interfaces for &"daemon"& type virus scanners, which are resident
 in memory and thus are much faster.
 
-.new
 Since message data needs to have arrived,
 the condition may be only called in ACL defined by
 &%acl_smtp_data%&,
 &%acl_smtp_data_prdr%&,
 &%acl_smtp_mime%& or
 &%acl_smtp_dkim%&
-.wen
 
 A timeout of 2 minutes is applied to a scanner call (by default);
 if it expires then a defer action is taken.
@@ -33424,13 +33866,22 @@ The following list describes all expansion variables that are
 available in the MIME ACL:
 
 .vlist
+.vitem &$mime_anomaly_level$& &&&
+       &$mime_anomaly_text$&
+.vindex &$mime_anomaly_level$&
+.vindex &$mime_anomaly_text$&
+If there are problems decoding, these variables contain information on
+the detected issue.
+
 .vitem &$mime_boundary$&
-If the current part is a multipart (see &$mime_is_multipart$&) below, it should
+.vindex &$mime_boundary$&
+If the current part is a multipart (see &$mime_is_multipart$& below), it should
 have a boundary string, which is stored in this variable. If the current part
 has no boundary parameter in the &'Content-Type:'& header, this variable
 contains the empty string.
 
 .vitem &$mime_charset$&
+.vindex &$mime_charset$&
 This variable contains the character set identifier, if one was found in the
 &'Content-Type:'& header. Examples for charset identifiers are:
 .code
@@ -33442,31 +33893,37 @@ Please note that this value is not normalized, so you should do matches
 case-insensitively.
 
 .vitem &$mime_content_description$&
+.vindex &$mime_content_description$&
 This variable contains the normalized content of the &'Content-Description:'&
 header. It can contain a human-readable description of the parts content. Some
 implementations repeat the filename for attachments here, but they are usually
 only used for display purposes.
 
 .vitem &$mime_content_disposition$&
+.vindex &$mime_content_disposition$&
 This variable contains the normalized content of the &'Content-Disposition:'&
 header. You can expect strings like &"attachment"& or &"inline"& here.
 
 .vitem &$mime_content_id$&
+.vindex &$mime_content_id$&
 This variable contains the normalized content of the &'Content-ID:'& header.
 This is a unique ID that can be used to reference a part from another part.
 
 .vitem &$mime_content_size$&
+.vindex &$mime_content_size$&
 This variable is set only after the &%decode%& modifier (see above) has been
 successfully run. It contains the size of the decoded part in kilobytes. The
 size is always rounded up to full kilobytes, so only a completely empty part
 has a &$mime_content_size$& of zero.
 
 .vitem &$mime_content_transfer_encoding$&
+.vindex &$mime_content_transfer_encoding$&
 This variable contains the normalized content of the
 &'Content-transfer-encoding:'& header. This is a symbolic name for an encoding
 type. Typical values are &"base64"& and &"quoted-printable"&.
 
 .vitem &$mime_content_type$&
+.vindex &$mime_content_type$&
 If the MIME part has a &'Content-Type:'& header, this variable contains its
 value, lowercased, and without any options (like &"name"& or &"charset"&). Here
 are some examples of popular MIME types, as they may appear in this variable:
@@ -33481,6 +33938,7 @@ If the MIME part has no &'Content-Type:'& header, this variable contains the
 empty string.
 
 .vitem &$mime_decoded_filename$&
+.vindex &$mime_decoded_filename$&
 This variable is set only after the &%decode%& modifier (see above) has been
 successfully run. It contains the full path and filename of the file
 containing the decoded data.
@@ -33489,6 +33947,7 @@ containing the decoded data.
 .cindex "RFC 2047"
 .vlist
 .vitem &$mime_filename$&
+.vindex &$mime_filename$&
 This is perhaps the most important of the MIME variables. It contains a
 proposed filename for an attachment, if one was found in either the
 &'Content-Type:'& or &'Content-Disposition:'& headers. The filename will be
@@ -33499,6 +33958,7 @@ decoded, but no additional sanity checks are done.
 found, this variable contains the empty string.
 
 .vitem &$mime_is_coverletter$&
+.vindex &$mime_is_coverletter$&
 This variable attempts to differentiate the &"cover letter"& of an e-mail from
 attached data. It can be used to clamp down on flashy or unnecessarily encoded
 content in the cover letter, while not restricting attachments at all.
@@ -33531,18 +33991,22 @@ deny message = HTML mail is not accepted here
 condition = $mime_is_coverletter
 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
 .endd
+
 .vitem &$mime_is_multipart$&
+.vindex &$mime_is_multipart$&
 This variable has the value 1 (true) when the current part has the main type
 &"multipart"&, for example, &"multipart/alternative"& or &"multipart/mixed"&.
 Since multipart entities only serve as containers for other parts, you may not
 want to carry out specific actions on them.
 
 .vitem &$mime_is_rfc822$&
+.vindex &$mime_is_rfc822$&
 This variable has the value 1 (true) if the current part is not a part of the
 checked message itself, but part of an attached message. Attached message
 decoding is fully recursive.
 
 .vitem &$mime_part_count$&
+.vindex &$mime_part_count$&
 This variable is a counter that is raised for each processed MIME part. It
 starts at zero for the very first part (which is usually a multipart). The
 counter is per-message, so it is reset when processing RFC822 attachments (see
@@ -33646,7 +34110,12 @@ directory, so you might set
 HAVE_LOCAL_SCAN=yes
 LOCAL_SCAN_SOURCE=Local/local_scan.c
 .endd
-for example. The function must be called &[local_scan()]&. It is called by
+for example. The function must be called &[local_scan()]&;
+.new
+the source file(s) for it should first #define LOCAL_SCAN
+and then #include "local_scan.h".
+.wen
+It is called by
 Exim after it has received a message, when the success return code is about to
 be sent. This is after all the ACLs have been run. The return code from your
 function controls whether the message is actually accepted or not. There is a
@@ -33668,13 +34137,14 @@ in &_Local/Makefile_& (see section &<<SECTconoptloc>>& below).
 .cindex &%dlfunc%& "API description"
 You must include this line near the start of your code:
 .code
+#define LOCAL_SCAN
 #include "local_scan.h"
 .endd
 This header file defines a number of variables and other values, and the
 prototype for the function itself. Exim is coded to use unsigned char values
 almost exclusively, and one of the things this header defines is a shorthand
 for &`unsigned char`& called &`uschar`&.
-It also contains the following macro definitions, to simplify casting character
+It also makes available the following macro definitions, to simplify casting character
 strings and pointers to character strings:
 .code
 #define CS   (char *)
@@ -34276,8 +34746,8 @@ with translation.
 This function is used in conjunction with &'smtp_printf()'&, as described
 below.
 
-.vitem &*void&~smtp_printf(char&~*,&~...)*&
-The arguments of this function are like &[printf()]&; it writes to the SMTP
+.vitem &*void&~smtp_printf(char&~*,BOOL,&~...)*&
+The arguments of this function are almost like &[printf()]&; it writes to the SMTP
 output stream. You should use this function only when there is an SMTP output
 stream, that is, when the incoming message is being received via interactive
 SMTP. This is the case when &%smtp_input%& is TRUE and &%smtp_batched_input%&
@@ -34289,6 +34759,15 @@ is involved.
 If an SMTP TLS connection is established, &'smtp_printf()'& uses the TLS
 output function, so it can be used for all forms of SMTP connection.
 
+The second argument is used to request that the data be buffered
+(when TRUE) or flushed (along with any previously buffered, when FALSE).
+This is advisory only, but likely to save on system-calls and packets
+sent when a sequence of calls to the function are made.
+
+The argument was added in Exim version 4.90 - changing the API/ABI.
+Nobody noticed until 4.93 was imminent, at which point the
+ABI version number was incremented.
+
 Strings that are written by &'smtp_printf()'& from within &[local_scan()]&
 must start with an appropriate response code: 550 if you are going to return
 LOCAL_SCAN_REJECT, 451 if you are going to return
@@ -34306,7 +34785,9 @@ the data returned via the &%return_text%& argument. The added value of using
 multiple output lines.
 
 The &'smtp_printf()'& function does not return any error indication, because it
-does not automatically flush pending output, and therefore does not test
+does not
+guarantee a flush of
+pending output, and therefore does not test
 the state of the stream. (In the main code of Exim, flushing and error
 detection is done when Exim is ready for the next SMTP input command.) If
 you want to flush the output and check for an error (for example, the
@@ -34314,12 +34795,18 @@ dropping of a TCP/IP connection), you can call &'smtp_fflush()'&, which has no
 arguments. It flushes the output stream, and returns a non-zero value if there
 is an error.
 
-.vitem &*void&~*store_get(int)*&
+.new
+.vitem &*void&~*store_get(int,BOOL)*&
 This function accesses Exim's internal store (memory) manager. It gets a new
-chunk of memory whose size is given by the argument. Exim bombs out if it ever
+chunk of memory whose size is given by the first argument.
+The second argument should be given as TRUE if the memory will be used for
+data possibly coming from an attacker (eg. the message content),
+FALSE if it is locally-sourced.
+Exim bombs out if it ever
 runs out of memory. See the next section for a discussion of memory handling.
+.wen
 
-.vitem &*void&~*store_get_perm(int)*&
+.vitem &*void&~*store_get_perm(int,BOOL)*&
 This function is like &'store_get()'&, but it always gets memory from the
 permanent pool. See the next section for a discussion of memory handling.
 
@@ -36425,12 +36912,18 @@ to a router of this form:
 virtual:
   driver = redirect
   domains = dsearch;/etc/mail/virtual
-  data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
+  data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain_data}}
   no_more
 .endd
+.new
 The &%domains%& option specifies that the router is to be skipped, unless there
 is a file in the &_/etc/mail/virtual_& directory whose name is the same as the
-domain that is being processed. When the router runs, it looks up the local
+domain that is being processed.
+The &(dsearch)& lookup used results in an untainted version of &$domain$&
+being placed into the &$domain_data$& variable.
+.wen
+
+When the router runs, it looks up the local
 part in the file to find a new address (or list of addresses). The &%no_more%&
 setting ensures that if the lookup fails (leading to &%data%& being an empty
 string), Exim gives up on the address without trying any subsequent routers.
@@ -36633,6 +37126,7 @@ delivered immediately.
 .cindex "SMTP" "passed connection"
 .cindex "SMTP" "multiple deliveries"
 .cindex "multiple SMTP deliveries"
+.cindex "first pass routing"
 Mail waiting to be sent from an intermittently connected host will probably
 not have been routed, because without a connection DNS lookups are not
 possible. This means that if a normal queue run is done at connection time,
@@ -37290,7 +37784,7 @@ the following table:
 &`DKIM`&        domain verified in incoming message
 &`DN  `&        distinguished name from peer certificate
 &`DS  `&        DNSSEC secured lookups
-&`DT  `&        on &`=>`& lines: time taken for a delivery
+&`DT  `&        on &`=>`&, &'=='& and &'**'& lines: time taken for, or to attempt, a delivery
 &`F   `&        sender address (on delivery lines)
 &`H   `&        host name and IP address
 &`I   `&        local interface used
@@ -37388,7 +37882,7 @@ selection marked by asterisks:
 &` arguments                  `&  command line arguments
 &`*connection_reject          `&  connection rejections
 &`*delay_delivery             `&  immediate delivery delayed
-&` deliver_time               `&  time taken to perform delivery
+&` deliver_time               `&  time taken to attempt delivery
 &` delivery_size              `&  add &`S=`&&'nnn'& to => lines
 &`*dkim                       `&  DKIM verified domain on <= lines
 &` dkim_verbose               `&  separate full DKIM verification result line, per signature
@@ -37586,7 +38080,6 @@ connection is unexpectedly dropped.
 &%millisec%&: Timestamps have a period and three decimal places of finer granularity
 appended to the seconds value.
 .next
-.new
 .cindex "log" "message id"
 &%msg_id%&: The value of the Message-ID: header.
 .next
@@ -37594,7 +38087,6 @@ appended to the seconds value.
 This will be either because the message is a bounce, or was submitted locally
 (submission mode) without one.
 The field identifier will have an asterix appended: &"id*="&.
-.wen
 .next
 .cindex "log" "outgoing interface"
 .cindex "log" "local interface"
@@ -37631,13 +38123,11 @@ The field is a single "L".
 On accept lines, where PIPELINING was offered but not used by the client,
 the field has a minus appended.
 
-.new
 .cindex "pipelining" "early connection"
 If Exim is built with the SUPPORT_PIPE_CONNECT build option
 accept "L" fields have a period appended if the feature was
 offered but not used, or an asterisk appended if used.
 Delivery "L" fields have an asterisk appended if used.
-.wen
 
 .next
 .cindex "log" "queue run"
@@ -37995,10 +38485,8 @@ Match only frozen messages.
 .vitem &*-x*&
 Match only non-frozen messages.
 
-.new
 .vitem &*-G*&&~<&'queuename'&>
 Match only messages in the given queue.  Without this, the default queue is searched.
-.wen
 .endlist
 
 The following options control the format of the output:
@@ -39686,10 +40174,8 @@ was received from the client, this records the Distinguished Name from that
 certificate.
 .endlist
 
-.new
 Any of the above may have an extra hyphen prepended, to indicate the the
 corresponding data is untrusted.
-.wen
 
 Following the options there is a list of those addresses to which the message
 is not to be delivered. This set of addresses is initialized from the command
@@ -39879,9 +40365,7 @@ These options take (expandable) strings as arguments.
 The domain(s) you want to sign with.
 After expansion, this can be a list.
 Each element in turn,
-.new
 lowercased,
-.wen
 is put into the &%$dkim_domain%& expansion variable
 while expanding the remaining signing options.
 If it is empty after expansion, DKIM signing is not done,
@@ -39920,6 +40404,8 @@ To generate keys under OpenSSL:
 openssl genrsa -out dkim_rsa.private 2048
 openssl rsa -in dkim_rsa.private -out /dev/stdout -pubout -outform PEM
 .endd
+The result file from the first command should be retained, and
+this option set to use it.
 Take the base-64 lines from the output of the second command, concatenated,
 for the DNS TXT record.
 See section 3.6 of RFC6376 for the record specification.
@@ -39936,9 +40422,7 @@ Signers MUST use RSA keys of at least 1024 bits for all keys.
 Signers SHOULD use RSA keys of at least 2048 bits.
 .endd
 
-.new
 EC keys for DKIM are defined by RFC 8463.
-.wen
 They are considerably smaller than RSA keys for equivalent protection.
 As they are a recent development, users should consider dual-signing
 (by setting a list of selectors, and an expansion for this option)
@@ -39958,12 +40442,10 @@ openssl pkey -outform DER -pubout -in dkim_ed25519.private | tail -c +13 | base6
 certtool --load_privkey=dkim_ed25519.private --pubkey_info --outder | tail -c +13 | base64
 .endd
 
-.new
 Exim also supports an alternate format
 of Ed25519 keys in DNS which was a candidate during development
 of the standard, but not adopted.
 A future release will probably drop that support.
-.wen
 
 .option dkim_hash smtp string&!! sha256
 Can be set to any one of the supported hash methods, which are:
@@ -39996,7 +40478,7 @@ only supports signing with the same canonicalization method for both headers and
 .option dkim_strict smtp string&!! unset
 This  option  defines  how  Exim  behaves  when  signing a message that
 should be signed fails for some reason.  When the expansion evaluates to
-either "1" or "true", Exim will defer. Otherwise Exim will send the message
+either &"1"& or &"true"&, Exim will defer. Otherwise Exim will send the message
 unsigned. You can use the &%$dkim_domain%& and &%$dkim_selector%& expansion
 variables here.
 
@@ -40008,16 +40490,19 @@ in the message signature.
 When unspecified, the header names listed in RFC4871 will be used,
 whether or not each header is present in the message.
 The default list is available for the expansion in the macro
-"_DKIM_SIGN_HEADERS".
+&"_DKIM_SIGN_HEADERS"&
+.new
+and an oversigning variant is in &"_DKIM_OVERSIGN_HEADERS"&.
+.wen
 
 If a name is repeated, multiple headers by that name (or the absence thereof)
 will be signed.  The textually later headers in the headers part of the
 message are signed first, if there are multiples.
 
-A name can be prefixed with either an '=' or a '+' character.
-If an '=' prefix is used, all headers that are present with this name
+A name can be prefixed with either an &"="& or a &"+"& character.
+If an &"="& prefix is used, all headers that are present with this name
 will be signed.
-If a '+' prefix if used, all headers that are present with this name
+If a &"+"& prefix if used, all headers that are present with this name
 will be signed, and one signature added for a missing header with the
 name will be appended.
 
@@ -40037,22 +40522,18 @@ RFC 6376 lists these tags as RECOMMENDED.
 
 Verification of DKIM signatures in SMTP incoming email is done for all
 messages for which an ACL control &%dkim_disable_verify%& has not been set.
-.new
 .cindex DKIM "selecting signature algorithms"
 Individual classes of signature algorithm can be ignored by changing
 the main options &%dkim_verify_hashes%& or &%dkim_verify_keytypes%&.
 The &%dkim_verify_minimal%& option can be set to cease verification
 processing for a message once the first passing signature is found.
-.wen
 
 .cindex authentication "expansion item"
 Performing verification sets up information used by the
 &%authresults%& expansion item.
 
-.new
 For most purposes the default option settings suffice and the remainder
 of this section can be ignored.
-.wen
 
 The results of verification are made available to the
 &%acl_smtp_dkim%& ACL, which can examine and modify them.
@@ -40099,13 +40580,11 @@ dkim_verify_signers = $sender_address_domain:$dkim_signers
 If a domain or identity is listed several times in the (expanded) value of
 &%dkim_verify_signers%&, the ACL is only called once for that domain or identity.
 
-.new
 Note that if the option is set using untrustworthy data
 (such as the From: header)
 care should be taken to force lowercase for domains
 and for the domain part if identities.
 The default setting can be regarded as trustworthy in this respect.
-.wen
 
 If multiple signatures match a domain (or identity), the ACL is called once
 for each matching signature.
@@ -40207,10 +40686,8 @@ algorithms (currently, rsa-sha1) have permanently failed evaluation
 
 To enforce this you must either have a DKIM ACL which checks this variable
 and overwrites the &$dkim_verify_status$& variable as discussed above,
-.new
 or have set the main option &%dkim_verify_hashes%& to exclude
 processing of such signatures.
-.wen
 
 .vitem &%$dkim_canon_body%&
 The body canonicalization method. One of 'relaxed' or 'simple'.
@@ -40267,6 +40744,10 @@ Notes from the key record (tag n=).
 
 .vitem &%$dkim_key_length%&
 Number of bits in the key.
+.new
+Valid only once the key is loaded, which is at the time the header signature
+is verified, which is after the body hash is.
+.wen
 
 Note that RFC 8301 says:
 .code
@@ -40274,9 +40755,8 @@ Verifiers MUST NOT consider signatures using RSA keys of
 less than 1024 bits as valid signatures.
 .endd
 
-To enforce this you must have a DKIM ACL which checks this variable
-and overwrites the &$dkim_verify_status$& variable as discussed above.
-As EC keys are much smaller, the check should only do this for RSA keys.
+This is enforced by the default setting for the &%dkim_verify_min_keysizes%&
+option.
 
 .endlist
 
@@ -40325,8 +40805,12 @@ for more information of what they mean.
 
 SPF is a mechanism whereby a domain may assert which IP addresses may transmit
 messages with its domain in the envelope from, documented by RFC 7208.
-For more information on SPF see &url(http://www.openspf.org).
-. --- 2018-09-07: still not https
+For more information on SPF see &url(http://www.open-spf.org), a static copy of
+the &url(http://openspf.org).
+. --- 2019-10-28: still not https, open-spf.org is told to be a
+. --- web-archive copy of the now dead openspf.org site
+. --- See https://www.mail-archive.com/mailop@mailop.org/msg08019.html for a
+. --- discussion.
 
 Messages sent by a system not authorised will fail checking of such assertions.
 This includes retransmissions done by traditional forwarders.
@@ -40389,7 +40873,7 @@ deny spf = fail
      message = $sender_host_address is not allowed to send mail from \
                ${if def:sender_address_domain \
                     {$sender_address_domain}{$sender_helo_name}}.  \
-               Please see http://www.openspf.org/Why?scope=\
+               Please see http://www.open-spf.org/Why?scope=\
                ${if def:sender_address_domain {mfrom}{helo}};\
                identity=${if def:sender_address_domain \
                              {$sender_address}{$sender_helo_name}};\
@@ -40442,9 +40926,9 @@ In addition to SPF, you can also perform checks for so-called
 "Best-guess".  Strictly speaking, "Best-guess" is not standard
 SPF, but it is supported by the same framework that enables SPF
 capability.
-Refer to &url(http://www.openspf.org/FAQ/Best_guess_record)
+Refer to &url(http://www.open-spf.org/FAQ/Best_guess_record)
 for a description of what it means.
-. --- 2018-09-07: still not https:
+. --- 2019-10-28: still not https:
 
 To access this feature, simply use the spf_guess condition in place
 of the spf one.  For example:
@@ -40478,9 +40962,7 @@ would relax host matching rules to a broader network range.
 .cindex lookup spf
 A lookup expansion is also available. It takes an email
 address as the key and an IP address
-.new
 (v4 or v6)
-.wen
 as the database:
 
 .code
@@ -40494,7 +40976,6 @@ The lookup will return the same result strings as can appear in
 
 
 
-.new
 .section DMARC SECDMARC
 .cindex DMARC verification
 
@@ -40509,7 +40990,7 @@ the libopendmarc library is used.
 
 For building Exim yourself, obtain the library from
 &url(http://sourceforge.net/projects/opendmarc/)
-to obtain a copy, or find it in your favorite rpm package
+to obtain a copy, or find it in your favorite package
 repository.  You will need to attend to the local/Makefile feature
 SUPPORT_DMARC and the associated LDFLAGS addition.
 This description assumes
@@ -40527,10 +41008,12 @@ defines the location of a text file of valid
 top level domains the opendmarc library uses
 during domain parsing. Maintained by Mozilla,
 the most current version can be downloaded
-from a link at &url(https://publicsuffix.org/list/, currently pointing
-at https://publicsuffix.org/list/public_suffix_list.dat)
-See also util/renew-opendmarc-tlds.sh script.
-The default for the option is /etc/exim/opendmarc.tlds.
+from a link at &url(https://publicsuffix.org/list/public_suffix_list.dat).
+See also the util/renew-opendmarc-tlds.sh script.
+.new
+The default for the option is unset.
+If not set, DMARC processing is disabled.
+.wen
 
 
 The &%dmarc_history_file%& option, if set
@@ -40565,7 +41048,7 @@ non-authenticated user.  It makes sense to only verify DMARC
 status of messages coming from remote, untrusted sources.  You can
 use standard conditions such as hosts, senders, etc, to decide that
 DMARC verification should *not* be performed for them and disable
-DMARC with a control setting:
+DMARC with an ACL control modifier:
 .code
   control = dmarc_disable_verify
 .endd
@@ -40576,15 +41059,15 @@ results in unintended information leakage (what lists a user might
 be subscribed to, etc).  You must configure exim to submit forensic
 reports to the owner of the domain.  If the DMARC record contains a
 forensic address and you specify the control statement below, then
-exim will send these forensic emails.  It's also advised that you
-configure a dmarc_forensic_sender because the default sender address
+exim will send these forensic emails.  It is also advised that you
+configure a &%dmarc_forensic_sender%& because the default sender address
 construction might be inadequate.
 .code
   control = dmarc_enable_forensic
 .endd
 (AGAIN: You can choose not to send these forensic reports by simply
 not putting the dmarc_enable_forensic control line at any point in
-your exim config.  If you don't tell it to send them, it will not
+your exim config.  If you don't tell exim to send them, it will not
 send them.)
 
 There are no options to either control.  Both must appear before
@@ -40593,14 +41076,14 @@ the DATA acl.
 . subsection
 
 DMARC checks cam be run on incoming SMTP  messages by using the
-"dmarc_status" ACL condition in the DATA ACL.  You are required to
-call the "spf" condition first in the ACLs, then the "dmarc_status"
+&"dmarc_status"& ACL condition in the DATA ACL.  You are required to
+call the &"spf"& condition first in the ACLs, then the &"dmarc_status"&
 condition.  Putting this condition in the ACLs is required in order
 for a DMARC check to actually occur.  All of the variables are set
 up before the DATA ACL, but there is no actual DMARC check that
-occurs until a "dmarc_status" condition is encountered in the ACLs.
+occurs until a &"dmarc_status"& condition is encountered in the ACLs.
 
-The dmarc_status condition takes a list of strings on its
+The &"dmarc_status"& condition takes a list of strings on its
 right-hand side.  These strings describe recommended action based
 on the DMARC check.  To understand what the policy recommendations
 mean, refer to the DMARC website above.  Valid strings are:
@@ -40633,28 +41116,30 @@ Several expansion variables are set before the DATA ACL is
 processed, and you can use them in this ACL.  The following
 expansion variables are available:
 
-&$dmarc_status$&
+.vlist
+.vitem &$dmarc_status$&
 .vindex &$dmarc_status$&
 .cindex DMARC result
-is a one word status indicating what the DMARC library
+A one word status indicating what the DMARC library
 thinks of the email.  It is a combination of the results of
 DMARC record lookup and the SPF/DKIM/DMARC processing results
 (if a DMARC record was found).  The actual policy declared
 in the DMARC record is in a separate expansion variable.
 
-&$dmarc_status_text$&
+.vitem &$dmarc_status_text$&
 .vindex &$dmarc_status_text$&
-is a slightly longer, human readable status.
+Slightly longer, human readable status.
 
-&$dmarc_used_domain$&
+.vitem &$dmarc_used_domain$&
 .vindex &$dmarc_used_domain$&
-is the domain which DMARC used to look up the DMARC policy record.
+The domain which DMARC used to look up the DMARC policy record.
 
-&$dmarc_domain_policy$&
+.vitem &$dmarc_domain_policy$&
 .vindex &$dmarc_domain_policy$&
-is the policy declared in the DMARC record.  Valid values
+The policy declared in the DMARC record.  Valid values
 are "none", "reject" and "quarantine".  It is blank when there
 is any error, including no DMARC record.
+.endlist
 
 . subsection
 
@@ -40669,7 +41154,7 @@ processing or failure delivery issues).
 In order to log statistics suitable to be imported by the opendmarc
 tools, you need to:
 .ilist
-Configure the global setting dmarc_history_file
+Configure the global option &%dmarc_history_file%&
 .next
 Configure cron jobs to call the appropriate opendmarc history
 import scripts and truncating the dmarc_history_file
@@ -40677,7 +41162,7 @@ import scripts and truncating the dmarc_history_file
 
 In order to send forensic reports, you need to:
 .ilist
-Configure the global setting dmarc_forensic_sender
+Configure the global option &%dmarc_forensic_sender%&
 .next
 Configure, somewhere before the DATA ACL, the control option to
 enable sending DMARC forensic reports
@@ -40723,7 +41208,6 @@ Example usage:
   warn    add_header     = :at_start:${authresults {$primary_hostname}}
 .endd
 
-.wen
 
 
 
@@ -41058,10 +41542,11 @@ The current list of events is:
 .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: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
@@ -41087,12 +41572,13 @@ An additional variable, &$event_data$&, is filled with information varying
 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:host: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