summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2005-08-08 15:02:48 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2005-08-08 15:02:48 +0000
commit2d280592a7f859d1e06738d86c3bc43382f1b791 (patch)
tree204fb9a0092ff96be7196076361785dbb9412a23 /src
parent78d6ddf8d63d20d7b33f66256ae0b2029104912b (diff)
Incorrect port was logged when an SRV record specified a special port.
Diffstat (limited to 'src')
-rw-r--r--src/src/smtp_out.c8
-rw-r--r--src/src/transports/smtp.c20
2 files changed, 17 insertions, 11 deletions
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). */