GnuTLS: fix to ignore timeout on unrelated callout connection. Bug 2174
authorJeremy Harris <jgh146exb@wizmail.org>
Sat, 27 Jan 2018 15:03:01 +0000 (15:03 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Sat, 27 Jan 2018 15:11:09 +0000 (15:11 +0000)
doc/doc-txt/ChangeLog
src/src/tls-gnu.c

index f41932c00b9a38d0dae80348b575b5882a2af927..22f65c8724f7eb08265d65bd476f6146432daaef 100644 (file)
@@ -52,6 +52,12 @@ JH/13 Bug 2229: Fix cutthrough routing for nonstandard port numbers defined by
       routers.  Previously, a multi-recipient message would fail to match the
       onward-connection opened for the first recipient, and cause its closure.
 
       routers.  Previously, a multi-recipient message would fail to match the
       onward-connection opened for the first recipient, and cause its closure.
 
+JH/14 Bug 2174: A timeout on connect for a callout was also erroneously seen as
+      a timeout on read on a GnuTLS initiating connection, resulting in the
+      initiating connection being dropped.  This mattered most when the callout
+      was marked defer_ok.  Fix to keep the two timeout-detection methods
+      separate.
+
 
 Exim version 4.90
 -----------------
 
 Exim version 4.90
 -----------------
index 527ad28b216333c9f95ceb595891b9c40c9d68f7..fc3aba59fd3c6b6787a27332c0062c4a0afa3ea1 100644 (file)
@@ -2105,10 +2105,8 @@ DEBUG(D_tls) debug_printf("about to gnutls_handshake\n");
 sigalrm_seen = FALSE;
 alarm(ob->command_timeout);
 do
 sigalrm_seen = FALSE;
 alarm(ob->command_timeout);
 do
-  {
   rc = gnutls_handshake(state->session);
   rc = gnutls_handshake(state->session);
-  } while ((rc == GNUTLS_E_AGAIN) ||
-      (rc == GNUTLS_E_INTERRUPTED && !sigalrm_seen));
+while (rc == GNUTLS_E_AGAIN || rc == GNUTLS_E_INTERRUPTED && !sigalrm_seen);
 alarm(0);
 
 if (rc != GNUTLS_E_SUCCESS)
 alarm(0);
 
 if (rc != GNUTLS_E_SUCCESS)
@@ -2225,6 +2223,7 @@ ssize_t inbytes;
 DEBUG(D_tls) debug_printf("Calling gnutls_record_recv(%p, %p, %u)\n",
   state->session, state->xfer_buffer, ssl_xfer_buffer_size);
 
 DEBUG(D_tls) debug_printf("Calling gnutls_record_recv(%p, %p, %u)\n",
   state->session, state->xfer_buffer, ssl_xfer_buffer_size);
 
+sigalrm_seen = FALSE;
 if (smtp_receive_timeout > 0) alarm(smtp_receive_timeout);
 inbytes = gnutls_record_recv(state->session, state->xfer_buffer,
   MIN(ssl_xfer_buffer_size, lim));
 if (smtp_receive_timeout > 0) alarm(smtp_receive_timeout);
 inbytes = gnutls_record_recv(state->session, state->xfer_buffer,
   MIN(ssl_xfer_buffer_size, lim));