diff --git a/lib/parser.js b/lib/parser.js index 46a0f444..f94032ee 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -54,10 +54,16 @@ p.parseMessage = function() { p.parseR = function(msg) { if(msg.length == 8) { - this.offset += 4; + msg.code = this.parseInt32(); + } + if(msg.code == 0) { return msg; } - throw new Error("Unknown authenticatinOk message type"); + if(msg.code == 3) { + msg.name = 'authenticationCleartextPassword'; + return msg; + } + throw new Error("Unknown authenticatinOk message type" + sys.inspect(msg)); }; p.parseS = function(msg) { diff --git a/test/unit/test-buffers.js b/test/unit/test-buffers.js index bf9b493d..e7b6c7f4 100644 --- a/test/unit/test-buffers.js +++ b/test/unit/test-buffers.js @@ -9,7 +9,7 @@ buffers.readyForQuery = function() { buffers.authenticationOk = function() { return new BufferList() - .addInt32(8) + .addInt32(0) .join(true, 'R'); };