From e89aa9c84c5714f7a8bd8c30cc263b741d8c74c6 Mon Sep 17 00:00:00 2001 From: brianc Date: Sun, 24 Oct 2010 21:26:18 -0500 Subject: [PATCH] changed Connection#passwordMessage to Connection#password --- lib/client.js | 4 ++-- lib/connection.js | 2 +- test/integration/connection/cleartext-password-tests.js | 2 +- test/integration/connection/md5-password-tests.js | 2 +- test/unit/connection/outbound-sending-tests.js | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/client.js b/lib/client.js index 56a3b061..b4337943 100644 --- a/lib/client.js +++ b/lib/client.js @@ -44,14 +44,14 @@ p.connect = function() { }); con.on('authenticationCleartextPassword', function() { - con.passwordMessage(self.password); + con.password(self.password); }); con.on('authenticationMD5Password', function(msg) { var inner = Client.md5(self.password + self.user); var outer = Client.md5(inner + msg.salt.toString('binary')); var md5password = "md5" + outer; - con.passwordMessage(md5password); + con.password(md5password); }); }; diff --git a/lib/connection.js b/lib/connection.js index e900aee1..2c53ce83 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -59,7 +59,7 @@ p.startupMessage = function(config) { this.send(false, buffer.join()); }; -p.passwordMessage = function(password) { +p.password = function(password) { this.send('p', Buffer(password + '\0', this.encoding)); }; diff --git a/test/integration/connection/cleartext-password-tests.js b/test/integration/connection/cleartext-password-tests.js index d5434560..f447a882 100644 --- a/test/integration/connection/cleartext-password-tests.js +++ b/test/integration/connection/cleartext-password-tests.js @@ -2,7 +2,7 @@ var helper = require(__dirname + '/test-helper'); test('can log in with clear text password', function() { helper.authConnect('user_pw', 'postgres', function(con) { assert.raises(con, 'authenticationCleartextPassword', function() { - con.passwordMessage('pass'); + con.password('pass'); }); assert.raises(con, 'readyForQuery', function() { con.end(); diff --git a/test/integration/connection/md5-password-tests.js b/test/integration/connection/md5-password-tests.js index ee34b1df..e1116526 100644 --- a/test/integration/connection/md5-password-tests.js +++ b/test/integration/connection/md5-password-tests.js @@ -7,7 +7,7 @@ test('can log in with md5 password', function() { assert.ok(msg.salt); var enc = Client.md5('ssap' + 'user_md5'); enc = Client.md5(enc + msg.salt.toString('binary')); - con.passwordMessage('md5'+enc); + con.password('md5'+enc); }); assert.raises(con, 'readyForQuery', function() { con.end(); diff --git a/test/unit/connection/outbound-sending-tests.js b/test/unit/connection/outbound-sending-tests.js index 0547645a..67ec29c5 100644 --- a/test/unit/connection/outbound-sending-tests.js +++ b/test/unit/connection/outbound-sending-tests.js @@ -25,8 +25,8 @@ test("sends startup message", function() { .addCString('').join(true)) }); -test('sends passwordMessage', function() { - con.passwordMessage("!"); +test('sends password message', function() { + con.password("!"); assert.recieved(stream, new BufferList().addCString("!").join(true,'p')); });