File tree 2 files changed +7
-5
lines changed
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;
2
2
var Crypto = require ( 'crypto' ) ;
3
3
var Auth = exports ;
4
4
5
- function auth ( name , data , options , isSecure ) {
5
+ function auth ( name , data , options ) {
6
6
options = options || { } ;
7
7
8
8
switch ( name ) {
9
9
case 'mysql_native_password' :
10
10
return Auth . token ( options . password , data . slice ( 0 , 20 ) ) ;
11
11
case 'mysql_clear_password' :
12
- if ( ! isSecure ) {
12
+ if ( ! options . secureConnection && ! options . insecureAuth ) {
13
13
throw new Error ( 'Authentication method mysql_clear_password not supported on insecure connections' ) ;
14
14
} else {
15
15
return Buffer . from ( options . password ) ;
Original file line number Diff line number Diff line change @@ -38,8 +38,10 @@ Handshake.prototype['AuthSwitchRequestPacket'] = function (packet) {
38
38
var data , error ;
39
39
try {
40
40
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
+ } ) ;
43
45
} catch ( e ) {
44
46
error = e ;
45
47
}
@@ -87,7 +89,7 @@ Handshake.prototype['HandshakeInitializationPacket'] = function(packet) {
87
89
} ;
88
90
89
91
Handshake . prototype . _tlsUpgradeCompleteHandler = function ( ) {
90
- this . _tls = true ;
92
+ this . _secureConnection = true ;
91
93
this . _sendCredentials ( ) ;
92
94
} ;
93
95
You can’t perform that action at this time.
0 commit comments