mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
changed Connection#passwordMessage to Connection#password
This commit is contained in:
parent
47eb2f5199
commit
e89aa9c84c
@ -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);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -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));
|
||||
};
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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'));
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user