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;
|
boolean isSha2Password = false;
|
||||||
byte[] encryptedPassword = null;
|
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 {
|
try {
|
||||||
encryptedPassword = MySQLPasswordEncrypter.scramble411(getPassword().getBytes(), authData);
|
encryptedPassword = MySQLPasswordEncrypter.scramble411(getPassword().getBytes(), authData);
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
throw new RuntimeException("can't encrypt password that will be sent to MySQL server.", 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;
|
isSha2Password = true;
|
||||||
try {
|
try {
|
||||||
encryptedPassword = MySQLPasswordEncrypter.scrambleCachingSha2(getPassword().getBytes(), authData);
|
encryptedPassword = MySQLPasswordEncrypter.scrambleCachingSha2(getPassword().getBytes(), authData);
|
||||||
|
|||||||
Reference in New Issue
Block a user