-
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
Rename UseOldPasswordPacket to AuthenticationMethodSwitchRequestPacket and implement its two other fields: plugin name & data. 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
78 additions
and
27 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
22 changes: 22 additions & 0 deletions
22
lib/protocol/packets/AuthenticationMethodSwitchRequestPacket.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,22 @@ | ||
module.exports = AuthenticationMethodSwitchRequestPacket; | ||
function AuthenticationMethodSwitchRequestPacket(options) { | ||
options = options || {}; | ||
|
||
this.command = 0xfe; | ||
this.methodName = options.methodName || 'mysql_native_password'; | ||
this.pluginData = options.pluginData; | ||
} | ||
|
||
AuthenticationMethodSwitchRequestPacket.prototype.parse = function(parser) { | ||
this.command = parser.parseUnsignedNumber(1); | ||
this.methodName = parser.parseNullTerminatedString(); | ||
this.pluginData = parser.parsePacketTerminatedBuffer(); | ||
}; | ||
|
||
AuthenticationMethodSwitchRequestPacket.prototype.write = function(writer) { | ||
writer.writeUnsignedNumber(1, this.command); | ||
writer.writeNullTerminatedString(this.methodName); | ||
if (this.pluginData !== undefined) { | ||
writer.writeBuffer(this.pluginData); | ||
} | ||
}; |
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 was deleted.
Oops, something went wrong.
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