From 9fabc8c7e29cb421b19ed4a3def77209193a3529 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 28 Jun 2021 22:17:22 +0100 Subject: [PATCH] LibreSSL: TLS-write-shutdown does not push data --- src/src/exim.h | 8 ++++++++ src/src/transports/smtp.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/src/exim.h b/src/src/exim.h index 8bbeecb4d..484276bb2 100644 --- a/src/src/exim.h +++ b/src/src/exim.h @@ -659,5 +659,13 @@ default to EDQUOT if it exists, otherwise ENOSPC. */ # define EXIM_TCP_CORK TCP_NOPUSH #endif +/* LibreSSL seems to not push out the SMTP response to QUIT with our usual +handling which is trying to get the client to FIN first so that the server does +not get the TIME_WAIT */ + +#if !defined(DISABLE_TLS) && defined(USE_OPENSSL) && defined(LIBRESSL_VERSION_NUMBER) +# define SERVERSIDE_CLOSE_NOWAIT +#endif + #endif /* End of exim.h */ diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index dfb4a9284..3210e596c 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -4102,7 +4102,7 @@ else sx->send_quit = FALSE; /* avoid sending it later */ #ifndef DISABLE_TLS - if (sx->cctx.tls_ctx) /* need to send TLS Cloe Notify */ + if (sx->cctx.tls_ctx) /* need to send TLS Close Notify */ { # ifdef EXIM_TCP_CORK /* Use _CORK to get Close Notify in FIN segment */ (void) setsockopt(sx->cctx.sock, IPPROTO_TCP, EXIM_TCP_CORK, US &on, sizeof(on)); -- 2.30.2