Add variables for wildcard portion of local-part affix. Bug 281
[exim.git] / doc / doc-docbook / spec.xfpt
index 2946d70131621203ab938248b16f3617b65f034e..f9bdbd8ec93cb9f8074b8dc7661d1a78a433beae 100644 (file)
@@ -1399,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$&"
@@ -3966,7 +3971,7 @@ user.
 .vitem &%-MG%&&~<&'queue&~name'&>&~<&'message&~id'&>&~<&'message&~id'&>&~...
 .oindex "&%-MG%&"
 .cindex queue named
-.cindex "named queues"
+.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.
@@ -4185,6 +4190,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
@@ -4503,11 +4509,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
@@ -4553,7 +4564,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.
@@ -6362,7 +6373,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
@@ -6370,7 +6381,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
@@ -8290,6 +8311,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
@@ -9709,7 +9743,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"
@@ -9815,6 +9849,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"
@@ -12192,6 +12232,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$&"
@@ -12385,13 +12432,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
@@ -12445,12 +12518,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
@@ -12781,10 +12876,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.
 
+.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
@@ -16696,13 +16798,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
@@ -17204,6 +17307,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
@@ -18584,15 +18694,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.
@@ -18697,6 +18811,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
@@ -20528,6 +20648,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"
@@ -20753,6 +20886,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"
@@ -21753,15 +21891,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.
@@ -22312,6 +22456,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)&"
@@ -23749,6 +23901,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
@@ -26942,7 +27100,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
@@ -27024,7 +27182,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
@@ -27145,7 +27303,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
@@ -27363,7 +27521,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
@@ -27394,6 +27552,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
 
@@ -27411,20 +27592,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
@@ -27440,13 +27657,14 @@ server to see different identifiers and authentication will fail.
 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).
 
@@ -27494,16 +27712,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`&
@@ -29935,7 +30197,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.
@@ -29944,7 +30206,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
@@ -30374,6 +30636,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"
@@ -30508,16 +30777,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"
@@ -33641,7 +33926,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
@@ -33663,13 +33953,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 *)
@@ -34320,12 +34611,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.
 
@@ -36639,6 +36936,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,
@@ -37296,7 +37594,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
@@ -37394,7 +37692,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
@@ -39916,6 +40214,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.
@@ -40512,10 +40812,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
@@ -41038,14 +41340,17 @@ Events have names which correspond to the point in process at which they fire.
 The name is placed in the variable &$event_name$& and the event action
 expansion must check this, as it will be called for every possible event type.
 
+.new
 The current list of events is:
+.wen
 .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
@@ -41071,12 +41376,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