From 9edbe7e8275bef5619f426ff16d9a9f071e163d7 Mon Sep 17 00:00:00 2001 From: fuzhong-jiye Date: Thu, 16 Mar 2023 18:39:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=20mysql=5Fclear=5Fpassword?= =?UTF-8?q?=20=E6=98=8E=E6=96=87=E5=AF=86=E7=A0=81=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=20=E5=9C=A8=E4=B8=80=E4=BA=9B=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E3=80=81=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E9=81=87=E4=B8=8A=E3=80=82=20(#4628)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: zhongfu --- .../otter/canal/parse/driver/mysql/MysqlConnector.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/MysqlConnector.java b/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/MysqlConnector.java index 4cdd0af8..50e244d2 100644 --- a/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/MysqlConnector.java +++ b/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/MysqlConnector.java @@ -224,13 +224,15 @@ public class MysqlConnector { boolean isSha2Password = false; byte[] encryptedPassword = null; - if (pluginName != null && "mysql_native_password".equals(pluginName)) { + if ("mysql_clear_password".equals(pluginName)) { + encryptedPassword = getPassword().getBytes(); + } else if ("mysql_native_password".equals(pluginName)) { try { encryptedPassword = MySQLPasswordEncrypter.scramble411(getPassword().getBytes(), authData); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("can't encrypt password that will be sent to MySQL server.", e); } - } else if (pluginName != null && "caching_sha2_password".equals(pluginName)) { + } else if ("caching_sha2_password".equals(pluginName)) { isSha2Password = true; try { encryptedPassword = MySQLPasswordEncrypter.scrambleCachingSha2(getPassword().getBytes(), authData);