From 117b9d343b038135e35d789b17fa0025a6f09e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Sat, 13 May 2023 16:55:34 +0000 Subject: [PATCH] caching_sha2_password automatically enables SSL --- lib/MySQL_Protocol.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/MySQL_Protocol.cpp b/lib/MySQL_Protocol.cpp index c85b36444..7cd79c0f9 100644 --- a/lib/MySQL_Protocol.cpp +++ b/lib/MySQL_Protocol.cpp @@ -1246,7 +1246,10 @@ bool MySQL_Protocol::generate_pkt_initial_handshake(bool send, void **ptr, unsig } else { mysql_thread___server_capabilities &= ~CLIENT_COMPRESS; } - if (mysql_thread___have_ssl) { + if (mysql_thread___have_ssl==true || mysql_thread___default_authentication_plugin_int==2) { + // we enable SSL for client connections for either of these 2 conditions: + // - have_ssl is enabled + // - default_authentication_plugin=caching_sha2_password mysql_thread___server_capabilities |= CLIENT_SSL; } else { mysql_thread___server_capabilities &= ~CLIENT_SSL;