From: Philip Hazel Date: Mon, 8 Aug 2005 15:02:48 +0000 (+0000) Subject: Incorrect port was logged when an SRV record specified a special port. X-Git-Tag: exim-4_53~53 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/2d280592a7f859d1e06738d86c3bc43382f1b791 Incorrect port was logged when an SRV record specified a special port. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 2f3153030..62da9c879 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.202 2005/08/08 10:48:26 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.203 2005/08/08 15:02:48 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -73,6 +73,10 @@ PH/18 Reversed 4.52/PH/17 because the HP-UX user found it wasn't the cause PH/19 Added sqlite_lock_timeout option (David Woodhouse's patch). +PH/20 If a delivery was routed to a non-standard port by means of an SRV + record, the port was not correctly logged when the outgoing_port log + selector was set (it logged the transort's default port). + Exim version 4.52 ----------------- diff --git a/src/src/smtp_out.c b/src/src/smtp_out.c index 696cfff5d..df4dc5a4f 100644 --- a/src/src/smtp_out.c +++ b/src/src/smtp_out.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/smtp_out.c,v 1.5 2005/06/27 14:29:43 ph10 Exp $ */ +/* $Cambridge: exim/src/src/smtp_out.c,v 1.6 2005/08/08 15:02:48 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -155,12 +155,13 @@ non-IPv6 systems, to enable the code to be less messy. However, on such systems host->address will always be an IPv4 address. The port field in the host item is used if it is set (usually router from SRV -records). In other cases, the default passed as an argument is used. +records or elsewhere). In other cases, the default passed as an argument is +used, and the host item is updated with its value. Arguments: host host item containing name and address (and sometimes port) host_af AF_INET or AF_INET6 - port default, remote port to connect to, in host byte order for those + port default remote port to connect to, in host byte order, for those hosts whose port setting is PORT_NONE interface outgoing interface address or NULL timeout timeout value or 0 @@ -184,6 +185,7 @@ if (host->port != PORT_NONE) host->port); port = host->port; } +else host->port = port; /* Set the port actually used */ HDEBUG(D_transport|D_acl|D_v) { diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 42179898a..c16e620b3 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.15 2005/08/02 11:22:24 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/smtp.c,v 1.16 2005/08/08 15:02:48 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -749,7 +749,7 @@ Arguments: failed by one of them. host host to deliver to host_af AF_INET or AF_INET6 - port TCP/IP port to use, in host byte order + port default TCP/IP port to use, in host byte order interface interface to bind to, or NULL tblock transport instance block copy_host TRUE if host set in addr->host_used must be copied, because @@ -1577,11 +1577,10 @@ if (!ok) ok = TRUE; else } /* SMTP, or success return from LMTP for this address. Pass back the - actual port used. */ + actual host that was used. */ addr->transport_return = OK; addr->more_errno = delivery_time; - thost->port = port; addr->host_used = thost; addr->special_action = flag; addr->message = conf; @@ -2130,12 +2129,9 @@ else if (ob->hosts_randomize && hostlist->mx == MX_NONE && !continuing) } -/* Sort out the port. Set up a string for adding to the retry key if the port -number is not the standard SMTP port. */ +/* Sort out the default port. */ if (!smtp_get_port(ob->port, addrlist, &port, tid)) return FALSE; -pistring = string_sprintf(":%d", port); -if (Ustrcmp(pistring, ":25") == 0) pistring = US""; /* For each host-plus-IP-address on the list: @@ -2210,6 +2206,14 @@ for (cutoff_retry = 0; expired && uschar *retry_message_key = NULL; uschar *serialize_key = NULL; + /* Set up a string for adding to the retry key if the port number is not + the standard SMTP port. A host may have its own port setting that overrides + the default. */ + + pistring = string_sprintf(":%d", (host->port == PORT_NONE)? + port : host->port); + if (Ustrcmp(pistring, ":25") == 0) pistring = US""; + /* Default next host is next host. :-) But this can vary if the hosts_max_try limit is hit (see below). It may also be reset if a host address is looked up here (in case the host was multihomed). */