Comparing version 8.8.0 to 8.9.0
'use strict' | ||
var EventEmitter = require('events').EventEmitter | ||
var util = require('util') | ||
var utils = require('./utils') | ||
@@ -251,4 +250,8 @@ var sasl = require('./sasl') | ||
this._checkPgPass(() => { | ||
this.saslSession = sasl.startSession(msg.mechanisms) | ||
this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism, this.saslSession.response) | ||
try { | ||
this.saslSession = sasl.startSession(msg.mechanisms) | ||
this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism, this.saslSession.response) | ||
} catch (err) { | ||
this.connection.emit('error', err) | ||
} | ||
}) | ||
@@ -258,9 +261,17 @@ } | ||
_handleAuthSASLContinue(msg) { | ||
sasl.continueSession(this.saslSession, this.password, msg.data) | ||
this.connection.sendSCRAMClientFinalMessage(this.saslSession.response) | ||
try { | ||
sasl.continueSession(this.saslSession, this.password, msg.data) | ||
this.connection.sendSCRAMClientFinalMessage(this.saslSession.response) | ||
} catch (err) { | ||
this.connection.emit('error', err) | ||
} | ||
} | ||
_handleAuthSASLFinal(msg) { | ||
sasl.finalizeSession(this.saslSession, msg.data) | ||
this.saslSession = null | ||
try { | ||
sasl.finalizeSession(this.saslSession, msg.data) | ||
this.saslSession = null | ||
} catch (err) { | ||
this.connection.emit('error', err) | ||
} | ||
} | ||
@@ -267,0 +278,0 @@ |
@@ -17,3 +17,8 @@ 'use strict' | ||
config = config || {} | ||
this.stream = config.stream || new net.Socket() | ||
if (typeof this.stream === 'function') { | ||
this.stream = this.stream(config) | ||
} | ||
this._keepAlive = config.keepAlive | ||
@@ -177,3 +182,2 @@ this._keepAliveInitialDelayMillis = config.keepAliveInitialDelayMillis | ||
this._ending = true | ||
this._send(flushBuffer) | ||
this._send(syncBuffer) | ||
@@ -180,0 +184,0 @@ } |
@@ -6,3 +6,2 @@ 'use strict' | ||
var TypeOverrides = require('../type-overrides') | ||
var pkg = require('../../package.json') | ||
var EventEmitter = require('events').EventEmitter | ||
@@ -9,0 +8,0 @@ var util = require('util') |
@@ -26,2 +26,5 @@ 'use strict' | ||
} | ||
if (password === '') { | ||
throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string') | ||
} | ||
if (typeof serverData !== 'string') { | ||
@@ -41,3 +44,3 @@ throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string') | ||
var saltedPassword = Hi(password, saltBytes, sv.iteration) | ||
var saltedPassword = crypto.pbkdf2Sync(password, saltBytes, sv.iteration, 32, 'sha256') | ||
@@ -196,13 +199,2 @@ var clientKey = hmacSha256(saltedPassword, 'Client Key') | ||
function Hi(password, saltBytes, iterations) { | ||
var ui1 = hmacSha256(password, Buffer.concat([saltBytes, Buffer.from([0, 0, 0, 1])])) | ||
var ui = ui1 | ||
for (var i = 0; i < iterations - 1; i++) { | ||
ui1 = hmacSha256(password, ui1) | ||
ui = xorBuffers(ui, ui1) | ||
} | ||
return ui | ||
} | ||
module.exports = { | ||
@@ -209,0 +201,0 @@ startSession, |
{ | ||
"name": "pg", | ||
"version": "8.8.0", | ||
"version": "8.9.0", | ||
"description": "PostgreSQL client - pure javascript & libpq with the same API", | ||
@@ -27,3 +27,3 @@ "keywords": [ | ||
"pg-pool": "^3.5.2", | ||
"pg-protocol": "^1.5.0", | ||
"pg-protocol": "^1.6.0", | ||
"pg-types": "^2.1.0", | ||
@@ -57,3 +57,3 @@ "pgpass": "1.x" | ||
}, | ||
"gitHead": "c99fb2c127ddf8d712500db2c7b9a5491a178655" | ||
"gitHead": "20a243e8b30926a348cafc44177e95345618f7bc" | ||
} |
@@ -49,15 +49,4 @@ # node-postgres | ||
node-postgres's continued development has been made possible in part by generous finanical support from [the community](https://github.com/brianc/node-postgres/blob/master/SPONSORS.md) and these featured sponsors: | ||
node-postgres's continued development has been made possible in part by generous finanical support from [the community](https://github.com/brianc/node-postgres/blob/master/SPONSORS.md). | ||
<div align="center"> | ||
<a href="https://crate.io" target="_blank"> | ||
<img height="80" src="https://node-postgres.com/crate-io.png" /> | ||
</a> | ||
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAABCAQAAAB0m0auAAAADElEQVR42mNkIBIAAABSAAI2VLqiAAAAAElFTkSuQmCC" /> | ||
<a href="https://www.eaze.com" target="_blank"> | ||
<img height="80" src="https://node-postgres.com/eaze.png" /> | ||
</a> | ||
</div> | ||
If you or your company are benefiting from node-postgres and would like to help keep the project financially sustainable [please consider supporting](https://github.com/sponsors/brianc) its development. | ||
@@ -64,0 +53,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2043
71550
90
Updatedpg-protocol@^1.6.0