Consolidate $local_part_verified into $local_part_data
authorJeremy Harris <jgh146exb@wizmail.org>
Mon, 4 May 2020 21:38:08 +0000 (22:38 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Mon, 4 May 2020 21:41:01 +0000 (22:41 +0100)
This removes the former; the latter having been around since before the last
release.  The router check_local_user option now writes the latter
and -verified no longer exists.

12 files changed:
doc/doc-docbook/spec.xfpt
doc/doc-txt/NewStuff
src/src/configure.default
src/src/deliver.c
src/src/expand.c
src/src/globals.c
src/src/globals.h
src/src/route.c
src/src/structs.h
test/confs/0005
test/confs/0587
test/scripts/0000-Basic/0587

index 9336151e58b5411fe0023814ae88fa5c491744fe..56c7329eeb255b6f9e69a9ea9415cacdff5bbfef 100644 (file)
@@ -6381,7 +6381,7 @@ All other options are defaulted.
 .code
 local_delivery:
   driver = appendfile
-  file = /var/mail/$local_part_verified
+  file = /var/mail/$local_part_data
   delivery_date_add
   envelope_to_add
   return_path_add
@@ -6394,7 +6394,7 @@ 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$&,
+Instead we use &$local_part_data$&,
 the result of looking up &$local_part$& in the user database
 (done by using &%check_local_user%& in the the router).
 .wen
@@ -12550,7 +12550,7 @@ 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.
+&$local_part_data$& 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.
@@ -12599,6 +12599,10 @@ router as &$local_part_data$&. In addition, if the driver routes the address
 to a transport, the value is available in that transport. If the transport is
 handling multiple addresses, the value from the first address is used.
 
+.new
+The &%check_local_user%& router option also sets this variable.
+.wen
+
 &$local_part_data$& is also set when the &%local_parts%& condition in an ACL
 matches a local part by means of a lookup. The data read by the lookup is
 available during the rest of the ACL statement. In all other situations, this
@@ -19167,7 +19171,7 @@ but the user is specified symbolically, the gid associated with the uid is
 used. For example:
 .code
 require_files = mail:/some/file
-require_files = $local_part_verified:$home/.procmailrc
+require_files = $local_part_data:$home/.procmailrc
 .endd
 If a user or group name in a &%require_files%& list does not exist, the
 &%require_files%& condition fails.
@@ -21798,7 +21802,7 @@ local_users:
 # This transport overrides the group
 group_delivery:
   driver = appendfile
-  file = /var/spool/mail/$local_part_verified
+  file = /var/spool/mail/$local_part_data
   group = mail
 .endd
 If &%user%& is set for a transport, its value overrides what is set in the
@@ -22633,7 +22637,7 @@ is used as a result of a &"keep"& action in the filter. This example shows one
 way of handling this requirement:
 .code
 file = ${if eq{$address_file}{inbox} \
-            {/var/mail/$local_part_verified} \
+            {/var/mail/$local_part_data} \
             {${if eq{${substr_0_1:$address_file}}{/} \
                   {$address_file} \
                   {$home/mail/$address_file} \
@@ -22814,8 +22818,8 @@ The string value is expanded for each delivery, and must yield an absolute
 path. The most common settings of this option are variations on one of these
 examples:
 .code
-file = /var/spool/mail/$local_part_verified
-file = /home/$local_part_verified/inbox
+file = /var/spool/mail/$local_part_data
+file = /home/$local_part_data/inbox
 file = $home/inbox
 .endd
 .cindex "&""sticky""& bit"
@@ -23571,7 +23575,7 @@ and directories in a maildir mailbox, including subdirectories for maildir++
 folders. Consider this example:
 .code
 maildir_format = true
-directory = /var/mail/$local_part_verified\
+directory = /var/mail/$local_part_data\
            ${if eq{$local_part_suffix}{}{}\
            {/.${substr_1:$local_part_suffix}}}
 maildirfolder_create_regex = /\.[^/]+$
@@ -24561,14 +24565,14 @@ configuration for &%procmail%&:
 # transport
 procmail_pipe:
   driver = pipe
-  command = /usr/local/bin/procmail -d $local_part
+  command = /usr/local/bin/procmail -d $local_part_data
   return_path_add
   delivery_date_add
   envelope_to_add
   check_string = "From "
   escape_string = ">From "
   umask = 077
-  user = $local_part
+  user = $local_part_data
   group = mail
 
 # router
@@ -35123,7 +35127,7 @@ central_filter:
   check_local_user
   driver = redirect
   domains = +local_domains
-  file = /central/filters/$local_part_verified
+  file = /central/filters/$local_part_data
   no_verify
   allow_filter
   allow_freeze
@@ -36993,9 +36997,9 @@ another MTA:
 userforward:
   driver = redirect
   check_local_user
-  file = $home/.forward$local_part_suffix
   local_part_suffix = -*
   local_part_suffix_optional
+  file = ${lookup {.forward$local_part_suffix} dsearch,ret=full {$home} {$value}fail}
   allow_filter
 .endd
 If there is no suffix, &_.forward_& is used; if the suffix is &'-special'&, for
index 6676e0b9ff3d658d53fffada6f63f64a3bc0ee4c..493244ff1ed6287b3f664fb0ebd21bb63cc07ca5 100644 (file)
@@ -24,8 +24,8 @@ Version 4.94
  5. Server-side support in the gsasl authenticator for encrypted passwords, as
     an alternate for the existing plaintext.
 
- 6. Variable $local_part_verified, set by the router check_local_part condition
-    with untainted data.
+ 6. Variable $local_part_data now also set by router check_local_user option,
+    with an de-tainted version of $local_part.
 
  7. Named-list definitions can now be prefixed "hide" so that "-bP" commands do
     not output the content.  Previously this could only be done on options.
index 40cc333f6c68760733b21aad30704d58fedd25d0..b758c8950bc4a8b7af937414e5652f6f4951cb3c 100644 (file)
@@ -863,7 +863,7 @@ smarthost_smtp:
 
 local_delivery:
   driver = appendfile
-  file = /var/mail/$local_part_verified
+  file = /var/mail/$local_part_data
   delivery_date_add
   envelope_to_add
   return_path_add
index c6e9aa66a074dbaec69f162cf1d4800a11ce18c8..85b061b303559810500a27e6927e9b41ca49b99b 100644 (file)
@@ -220,7 +220,6 @@ if (!addr->next)
   address_item *addr_orig;
 
   deliver_localpart = addr->local_part;
-  deliver_localpart_verified = addr->local_part_verified;
   deliver_localpart_prefix = addr->prefix;
   deliver_localpart_prefix_v = addr->prefix_v;
   deliver_localpart_suffix = addr->suffix;
index 4f4cbbff3e929805ec712b55515c5e4595798c87..7c9d481000223e2fcd33cff2e24f79f8525a565b 100644 (file)
@@ -595,7 +595,6 @@ static var_entry var_table[] = {
   { "local_part_prefix_v", vtype_stringptr,   &deliver_localpart_prefix_v },
   { "local_part_suffix",   vtype_stringptr,   &deliver_localpart_suffix },
   { "local_part_suffix_v", vtype_stringptr,   &deliver_localpart_suffix_v },
-  { "local_part_verified", vtype_stringptr,   &deliver_localpart_verified },
 #ifdef HAVE_LOCAL_SCAN
   { "local_scan_data",     vtype_stringptr,   &local_scan_data },
 #endif
index d630df030e51c0df67c160cdeb95399d9f08b3c1..ba772c631cf2759106285248dc5aecdc874cd481 100644 (file)
@@ -187,7 +187,6 @@ const uschar **address_expansions[ADDRESS_EXPANSIONS_COUNT] = {
   CUSS &deliver_domain_orig,
   CUSS &deliver_domain_parent,
   CUSS &deliver_localpart,
-  CUSS &deliver_localpart_verified,
   CUSS &deliver_localpart_data,
   CUSS &deliver_localpart_orig,
   CUSS &deliver_localpart_parent,
@@ -830,7 +829,6 @@ uschar *deliver_localpart_prefix = NULL;
 uschar *deliver_localpart_prefix_v = NULL;
 uschar *deliver_localpart_suffix = NULL;
 uschar *deliver_localpart_suffix_v = NULL;
-uschar *deliver_localpart_verified = NULL;
 uschar *deliver_out_buffer     = NULL;
 int     deliver_queue_load_max = -1;
 address_item  *deliver_recipients = NULL;
index 039aaf3d18989c5db3e0eb7e96d11e394437f1c9..3a8e824cf897e98dfb5a02880a37e9b848eb79db 100644 (file)
@@ -488,14 +488,13 @@ extern int     deliver_host_port;      /* Address for remote delivery filter */
 extern uschar *deliver_in_buffer;      /* Buffer for copying file */
 extern ino_t   deliver_inode;          /* Inode for appendfile */
 extern uschar *deliver_localpart;      /* The local part for delivery */
-extern uschar *deliver_localpart_data; /* From local part lookup */
+extern uschar *deliver_localpart_data; /* From local part lookup (de-tainted) */
 extern uschar *deliver_localpart_orig; /* The original local part for delivery */
 extern uschar *deliver_localpart_parent; /* The parent local part for delivery */
 extern uschar *deliver_localpart_prefix; /* The stripped prefix, if any */
 extern uschar *deliver_localpart_prefix_v; /* The stripped-prefix variable portion, if any */
 extern uschar *deliver_localpart_suffix; /* The stripped suffix, if any */
 extern uschar *deliver_localpart_suffix_v; /* The stripped-suffix variable portion, if any */
-extern uschar *deliver_localpart_verified; /* de-tainted by check_local_part */
 extern uschar *deliver_out_buffer;     /* Buffer for copying file */
 extern int     deliver_queue_load_max; /* Different value for queue running */
 extern address_item *deliver_recipients; /* Current set of addresses */
index 7538b75659d6528c1e27297ed5130e1f2b8ae1fb..a5f5feeaf9c7097d503104374003993fb19caa7b 100644 (file)
@@ -948,7 +948,7 @@ if ((rc = route_check_dls(r->name, US"local_parts", r->local_parts,
 login of a local user. Note: the third argument to route_finduser() must be
 NULL here, to prevent a numeric string being taken as a numeric uid. If the
 user is found, set deliver_home to the home directory, and also set
-local_user_{uid,gid} and local_part_verified.  */
+local_user_{uid,gid} and local_part_data.  */
 
 if (r->check_local_user)
   {
@@ -959,8 +959,8 @@ if (r->check_local_user)
       r->name, addr->local_part);
     return SKIP;
     }
-  addr->local_part_verified =
-    deliver_localpart_verified = string_copy(US (*pw)->pw_name);
+  addr->prop.localpart_data =
+    deliver_localpart_data = string_copy(US (*pw)->pw_name);
   deliver_home = string_copy(US (*pw)->pw_dir);
   local_user_gid = (*pw)->pw_gid;
   local_user_uid = (*pw)->pw_uid;
index ae37f346159a962d2e50ba98bdc27faa79e92d26..c6700d5136803fe8aa91d5fad96cc4e02b4b3517 100644 (file)
@@ -553,7 +553,6 @@ typedef struct address_item {
   uschar *cc_local_part;          /* caseful local part */
   uschar *lc_local_part;          /* lowercased local part */
   uschar *local_part;             /* points to cc or lc version */
-  uschar *local_part_verified;    /* result from check_local_user */
   uschar *prefix;                 /* stripped prefix of local part */
   uschar *prefix_v;              /*  variable part of above */
   uschar *suffix;                 /* stripped suffix of local part */
index 77b79100cc2a97903db3126aadaca439d8ec40cd..babeacb41834d953c782c4a673030da024269b72 100644 (file)
@@ -52,7 +52,7 @@ local_delivery:
   driver = appendfile
   delivery_date_add
   envelope_to_add
-  file = DIR/test-mail/$local_part_verified
+  file = DIR/test-mail/$local_part_data
   headers_add = "X-body-linecount: $body_linecount\n\
                  X-message-linecount: $message_linecount\n\
                  X-received-count: $received_count"
index a47ca664a64b8b32dcf1170ccb7bb7e838926cdb..c54c63fcd28027a60310d1e42248cfa73a57814b 100644 (file)
@@ -32,6 +32,6 @@ begin transports
 
 local_delivery:
   driver = appendfile
-  file = DIR/test-mail/$local_part_verified
+  file = DIR/test-mail/$local_part_data
 
 # End
index 337b05ac69bf6a3f451f35638eacbdf3c8cdb660..038254eaba1e9a4dc58d0d2824cee9a8b38bc7f7 100644 (file)
@@ -1,4 +1,4 @@
-# $local_part_verified, multi-rcpt message
+# $local_part_data, multi-rcpt message
 #
 exim -bs -odi
 mail from:<someone@some.domain>