Change PH/12 for 4.50 fixed one bug and introduced another; if a host's
[exim.git] / src / src / transports / smtp.c
index be8b15029696e73d34ce1200ecc8aedb0ec65f2c..f53d742e4cc89ca80e21abf7f8a05c1afa72f230 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/transports/smtp.c,v 1.7 2005/03/08 15:32:02 tom Exp $ */
+/* $Cambridge: exim/src/src/transports/smtp.c,v 1.10 2005/04/07 10:54:54 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -1020,8 +1020,11 @@ if (tls_offered && !suppress_tls &&
 
     for (addr = addrlist; addr != NULL; addr = addr->next)
       {
-      addr->cipher = tls_cipher;
-      addr->peerdn = tls_peerdn;
+      if (addr->transport_return == PENDING_DEFER)
+        {
+        addr->cipher = tls_cipher;
+        addr->peerdn = tls_peerdn;
+        }
       }
     }
   }
@@ -2173,7 +2176,8 @@ for (cutoff_retry = 0; expired &&
     uschar *serialize_key = NULL;
 
     /* Default next host is next host. :-) But this can vary if the
-    hosts_max_try limit is hit (see below). */
+    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). */
 
     nexthost = host->next;
 
@@ -2283,6 +2287,11 @@ for (cutoff_retry = 0; expired &&
       continue;      /* With next host */
       }
 
+    /* Reset the default next host in case a multihomed host whose addresses
+    are not looked up till just above added to the host list. */
+
+    nexthost = host->next;
+
     /* If queue_smtp is set (-odqs or the first part of a 2-stage run), or the
     domain is in queue_smtp_domains, we don't actually want to attempt any
     deliveries. When doing a queue run, queue_smtp_domains is always unset. If