[exim-cvs] Expansions: Fix ${readsocket } to do nicer TLS cl…

Pàgina inicial
Delete this message
Reply to this message
Autor: Exim Git Commits Mailing List
Data:  
A: exim-cvs
Assumpte: [exim-cvs] Expansions: Fix ${readsocket } to do nicer TLS close
Gitweb: https://git.exim.org/exim.git/commitdiff/f1bf269876f4e32b074d271168edc2af64e1c7a6
Commit:     f1bf269876f4e32b074d271168edc2af64e1c7a6
Parent:     8d960c19a447e105a4375c2cbcd0c9493622b6a2
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sat Apr 1 21:47:20 2023 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Sat Apr 1 21:48:28 2023 +0100


    Expansions: Fix ${readsocket } to do nicer TLS close
---
 doc/doc-txt/ChangeLog      | 3 +++
 src/src/lookups/readsock.c | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 71f71a6ca..16d2b8ef8 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -119,6 +119,9 @@ JH/25 Bug 2827: Restrict size of References: header in bounce messages to 998
       a not-impossible References: in the message being bounced could still
       be over-large and get stopped in the transport.


+JH/26 For a ${readsocket } in TLS mode, send a TLS Close Alert before the TCP
+      close.  Previously a bare socket close was done.
+


Exim version 4.96
-----------------
diff --git a/src/src/lookups/readsock.c b/src/src/lookups/readsock.c
index a3f87108a..73cc02813 100644
--- a/src/src/lookups/readsock.c
+++ b/src/src/lookups/readsock.c
@@ -275,6 +275,10 @@ if (!lf.cache) *do_cache = 0;

out:

+#ifndef DISABLE_TLS
+if (cctx->tls_ctx) tls_close(cctx->tls_ctx, TLS_SHUTDOWN_NOWAIT);
+#endif
+
(void) close(cctx->sock);
cctx->sock = -1;
return ret;
@@ -294,7 +298,7 @@ readsock_close(void * handle)
client_conn_ctx * cctx = handle;
if (cctx->sock < 0) return;
#ifndef DISABLE_TLS
-if (cctx->tls_ctx) tls_close(cctx->tls_ctx, TRUE);
+if (cctx->tls_ctx) tls_close(cctx->tls_ctx, TLS_SHUTDOWN_NOWAIT);
#endif
close(cctx->sock);
cctx->sock = -1;