From: Philip Hazel Date: Tue, 19 Oct 2004 11:04:26 +0000 (+0000) Subject: Added /sender_retain facility to control=submission, named by analogy X-Git-Tag: exim-4_50~131 X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/69358f0206debf14a18c7e798e23133d304232b6 Added /sender_retain facility to control=submission, named by analogy with the local_sender_retain option. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 01bb9a06a..a6ad9d25d 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.9 2004/10/18 11:36:23 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.10 2004/10/19 11:04:26 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -38,6 +38,8 @@ Exim version 4.44 "control" were broken. There should now be diagnostics for all cases when a control that does not make sense is encountered. + 9. Added the /retain_sender option to "control=submission". + Exim version 4.43 ----------------- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index 6d73f198a..1a4d69335 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/NewStuff,v 1.2 2004/10/18 09:16:57 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/NewStuff,v 1.3 2004/10/19 11:04:26 ph10 Exp $ New Features in Exim -------------------- @@ -16,6 +16,10 @@ Version 4.44 CONFIGURE_OWNER. It specifies one additional group that is permitted for the runtime configuration file when the group write permission is set. + 2. The "control=submission" facility has a new option /retain_sender. This + has the effect of setting local_sender_retain true and local_from_check + false for the incoming message in which it is encountered. + Version 4.43 ------------ diff --git a/src/src/acl.c b/src/src/acl.c index 1f767b65d..31087809b 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/acl.c,v 1.2 2004/10/18 11:36:23 ph10 Exp $ */ +/* $Cambridge: exim/src/src/acl.c,v 1.3 2004/10/19 11:04:26 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1384,14 +1384,26 @@ for (; cb != NULL; cb = cb->next) case CONTROL_SUBMISSION: submission_mode = TRUE; - if (Ustrncmp(p, "/domain=", 8) == 0) - { - submission_domain = string_copy(p+8); - } - else if (*p != 0) + while (*p == '/') + { + if (Ustrncmp(p, "/sender_retain", 14) == 0) + { + p += 14; + active_local_sender_retain = TRUE; + active_local_from_check = FALSE; + } + else if (Ustrncmp(p, "/domain=", 8) == 0) + { + uschar *pp = p + 8; + while (*pp != 0 && *pp != '/') pp++; + submission_domain = string_copyn(p+8, pp-p); + p = pp; + } + else break; + } + if (*p != 0) { - *log_msgptr = string_sprintf("syntax error in argument for " - "\"control\" modifier \"%s\"", arg); + *log_msgptr = string_sprintf("syntax error in \"control=%s\"", arg); return ERROR; } break; diff --git a/src/src/exim.c b/src/src/exim.c index dcf261879..c8d1917a4 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/exim.c,v 1.4 2004/10/18 09:26:02 ph10 Exp $ */ +/* $Cambridge: exim/src/src/exim.c,v 1.5 2004/10/19 11:04:26 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -4393,6 +4393,11 @@ while (more) int rcount = 0; int count = argc - recipients_arg; uschar **list = argv + recipients_arg; + + /* These options cannot be changed dynamically for non-SMTP messages */ + + active_local_sender_retain = local_sender_retain; + active_local_from_check = local_from_check; /* Save before any rewriting */ diff --git a/src/src/globals.c b/src/src/globals.c index a206d4232..634fd6c23 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.c,v 1.2 2004/10/18 09:16:57 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.c,v 1.3 2004/10/19 11:04:26 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -209,7 +209,9 @@ int acl_wherecodes[] = { 550, /* RCPT */ 550, /* STARTTLS */ 252 /* VRFY */ }; - + +BOOL active_local_from_check = FALSE; +BOOL active_local_sender_retain = FALSE; BOOL accept_8bitmime = FALSE; address_item *addr_duplicate = NULL; diff --git a/src/src/globals.h b/src/src/globals.h index 9cd0bf72e..458e6638d 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.h,v 1.2 2004/10/18 09:16:57 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.h,v 1.3 2004/10/19 11:04:26 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -118,6 +118,8 @@ extern header_line *acl_warn_headers; /* Warning headers added by ACL */ extern string_item *acl_warn_logged; /* Logged lines */ extern int acl_wherecodes[]; /* Response codes for ACL fails */ extern uschar *acl_wherenames[]; /* Names for messages */ +extern BOOL active_local_from_check;/* For adding Sender: (switchable) */ +extern BOOL active_local_sender_retain; /* For keeping Sender: (switchable) */ extern address_item *addr_duplicate; /* Duplicate address list */ extern address_item address_defaults; /* Default data for address item */ extern uschar *address_file; /* Name of file when delivering to one */ @@ -324,7 +326,7 @@ extern int keep_malformed; /* Time to keep malformed messages */ extern uschar *eldap_dn; /* Where LDAP DNs are left */ extern int load_average; /* Most recently read load average */ extern BOOL local_error_message; /* True if handling one of these */ -extern BOOL local_from_check; /* For adding Sender: */ +extern BOOL local_from_check; /* For adding Sender: (global value) */ extern uschar *local_from_prefix; /* Permitted prefixes */ extern uschar *local_from_suffix; /* Permitted suffixes */ extern uschar *local_interfaces; /* For forcing specific interfaces */ diff --git a/src/src/receive.c b/src/src/receive.c index 1057d1122..0483bd5f5 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/receive.c,v 1.2 2004/10/18 11:36:23 ph10 Exp $ */ +/* $Cambridge: exim/src/src/receive.c,v 1.3 2004/10/19 11:04:26 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -971,8 +971,9 @@ The general actions of this function are: blocks. . If there is a "sender:" header and the message is locally originated, - throw it away, unless the caller is trusted, or unless local_sender_retain - is set - which can only happen if local_from_check is false. + throw it away, unless the caller is trusted, or unless + active_local_sender_retain is set - which can only happen if + active_local_from_check is false. . If recipients are to be extracted from the message, build the recipients list from the headers, removing any that were on the @@ -997,7 +998,7 @@ The general actions of this function are: . If the sender is local, check that from: is correct, and if not, generate a Sender: header, unless message comes from a trusted caller, or this - feature is disabled by no_local_from_check. + feature is disabled by active_local_from_check being false. . If there is no "date" header, generate one, for locally-originated or submission mode messages only. @@ -1767,17 +1768,16 @@ for (h = header_list->next; h != NULL; h = h->next) /* If there is a "Sender:" header and the message is locally originated, and from an untrusted caller, or if we are in submission mode for a remote message, mark it "old" so that it will not be transmitted with the message, - unless local_sender_retain is set. (This can only be true if - local_from_check is false.) If there are any resent- headers in the + unless active_local_sender_retain is set. (This can only be true if + active_local_from_check is false.) If there are any resent- headers in the message, apply this rule to Resent-Sender: instead of Sender:. Messages with multiple resent- header sets cannot be tidily handled. (For this reason, at least one MUA - Pine - turns old resent- headers into X-resent- headers when resending, leaving just one set.) */ case htype_sender: - h->type = (( - (sender_local && !trusted_caller && !local_sender_retain) || - submission_mode + h->type = ((!active_local_sender_retain && + ((sender_local && !trusted_caller) || submission_mode) ) && (!resents_exist||is_resent))? htype_old : htype_sender; @@ -2194,9 +2194,9 @@ more than one address, then the call to parse_extract_address fails, and a Sender: header is inserted, as required. */ if (from_header != NULL && - ( - (sender_local && local_from_check && !trusted_caller) || - (submission_mode && authenticated_id != NULL) + (active_local_from_check && + ((sender_local && !trusted_caller) || + (submission_mode && authenticated_id != NULL)) )) { BOOL make_sender = TRUE; diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index 8bc12debf..ff08cbd56 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.1 2004/10/07 10:39:01 ph10 Exp $ */ +/* $Cambridge: exim/src/src/smtp_in.c,v 1.2 2004/10/19 11:04:26 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -803,8 +803,10 @@ rcpt_count = rcpt_defer_count = rcpt_fail_count = message_size = -1; acl_warn_headers = NULL; queue_only_policy = FALSE; -deliver_freeze = FALSE; /* Can be set by ACL */ -submission_mode = FALSE; /* Can be set by ACL */ +deliver_freeze = FALSE; /* Can be set by ACL */ +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; raw_sender = NULL; /* After SMTP rewrite, before qualifying */ sender_address_unrewritten = NULL; /* Set only after verify rewrite */