-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support authentication switch request. Fixes #1396
Add optional auth plugin name and data to UseOldPasswordPacket. Support mysql_native_password and mysql_old_password as potential authentication methods (but still require 'insecureAuth:true' for the latter).
- Loading branch information
Showing
7 changed files
with
114 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
lib/protocol/packets/AuthenticationSwitchResponsePacket.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module.exports = AuthenticationSwitchResponsePacket; | ||
function AuthenticationSwitchResponsePacket(options) { | ||
options = options || {}; | ||
|
||
this.scrambleBuff = options.scrambleBuff; | ||
} | ||
|
||
AuthenticationSwitchResponsePacket.prototype.parse = function(parser) { | ||
this.scrambleBuff = parser.parsePacketTerminatedBuffer(); | ||
}; | ||
|
||
AuthenticationSwitchResponsePacket.prototype.write = function(writer) { | ||
writer.writeBuffer(this.scrambleBuff); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
var common = require('../../common'); | ||
var connection = common.createConnection({ | ||
port : common.fakeServerPort, | ||
password : 'authswitch' | ||
}); | ||
var assert = require('assert'); | ||
|
||
var server = common.createFakeServer(); | ||
|
||
var connected; | ||
server.listen(common.fakeServerPort, function(err) { | ||
if (err) throw err; | ||
|
||
connection.connect(function(err, result) { | ||
if (err) throw err; | ||
|
||
connected = result; | ||
|
||
connection.destroy(); | ||
server.destroy(); | ||
}); | ||
}); | ||
|
||
server.on('connection', function(incomingConnection) { | ||
incomingConnection.handshake({ | ||
user : connection.config.user, | ||
password : connection.config.password, | ||
forceAuthSwitch : true | ||
}); | ||
}); | ||
|
||
process.on('exit', function() { | ||
assert.equal(connected.fieldCount, 0); | ||
}); |