Skip to content

Commit f21772f

Browse files
authored
Merge pull request #1552 from silverbullettruck2001/add-mysql_clear_password-auth
Add mysql clear password auth
2 parents 5eeb4f6 + eddfb59 commit f21772f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict'
2+
3+
module.exports = pluginOptions => ({ connection, command }) => {
4+
const password =
5+
command.password || pluginOptions.password || connection.config.password;
6+
7+
const cleartextPassword = function(password) {
8+
return Buffer.from(`${password}\0`)
9+
};
10+
11+
return cleartextPassword(password)
12+
};

lib/commands/auth_switch.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ const Packets = require('../packets/index.js');
99
const sha256_password = require('../auth_plugins/sha256_password');
1010
const caching_sha2_password = require('../auth_plugins/caching_sha2_password.js');
1111
const mysql_native_password = require('../auth_plugins/mysql_native_password.js');
12+
const mysql_clear_password = require('../auth_plugins/mysql_clear_password.js');
1213

1314
const standardAuthPlugins = {
1415
sha256_password: sha256_password({}),
1516
caching_sha2_password: caching_sha2_password({}),
16-
mysql_native_password: mysql_native_password({})
17+
mysql_native_password: mysql_native_password({}),
18+
mysql_clear_password: mysql_clear_password({})
1719
};
1820

1921
function warnLegacyAuthSwitch() {

0 commit comments

Comments
 (0)