fixed issue #5301, fixed caching_sha2_password full auth

This commit is contained in:
jianghang.loujh
2024-12-24 16:39:21 +08:00
parent 7ee551cbf7
commit 515c05c873

View File

@@ -228,7 +228,7 @@ public class MysqlConnector {
if (handshakePacket.authPluginName != null && handshakePacket.authPluginName.length > 0) { if (handshakePacket.authPluginName != null && handshakePacket.authPluginName.length > 0) {
authPluginName = new String(handshakePacket.authPluginName); authPluginName = new String(handshakePacket.authPluginName);
} }
logger.info("auth ClientAuthenticationSHA2Packet: {}", authPluginName); logger.info("auth plugin: {}", authPluginName);
boolean isSha2Password = false; boolean isSha2Password = false;
ClientAuthenticationPacket clientAuth; ClientAuthenticationPacket clientAuth;
if ("caching_sha2_password".equals(authPluginName)) { if ("caching_sha2_password".equals(authPluginName)) {
@@ -316,9 +316,6 @@ public class MysqlConnector {
// fixed issue https://github.com/alibaba/canal/pull/4767, support mysql 8.0.30+ // fixed issue https://github.com/alibaba/canal/pull/4767, support mysql 8.0.30+
header = cachingSha2PasswordFullAuth(channel, header, getPassword().getBytes(), scramble); header = cachingSha2PasswordFullAuth(channel, header, getPassword().getBytes(), scramble);
body = PacketManager.readBytes(channel, header.getPacketBodyLength(), timeout); body = PacketManager.readBytes(channel, header.getPacketBodyLength(), timeout);
} else {
header = PacketManager.readHeader(channel, 4);
body = PacketManager.readBytes(channel, header.getPacketBodyLength(), timeout);
} }
} }
} else { } else {