File tree Expand file tree Collapse file tree 4 files changed +42
-2
lines changed Expand file tree Collapse file tree 4 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ you spot any mistakes.
8
8
9
9
* Fix ` connection.threadId ` missing on handshake failure
10
10
* Fix duplicte packet name in debug output
11
+ * Fix no password support for old password protocol
11
12
* Remove special case for handshake in determine packet code
12
13
* Small performance improvement starting command sequence
13
14
Original file line number Diff line number Diff line change @@ -86,6 +86,10 @@ Auth.myRnd = function(r){
86
86
} ;
87
87
88
88
Auth . scramble323 = function ( message , password ) {
89
+ if ( ! password ) {
90
+ return Buffer . alloc ( 0 ) ;
91
+ }
92
+
89
93
var to = Buffer . allocUnsafe ( 8 ) ;
90
94
var hashPass = this . hashPassword ( password ) ;
91
95
var hashMessage = this . hashPassword ( message . slice ( 0 , 8 ) ) ;
Original file line number Diff line number Diff line change @@ -6,10 +6,9 @@ function OldPasswordPacket(options) {
6
6
}
7
7
8
8
OldPasswordPacket . prototype . parse = function ( parser ) {
9
- this . scrambleBuff = parser . parseNullTerminatedBuffer ( ) ;
9
+ this . scrambleBuff = parser . parsePacketTerminatedBuffer ( ) ;
10
10
} ;
11
11
12
12
OldPasswordPacket . prototype . write = function ( writer ) {
13
13
writer . writeBuffer ( this . scrambleBuff ) ;
14
- writer . writeFiller ( 1 ) ;
15
14
} ;
Original file line number Diff line number Diff line change
1
+ var assert = require ( 'assert' ) ;
2
+ var common = require ( '../../common' ) ;
3
+ var connection = common . createConnection ( {
4
+ port : common . fakeServerPort ,
5
+ user : 'root' ,
6
+ password : null ,
7
+ insecureAuth : true
8
+ } ) ;
9
+
10
+ var server = common . createFakeServer ( ) ;
11
+
12
+ server . listen ( common . fakeServerPort , function ( err ) {
13
+ assert . ifError ( err ) ;
14
+
15
+ connection . connect ( function ( err ) {
16
+ assert . ifError ( err ) ;
17
+ connection . destroy ( ) ;
18
+ server . destroy ( ) ;
19
+ } ) ;
20
+ } ) ;
21
+
22
+ server . on ( 'connection' , function ( incomingConnection ) {
23
+ incomingConnection . on ( 'clientAuthentication' , function ( ) {
24
+ this . _sendPacket ( new common . Packets . UseOldPasswordPacket ( ) ) ;
25
+ } ) ;
26
+
27
+ incomingConnection . on ( 'OldPasswordPacket' , function ( packet ) {
28
+ if ( packet . scrambleBuff . length === 0 ) {
29
+ this . ok ( ) ;
30
+ } else {
31
+ this . deny ( ) ;
32
+ }
33
+ } ) ;
34
+
35
+ incomingConnection . handshake ( ) ;
36
+ } ) ;
You can’t perform that action at this time.
0 commit comments