File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -2,14 +2,14 @@ var Buffer = require('safe-buffer').Buffer;
22var Crypto = require ( 'crypto' ) ;
33var Auth = exports ;
44
5- function auth ( name , data , options , isSecure ) {
5+ function auth ( name , data , options ) {
66 options = options || { } ;
77
88 switch ( name ) {
99 case 'mysql_native_password' :
1010 return Auth . token ( options . password , data . slice ( 0 , 20 ) ) ;
1111 case 'mysql_clear_password' :
12- if ( ! isSecure ) {
12+ if ( ! options . secureConnection && ! options . insecureAuth ) {
1313 throw new Error ( 'Authentication method mysql_clear_password not supported on insecure connections' ) ;
1414 } else {
1515 return Buffer . from ( options . password ) ;
Original file line number Diff line number Diff line change @@ -38,8 +38,10 @@ Handshake.prototype['AuthSwitchRequestPacket'] = function (packet) {
3838 var data , error ;
3939 try {
4040 data = Auth . auth ( name , packet . authMethodData , {
41- password : this . _config . password
42- } , this . _tls ) ;
41+ password : this . _config . password ,
42+ insecureAuth : this . _config . insecureAuth ,
43+ secureConnection : this . _secureConnection
44+ } ) ;
4345 } catch ( e ) {
4446 error = e ;
4547 }
@@ -87,7 +89,7 @@ Handshake.prototype['HandshakeInitializationPacket'] = function(packet) {
8789} ;
8890
8991Handshake . prototype . _tlsUpgradeCompleteHandler = function ( ) {
90- this . _tls = true ;
92+ this . _secureConnection = true ;
9193 this . _sendCredentials ( ) ;
9294} ;
9395
You can’t perform that action at this time.
0 commit comments