Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #331 from sidorares/auth-switch
* allow to pass connection handler as createServer parameter * start using portfinder in tests * connection.end() for server said of connections pair * add connectAttributes config parameter * initial implementation of AuthSwitchRequest/Response/MoreData in handshake * use PLUGIN_AUTH flag by default only when authSwitchHandler connect parameter is set * change_user command flow when plugin auth is enabled * cleanup debug output * debug * christmas tree * fix typos * bisect * use portfinder to allocate test server ports * fix failing tests * don't crash in debug log if there is unexpected packet * don't crash in debug log if there is unexpected packet * don't crash in debug log if there is unexpected packet * don't crash in debug log if there is unexpected packet * remove debug * node 0.10: buffer.fill() does not return ref to buffer * node 0.10: buffer.fill() does not return ref to buffer * debug default flags * debugging change-user test * debug change-user * debug change-user * debug failing test only * update example * update example * typo * check server version * handle end of handshake if there is no switch-auth request * re-enable matrix * fix lint error * debug failing test * set packet length during real serializing * set mysql server tz offset to 0 in time-related tests * add auth-switch api to readme
- Loading branch information
Showing
32 changed files
with
719 additions
and
177 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ node_js: | |
- '0.10' | ||
- '0.12' | ||
- '4.4' | ||
- '5.11' | ||
- '5.12' | ||
- '6.2' | ||
|
||
|
||
|
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
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,37 @@ | ||
// http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::AuthSwitchRequest | ||
|
||
var Packet = require('../packets/packet'); | ||
|
||
function AuthSwitchRequest (opts) | ||
{ | ||
this.pluginName = opts.pluginName; | ||
this.pluginData = opts.pluginData; | ||
} | ||
|
||
AuthSwitchRequest.prototype.toPacket = function () | ||
{ | ||
var length = 6 + this.pluginName.length + this.pluginData.length; | ||
var buffer = new Buffer(length); | ||
var packet = new Packet(0, buffer, 0, length); | ||
packet.offset = 4; | ||
packet.writeInt8(0xfe); | ||
packet.writeNullTerminatedString(this.pluginName); | ||
packet.writeBuffer(this.pluginData); | ||
return packet; | ||
}; | ||
|
||
AuthSwitchRequest.fromPacket = function (packet) | ||
{ | ||
var marker = packet.readInt8(); | ||
// assert marker == 0xfe? | ||
|
||
var name = packet.readNullTerminatedString(); | ||
var data = packet.readBuffer(); | ||
|
||
return new AuthSwitchRequest({ | ||
pluginName: name, | ||
pluginData: data | ||
}); | ||
}; | ||
|
||
module.exports = AuthSwitchRequest; |
Oops, something went wrong.