From: Jeremy Harris Date: Thu, 5 Jul 2012 21:52:08 +0000 (+0100) Subject: Delay expansion of smtp transport option "authenticated_sender" X-Git-Tag: exim-4_81_RC1~48 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/6b62e89971d1bb83a604b3aab7ef6d61aa0ee81c Delay expansion of smtp transport option "authenticated_sender" after connection startup, to match documentation - bug 1144. --- diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 94b848540..f7af921af 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -921,29 +921,6 @@ tls_out.peerdn = NULL; tls_out.sni = NULL; #endif -/* If an authenticated_sender override has been specified for this transport -instance, expand it. If the expansion is forced to fail, and there was already -an authenticated_sender for this message, the original value will be used. -Other expansion failures are serious. An empty result is ignored, but there is -otherwise no check - this feature is expected to be used with LMTP and other -cases where non-standard addresses (e.g. without domains) might be required. */ - -if (ob->authenticated_sender != NULL) - { - uschar *new = expand_string(ob->authenticated_sender); - if (new == NULL) - { - if (!expand_string_forcedfail) - { - uschar *message = string_sprintf("failed to expand " - "authenticated_sender: %s", expand_string_message); - set_errno(addrlist, 0, message, DEFER, FALSE); - return ERROR; - } - } - else if (new[0] != 0) local_authenticated_sender = new; - } - #ifndef SUPPORT_TLS if (smtps) { @@ -1488,6 +1465,29 @@ if (smtp_use_size) while (*p) p++; } +/* If an authenticated_sender override has been specified for this transport +instance, expand it. If the expansion is forced to fail, and there was already +an authenticated_sender for this message, the original value will be used. +Other expansion failures are serious. An empty result is ignored, but there is +otherwise no check - this feature is expected to be used with LMTP and other +cases where non-standard addresses (e.g. without domains) might be required. */ + +if (ob->authenticated_sender != NULL) + { + uschar *new = expand_string(ob->authenticated_sender); + if (new == NULL) + { + if (!expand_string_forcedfail) + { + uschar *message = string_sprintf("failed to expand " + "authenticated_sender: %s", expand_string_message); + set_errno(addrlist, 0, message, DEFER, FALSE); + return ERROR; + } + } + else if (new[0] != 0) local_authenticated_sender = new; + } + /* Add the authenticated sender address if present */ if ((smtp_authenticated || ob->authenticated_sender_force) &&