From 26da7e207f1978012085c096366d623dc15b9778 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Mon, 25 Sep 2006 11:25:37 +0000 Subject: Change callout EHLO/HELO from smtp_active_hostname to the helo_data setting from the transport, when there is one. --- src/README.UPDATING | 16 +++++++++++++++- src/src/structs.h | 3 ++- src/src/transports/smtp.c | 7 ++++--- src/src/verify.c | 35 +++++++++++++++++++++++++++++------ 4 files changed, 50 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/README.UPDATING b/src/README.UPDATING index e4975ba6a..45822fdef 100644 --- a/src/README.UPDATING +++ b/src/README.UPDATING @@ -1,4 +1,4 @@ -$Cambridge: exim/src/README.UPDATING,v 1.12 2006/07/13 13:53:33 ph10 Exp $ +$Cambridge: exim/src/README.UPDATING,v 1.13 2006/09/25 11:25:37 ph10 Exp $ This document contains detailed information about incompatibilities that might be encountered when upgrading from one release of Exim to another. The @@ -28,6 +28,20 @@ The rest of this document contains information about changes in 4.xx releases that might affect a running system. +Exim version 4.64 +----------------- + +1. Callouts were setting the name used for EHLO/HELO from $smtp_active_ +hostname. This is wrong, because it relates to the incoming message (and +probably the interface on which it is arriving) and not to the outgoing +callout (which could be using a different interface). This has been +changed to use the value of the helo_data option from the smtp transport +instead - this is what is used when a message is actually being sent. If +there is no remote transport (possible with a router that sets up host +addresses), $smtp_active_hostname is used. This change is mentioned here in +case somebody is relying on the use of $smtp_active_hostname. + + Exim version 4.63 ----------------- diff --git a/src/src/structs.h b/src/src/structs.h index 890867d0a..c5bb3b321 100644 --- a/src/src/structs.h +++ b/src/src/structs.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/structs.h,v 1.11 2006/09/19 11:28:45 ph10 Exp $ */ +/* $Cambridge: exim/src/src/structs.h,v 1.12 2006/09/25 11:25:37 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -89,6 +89,7 @@ typedef struct transport_feedback { uschar *port; uschar *protocol; uschar *hosts; + uschar *helo_data; BOOL hosts_override; BOOL hosts_randomize; BOOL gethostbyname; diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index e223bb183..3d7c64e40 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transports/smtp.c,v 1.25 2006/03/09 15:10:16 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/smtp.c,v 1.26 2006/09/25 11:25:37 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -203,8 +203,8 @@ static uschar *mail_command; /* Points to MAIL cmd for error messages */ but before running it in a sub-process. It is used for two things: (1) To set the fallback host list in addresses, when delivering. - (2) To pass back the interface, port, and protocol options, for use during - callout verification. + (2) To pass back the interface, port, protocol, and other options, for use + during callout verification. Arguments: tblock pointer to the transport instance block @@ -241,6 +241,7 @@ if (tf != NULL) tf->gethostbyname = ob->gethostbyname; tf->qualify_single = ob->dns_qualify_single; tf->search_parents = ob->dns_search_parents; + tf->helo_data = ob->helo_data; } /* Set the fallback host list for all the addresses that don't have fallback diff --git a/src/src/verify.c b/src/src/verify.c index 783378946..8881926b5 100644 --- a/src/src/verify.c +++ b/src/src/verify.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/verify.c,v 1.38 2006/09/05 13:24:10 ph10 Exp $ */ +/* $Cambridge: exim/src/src/verify.c,v 1.39 2006/09/25 11:25:37 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -389,6 +389,7 @@ for (host = host_list; host != NULL && !done; host = host->next) int host_af; int port = 25; BOOL send_quit = TRUE; + uschar *active_hostname = smtp_active_hostname; uschar *helo = US"HELO"; uschar *interface = NULL; /* Outgoing interface to use; NULL => any */ uschar inbuffer[4096]; @@ -435,6 +436,17 @@ for (host = host_list; host != NULL && !done; host = host->next) log_write(0, LOG_MAIN|LOG_PANIC, "<%s>: %s", addr->address, addr->message); + /* Expand the helo_data string to find the host name to use. */ + + if (tf->helo_data != NULL) + { + uschar *s = expand_string(tf->helo_data); + if (active_hostname == NULL) + log_write(0, LOG_MAIN|LOG_PANIC, "<%s>: failed to expand transport's " + "helo_data value for callout: %s", expand_string_message); + else active_hostname = s; + } + deliver_host = deliver_host_address = NULL; deliver_domain = save_deliver_domain; @@ -481,7 +493,7 @@ for (host = host_list; host != NULL && !done; host = host->next) smtp_read_response(&inblock, responsebuffer, sizeof(responsebuffer), '2', callout) && smtp_write_command(&outblock, FALSE, "%s %s\r\n", helo, - smtp_active_hostname) >= 0 && + active_hostname) >= 0 && smtp_read_response(&inblock, responsebuffer, sizeof(responsebuffer), '2', callout); @@ -1073,10 +1085,21 @@ while (addr_new != NULL) { host_item *host_list = addr->host_list; - /* Default, if no remote transport, to NULL for the interface (=> any), - "smtp" for the port, and "smtp" for the protocol. */ - - transport_feedback tf = { NULL, US"smtp", US"smtp", NULL, FALSE, FALSE }; + /* Make up some data for use in the case where there is no remote + transport. */ + + transport_feedback tf = { + NULL, /* interface (=> any) */ + US"smtp", /* port */ + US"smtp", /* protocol */ + NULL, /* hosts */ + US"$smtp_active_hostname", /* helo_data */ + FALSE, /* hosts_override */ + FALSE, /* hosts_randomize */ + FALSE, /* gethostbyname */ + TRUE, /* qualify_single */ + FALSE /* search_parents */ + }; /* If verification yielded a remote transport, we want to use that transport's options, so as to mimic what would happen if we were really -- cgit v1.2.3