From 9fa2c8a9967d66739222915892b271f7b8a5ee99 Mon Sep 17 00:00:00 2001 From: Noah Gregory Date: Wed, 29 May 2019 15:54:15 -0400 Subject: [PATCH 1/4] change handling of user-set flags Originally, would only allow user-set flags that disable a flag enabled by default. Now it will also allow user-set flags that enable a flag that is disabled by default. --- lib/ConnectionConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ConnectionConfig.js b/lib/ConnectionConfig.js index 147aa0abb..6d56ed7b3 100644 --- a/lib/ConnectionConfig.js +++ b/lib/ConnectionConfig.js @@ -66,7 +66,7 @@ ConnectionConfig.mergeFlags = function mergeFlags(defaultFlags, userFlags) { // Merge the new flags for (var flag in newFlags) { - if (allFlags[flag] !== false) { + if (allFlags[flag] !== newFlags[flag]) { allFlags[flag] = newFlags[flag]; } } From 3607c4c30a34ef47c58f62b5fc74f0aba66b507d Mon Sep 17 00:00:00 2001 From: Noah Gregory Date: Wed, 29 May 2019 15:56:49 -0400 Subject: [PATCH 2/4] add support for 'mysql_clear_password' auth plugin --- lib/protocol/Auth.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/protocol/Auth.js b/lib/protocol/Auth.js index a1033d1b9..d2617c31a 100644 --- a/lib/protocol/Auth.js +++ b/lib/protocol/Auth.js @@ -8,6 +8,8 @@ function auth(name, data, options) { switch (name) { case 'mysql_native_password': return Auth.token(options.password, data.slice(0, 20)); + case 'mysql_clear_password': + return Buffer.from(options.password); default: return undefined; } From 37ef520cb274ba7b14f3576a9182b209a872541f Mon Sep 17 00:00:00 2001 From: Noah Gregory Date: Thu, 30 May 2019 20:36:35 -0400 Subject: [PATCH 3/4] add tests --- test/integration/connection/test-clear-auth-bad.js | 6 ++++++ test/integration/connection/test-clear-auth.js | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 test/integration/connection/test-clear-auth-bad.js create mode 100644 test/integration/connection/test-clear-auth.js diff --git a/test/integration/connection/test-clear-auth-bad.js b/test/integration/connection/test-clear-auth-bad.js new file mode 100644 index 000000000..f6e7b9bc3 --- /dev/null +++ b/test/integration/connection/test-clear-auth-bad.js @@ -0,0 +1,6 @@ +var assert = require('assert'); +var common = require('../../common'); + +common.getTestConnection({ flags: ['-PLUGIN_AUTH'] }, function (err) { + assert.ok(err, 'got error'); +}); diff --git a/test/integration/connection/test-clear-auth.js b/test/integration/connection/test-clear-auth.js new file mode 100644 index 000000000..46c9cc808 --- /dev/null +++ b/test/integration/connection/test-clear-auth.js @@ -0,0 +1,7 @@ +var assert = require('assert'); +var common = require('../../common'); + +common.getTestConnection({ flags: ['+PLUGIN_AUTH'] }, function (err, connection) { + assert.ifError(err, 'got error'); + connection.destroy(); +}); \ No newline at end of file From b63994524ea5ad92c1d23f91a5eb5316acc96463 Mon Sep 17 00:00:00 2001 From: Noah Gregory Date: Sun, 2 Jun 2019 21:28:26 -0400 Subject: [PATCH 4/4] Delete test as it only passes for specific servers --- test/integration/connection/test-clear-auth-bad.js | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 test/integration/connection/test-clear-auth-bad.js diff --git a/test/integration/connection/test-clear-auth-bad.js b/test/integration/connection/test-clear-auth-bad.js deleted file mode 100644 index f6e7b9bc3..000000000 --- a/test/integration/connection/test-clear-auth-bad.js +++ /dev/null @@ -1,6 +0,0 @@ -var assert = require('assert'); -var common = require('../../common'); - -common.getTestConnection({ flags: ['-PLUGIN_AUTH'] }, function (err) { - assert.ok(err, 'got error'); -});