Skip to content

Commit b51c0d4

Browse files
rheniumgitster
authored andcommitted
imap-send: avoid deprecated TLSv1_method()
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6738a33 commit b51c0d4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

imap-send.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,7 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve
287287
SSL_library_init();
288288
SSL_load_error_strings();
289289

290-
if (use_tls_only)
291-
meth = TLSv1_method();
292-
else
293-
meth = SSLv23_method();
294-
290+
meth = SSLv23_method();
295291
if (!meth) {
296292
ssl_socket_perror("SSLv23_method");
297293
return -1;
@@ -303,6 +299,9 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve
303299
return -1;
304300
}
305301

302+
if (use_tls_only)
303+
SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
304+
306305
if (verify)
307306
SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, NULL);
308307

0 commit comments

Comments
 (0)