mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
支持 mysql_clear_password 明文密码模式, 在一些开发、测试环境可能遇上。 (#4628)
Co-authored-by: zhongfu <zhongfu@tesla.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user