git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/4] imap-send: avoid deprecated TLSv1_method()

From
Kazuki Yamaguchi <k@rhe.jp>
Date
Apr 8, 2016, 16:22 UTC
Message-ID
<ecc1d4f5988f6420639f4b7500a9d3782d7c1199.1460130092.git.k@rhe.jp>
In-Reply-To
<cover.1460130092.git.k@rhe.jp>
Use SSLv23_method always and disable SSL if needed.

TLSv1_method() function is deprecated in OpenSSL 1.1.0 and the compiler emits a warning.

SSLv23_method() is also deprecated, but the alternative, TLS_method(), is new in OpenSSL 1.1.0 so requires checking by configure. Stick to SSLv23_method() for now (this is aliased to TLS_method()).

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
---
 imap-send.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/imap-send.c b/imap-send.c
index c5e24a35491d..f53380562c4d 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -287,11 +287,7 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve
 	SSL_library_init();
 	SSL_load_error_strings();
 
-	if (use_tls_only)
-		meth = TLSv1_method();
-	else
-		meth = SSLv23_method();
-
+	meth = SSLv23_method();
 	if (!meth) {
 		ssl_socket_perror("SSLv23_method");
 		return -1;
@@ -303,6 +299,9 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve
 		return -1;
 	}
 
+	if (use_tls_only)
+		SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
+
 	if (verify)
 		SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, NULL);
 
-- 
2.8.1.104.g0d1aca6
Previous: Kazuki YamaguchiNext: Kazuki Yamaguchi
Message 4 of 5 in “fix compilation with OpenSSL 1.1.0-pre4”
  1. 0/4 fix compilation with OpenSSL 1.1.0-pre4Kazuki Yamaguchi, Apr 8, 2016
  2. 1/4 imap-send: use HMAC() function provided by OpenSSLKazuki Yamaguchi, Apr 8, 2016
  3. 2/4 imap-send: check NULL return of SSL_CTX_new()Kazuki Yamaguchi, Apr 8, 2016
  4. 3/4 imap-send: avoid deprecated TLSv1_method()Kazuki Yamaguchi, Apr 8, 2016
  5. 4/4 configure: remove checking for HMAC_CTX_cleanupKazuki Yamaguchi, Apr 8, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.