From: Philip Hazel Date: Wed, 7 Sep 2005 10:15:33 +0000 (+0000) Subject: Fix incorrect use of local user name for trusted submissions. X-Git-Tag: exim-4_53~34 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2fe1a124e7e7f496b39d9f348403dd5d5e69f01f;p=exim.git Fix incorrect use of local user name for trusted submissions. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 67ca2e71b..aae31b22f 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.216 2005/09/06 13:21:06 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.217 2005/09/07 10:15:33 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -144,6 +144,14 @@ PH/34 There are settings for CHOWN_COMMAND and MV_COMMAND that can be used in PH/35 Installed configuration files for Dragonfly. +PH/36 When a locally submitted message by a trusted user did not contain a + From: header, and the sender address was obtained from -f or from an SMTP + MAIL command, and the trusted user did not use -F to supply a sender + name, $originator_name was incorrectly used when constructing a From: + header. Furthermore, $originator_name was used for submission mode + messages from external hosts without From: headers in a similar way, + which is clearly wrong. + Exim version 4.52 ----------------- diff --git a/src/src/acl.c b/src/src/acl.c index 1be2e095c..5d1e7cf02 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/acl.c,v 1.45 2005/09/06 13:17:36 ph10 Exp $ */ +/* $Cambridge: exim/src/src/acl.c,v 1.46 2005/09/07 10:15:33 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -2494,7 +2494,7 @@ for (; cb != NULL; cb = cb->next) { uschar *pp = p + 6; while (*pp != 0 && *pp != '/') pp++; - originator_name = string_copy(parse_fix_phrase(p+6, pp-p-6, + submission_name = string_copy(parse_fix_phrase(p+6, pp-p-6, big_buffer, big_buffer_size)); p = pp; } diff --git a/src/src/exim.c b/src/src/exim.c index f4d537800..d2323398f 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/exim.c,v 1.26 2005/08/23 11:25:38 ph10 Exp $ */ +/* $Cambridge: exim/src/src/exim.c,v 1.27 2005/09/07 10:15:33 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1993,6 +1993,7 @@ for (i = 1; i < argc; i++) { badarg = TRUE; break; } } originator_name = argrest; + sender_name_forced = TRUE; break; diff --git a/src/src/globals.c b/src/src/globals.c index fabfe1c24..b00b70dba 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.c,v 1.34 2005/08/08 10:48:27 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.c,v 1.35 2005/09/07 10:15:33 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -982,6 +982,7 @@ BOOL sender_host_notsocket = FALSE; BOOL sender_host_unknown = FALSE; uschar *sender_ident = NULL; BOOL sender_local = FALSE; +BOOL sender_name_forced = FALSE; uschar *sender_rate = NULL; uschar *sender_rate_limit = NULL; uschar *sender_rate_period = NULL; @@ -1081,6 +1082,7 @@ BOOL strip_excess_angle_brackets = FALSE; BOOL strip_trailing_dot = FALSE; uschar *submission_domain = NULL; BOOL submission_mode = FALSE; +uschar *submission_name = NULL; BOOL synchronous_delivery = FALSE; BOOL syslog_duplication = TRUE; int syslog_facility = LOG_MAIL; diff --git a/src/src/globals.h b/src/src/globals.h index 6becb6b39..2a571872d 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.h,v 1.26 2005/08/22 14:01:37 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.h,v 1.27 2005/09/07 10:15:33 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -593,6 +593,7 @@ extern BOOL sender_host_notsocket; /* Set for -bs and -bS */ extern BOOL sender_host_unknown; /* TRUE for -bs and -bS except inetd */ extern uschar *sender_ident; /* Sender identity via RFC 1413 */ extern BOOL sender_local; /* TRUE for local senders */ +extern BOOL sender_name_forced; /* Set by -F */ extern uschar *sender_rate; /* Sender rate computed by ACL */ extern uschar *sender_rate_limit; /* Configured rate limit */ extern uschar *sender_rate_period; /* Configured smoothing period */ @@ -684,6 +685,7 @@ extern BOOL strip_excess_angle_brackets; /* Surrounding route-addrs */ extern BOOL strip_trailing_dot; /* Remove dots at ends of domains */ extern uschar *submission_domain; /* Domain for submission mode */ extern BOOL submission_mode; /* Can be forced from ACL */ +extern uschar *submission_name; /* User name set from ACL */ extern BOOL synchronous_delivery; /* TRUE if -odi is set */ extern BOOL syslog_duplication; /* FALSE => no duplicate logging */ extern int syslog_facility; /* As defined by Syslog.h */ diff --git a/src/src/receive.c b/src/src/receive.c index e2d6a1a1d..75447499b 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/receive.c,v 1.22 2005/08/01 14:41:25 ph10 Exp $ */ +/* $Cambridge: exim/src/src/receive.c,v 1.23 2005/09/07 10:15:33 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -2338,6 +2338,28 @@ Sender: if it is required. */ if (from_header == NULL && (sender_host_address == NULL || submission_mode)) { + uschar *oname = US""; + + /* Use the originator_name if this is a locally submitted message and the + caller is not trusted. For trusted callers, use it only if -F was used to + force its value or if we have a non-SMTP message for which -f was not used + to set the sender. */ + + if (sender_host_address == NULL) + { + if (!trusted_caller || sender_name_forced || + (!smtp_input && !sender_address_forced)) + oname = originator_name; + } + + /* For non-locally submitted messages, the only time we use the originator + name is when it was forced by the /name= option on control=submission. */ + + else + { + if (submission_name != NULL) oname = submission_name; + } + /* Envelope sender is empty */ if (sender_address[0] == 0) @@ -2345,8 +2367,8 @@ if (from_header == NULL && (sender_host_address == NULL || submission_mode)) uschar *fromstart, *fromend; fromstart = string_sprintf("%sFrom: %s%s", resent_prefix, - originator_name, (originator_name[0] == 0)? "" : " <"); - fromend = (originator_name[0] == 0)? US"" : US">"; + oname, (oname[0] == 0)? "" : " <"); + fromend = (oname[0] == 0)? US"" : US">"; if (sender_local || local_error_message) { @@ -2384,11 +2406,11 @@ if (from_header == NULL && (sender_host_address == NULL || submission_mode)) else { header_add(htype_from, "%sFrom: %s%s%s%s\n", resent_prefix, - originator_name, - (originator_name[0] == 0)? "" : " <", + oname, + (oname[0] == 0)? "" : " <", (sender_address_unrewritten == NULL)? sender_address : sender_address_unrewritten, - (originator_name[0] == 0)? "" : ">"); + (oname[0] == 0)? "" : ">"); from_header = header_last; /* To get it checked for Sender: */ } @@ -2469,12 +2491,14 @@ if (from_header != NULL && if (make_sender) { - if (submission_mode && originator_name[0] == 0) + if (submission_mode && submission_name == NULL) header_add(htype_sender, "%sSender: %s\n", resent_prefix, generated_sender_address); else header_add(htype_sender, "%sSender: %s <%s>\n", - resent_prefix, originator_name, generated_sender_address); + resent_prefix, + submission_mode? submission_name : originator_name, + generated_sender_address); } /* Ensure that a non-null envelope sender address corresponds to the diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index f6a2af89c..b30959e82 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/smtp_in.c,v 1.23 2005/08/22 14:01:37 ph10 Exp $ */ +/* $Cambridge: exim/src/src/smtp_in.c,v 1.24 2005/09/07 10:15:33 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -815,6 +815,7 @@ submission_mode = FALSE; /* Can be set by ACL */ active_local_from_check = local_from_check; /* Can be set by ACL */ active_local_sender_retain = local_sender_retain; /* Can be set by ACL */ sender_address = NULL; +submission_name = NULL; /* Can be set by ACL */ raw_sender = NULL; /* After SMTP rewrite, before qualifying */ sender_address_unrewritten = NULL; /* Set only after verify rewrite */ sender_verified_list = NULL; /* No senders verified */