X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/47c7a64acebb31f5b11e79d3da2e3cdcd56b3f68..d7d7b7b91dd75cec636fc144da7e27eed860f971:/src/src/deliver.c diff --git a/src/src/deliver.c b/src/src/deliver.c index 23875d959..9351d45d7 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -1,10 +1,10 @@ -/* $Cambridge: exim/src/src/deliver.c,v 1.21 2005/06/28 10:23:35 ph10 Exp $ */ +/* $Cambridge: exim/src/src/deliver.c,v 1.26 2006/02/07 11:19:00 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2005 */ +/* Copyright (c) University of Cambridge 1995 - 2006 */ /* See the file NOTICE for conditions of use and distribution. */ /* The main code for delivering a message. */ @@ -1304,6 +1304,14 @@ else if (tp->expand_gid != NULL) } } +/* If the transport did not set a group, see if the router did. */ + +if (!gid_set && testflag(addr, af_gid_set)) + { + *gidp = addr->gid; + gid_set = TRUE; + } + /* Pick up a uid from the transport if one is set. */ if (tp->uid_set) *uidp = tp->uid; @@ -1339,20 +1347,13 @@ else if (tp->deliver_as_creator) } } -/* Otherwise see if the address specifies the uid and if so, take its -initgroups flag. The gid from the address is taken only if the transport hasn't -set it. In other words, a gid on the transport overrides the gid on the -address. */ +/* Otherwise see if the address specifies the uid and if so, take it and its +initgroups flag. */ else if (testflag(addr, af_uid_set)) { *uidp = addr->uid; *igfp = testflag(addr, af_initgroups); - if (!gid_set) - { - *gidp = addr->gid; - gid_set = TRUE; - } } /* Nothing has specified the uid - default to the Exim user, and group if the @@ -1368,7 +1369,9 @@ else } } -/* If no gid is set, it is a disaster. */ +/* If no gid is set, it is a disaster. We default to the Exim gid only if +defaulting to the Exim uid. In other words, if the configuration has specified +a uid, it must also provide a gid. */ if (!gid_set) { @@ -1991,7 +1994,7 @@ if (addr->special_action == SPECIAL_WARN && if (errors_reply_to != NULL) fprintf(f, "Reply-To: %s\n", errors_reply_to); - fprintf(f, "Auto-Submitted: auto-generated\n"); + fprintf(f, "Auto-Submitted: auto-replied\n"); fprintf(f, "From: Mail Delivery System \n", qualify_domain_sender); fprintf(f, "%s", CS warn_message); @@ -5172,7 +5175,20 @@ while (addr_new != NULL) /* Loop until all addresses dealt with */ if (testflag(addr, af_pfr)) { - int offset = testflag(addr->parent, af_homonym)? 3:0; + /* If an autoreply in a filter could not generate a syntactically valid + address, give up forthwith. Set af_ignore_error so that we don't try to + generate a bounce. */ + + if (testflag(addr, af_bad_reply)) + { + addr->basic_errno = ERRNO_BADADDRESS2; + addr->local_part = addr->address; + addr->message = + US"filter autoreply generated syntactically invalid recipient"; + setflag(addr, af_ignore_error); + (void)post_process_one(addr, FAIL, LOG_MAIN, DTYPE_ROUTER, 0); + continue; /* with the next new address */ + } /* If two different users specify delivery to the same pipe or file or autoreply, there should be two different deliveries, so build a unique @@ -5180,7 +5196,8 @@ while (addr_new != NULL) /* Loop until all addresses dealt with */ duplicate testing and recording delivery, and also for retrying. */ addr->unique = - string_sprintf("%s:%s", addr->address, addr->parent->unique + offset); + string_sprintf("%s:%s", addr->address, addr->parent->unique + + (testflag(addr->parent, af_homonym)? 3:0)); addr->address_retry_key = addr->domain_retry_key = string_sprintf("T:%s", addr->unique); @@ -5856,6 +5873,15 @@ deliveries are done first, then remote ones. If ever the problems of how to handle fallback transports are figured out, this section can be put into a loop for handling fallbacks, though the uid switching will have to be revised. */ +/* Precompile a regex that is used to recognize a parameter in response +to an LHLO command, if is isn't already compiled. This may be used on both +local and remote LMTP deliveries. */ + +if (regex_IGNOREQUOTA == NULL) regex_IGNOREQUOTA = + regex_must_compile(US"\\n250[\\s\\-]IGNOREQUOTA(\\s|\\n|$)", FALSE, TRUE); + +/* Handle local deliveries */ + if (addr_local != NULL) { DEBUG(D_deliver|D_transport) @@ -6168,7 +6194,7 @@ while (addr_failed != NULL) if (errors_reply_to != NULL) fprintf(f, "Reply-To: %s\n", errors_reply_to); - fprintf(f, "Auto-Submitted: auto-generated\n"); + fprintf(f, "Auto-Submitted: auto-replied\n"); fprintf(f, "From: Mail Delivery System \n", qualify_domain_sender); fprintf(f, "To: %s\n", bounce_recipient); @@ -6690,7 +6716,7 @@ else if (addr_defer != (address_item *)(+1)) if (errors_reply_to != NULL) fprintf(f, "Reply-To: %s\n", errors_reply_to); - fprintf(f, "Auto-Submitted: auto-generated\n"); + fprintf(f, "Auto-Submitted: auto-replied\n"); fprintf(f, "From: Mail Delivery System \n", qualify_domain_sender); fprintf(f, "To: %s\n", recipients);