TFO: use enum for client status
[exim.git] / src / src / transports / smtp.c
index b2adeb555a260c5cdf92f41813adb0a905d9bc7b..fba5a7ce82f64935dc76c83f75d8d8f57bb33603 100644 (file)
@@ -1254,19 +1254,20 @@ switch (rc)
        dns_scan dnss;
        dns_record * rr;
        for (rr = dns_next_rr(dnsa, &dnss, RESET_ANSWERS); rr;
-            rr = dns_next_rr(dnsa, &dnss, RESET_NEXT)) if (rr->type == T_TLSA)
-         {
-         uint16_t payload_length = rr->size - 3;
-         uschar s[MAX_TLSA_EXPANDED_SIZE], * sp = s, * p = US rr->data;
+            rr = dns_next_rr(dnsa, &dnss, RESET_NEXT))
+         if (rr->type == T_TLSA && rr->size > 3)
+           {
+           uint16_t payload_length = rr->size - 3;
+           uschar s[MAX_TLSA_EXPANDED_SIZE], * sp = s, * p = US rr->data;
 
-         sp += sprintf(CS sp, "%d ", *p++); /* usage */
-         sp += sprintf(CS sp, "%d ", *p++); /* selector */
-         sp += sprintf(CS sp, "%d ", *p++); /* matchtype */
-         while (payload_length-- > 0 && sp-s < (MAX_TLSA_EXPANDED_SIZE - 4))
-           sp += sprintf(CS sp, "%02x", *p++);
+           sp += sprintf(CS sp, "%d ", *p++); /* usage */
+           sp += sprintf(CS sp, "%d ", *p++); /* selector */
+           sp += sprintf(CS sp, "%d ", *p++); /* matchtype */
+           while (payload_length-- > 0 && sp-s < (MAX_TLSA_EXPANDED_SIZE - 4))
+             sp += sprintf(CS sp, "%02x", *p++);
 
-         debug_printf(" %s\n", s);
-         }
+           debug_printf(" %s\n", s);
+           }
        }
       return OK;
       }
@@ -2015,6 +2016,7 @@ if (  smtp_peer_options & OPTION_TLS
       /* TLS negotiation failed; give an error. From outside, this function may
       be called again to try in clear on a new connection, if the options permit
       it for this host. */
+      DEBUG(D_tls) debug_printf("TLS session fail: %s\n", errstr);
 
 # ifdef SUPPORT_DANE
       if (sx->dane)
@@ -2678,10 +2680,10 @@ for (addr = sx->first_addr, address_count = 0;
   BOOL no_flush;
   uschar * rcpt_addr;
 
-  if (tcp_out_fastopen && !f.tcp_out_fastopen_logged)
+  if (tcp_out_fastopen != TFO_NOT_USED && !f.tcp_out_fastopen_logged)
     {
     setflag(addr, af_tcp_fastopen_conn);
-    if (tcp_out_fastopen > 1) setflag(addr, af_tcp_fastopen);
+    if (tcp_out_fastopen >= TFO_USED) setflag(addr, af_tcp_fastopen);
     }
 
   addr->dsn_aware = sx->peer_offered & OPTION_DSN
@@ -4746,6 +4748,7 @@ retry_non_continued:
           "hosts_max_try (message older than host's retry time)\n");
         }
       }
+    if (f.running_in_test_harness) millisleep(500); /* let server debug out */
     }   /* End of loop for trying multiple hosts. */
 
   /* If we failed to find a matching host in the list, for an already-open