Socket
Socket
Sign inDemoInstall

tedious

Package Overview
Dependencies
Maintainers
5
Versions
227
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tedious - npm Package Compare versions

Comparing version 1.12.0 to 1.12.1

44

lib/connection.js

@@ -31,3 +31,2 @@ // Generated by CoffeeScript 1.9.3

ref,
tls,
bind = function (fn, me) {

@@ -84,4 +83,2 @@ return function () {

tls = require('tls');
ref = require('./errors'), ConnectionError = ref.ConnectionError, RequestError = ref.RequestError;

@@ -154,4 +151,3 @@

tls: function () {
this.initiateTlsSslHandshake();
this.sendLogin7Packet();
this.messageIo.startTls(this.config.options.cryptoCredentialsDetails);
return this.transitionTo(this.STATE.SENT_TLSSSLNEGOTIATION);

@@ -183,5 +179,2 @@ }

name: 'SentTLSSSLNegotiation',
enter: function () {
return this.tlsNegotiationComplete = false;
},
events: {

@@ -195,11 +188,9 @@ socketError: function (error) {

data: function (data) {
return this.securePair.encrypted.write(data);
return this.messageIo.tlsHandshakeData(data);
},
tlsNegotiated: function () {
return this.tlsNegotiationComplete = true;
},
message: function () {
if (this.tlsNegotiationComplete) {
if (this.messageIo.tlsNegotiationComplete) {
this.sendLogin7Packet();
return this.transitionTo(this.STATE.SENT_LOGIN7_WITH_STANDARD_LOGIN);
} else {}
}
}

@@ -725,3 +716,3 @@ }

})(this));
return this.messageIo.on('message', (function (_this) {
this.messageIo.on('message', (function (_this) {
return function () {

@@ -731,2 +722,3 @@ return _this.dispatchEvent('message');

})(this));
return this.messageIo.on('secure', this.emit.bind(this, 'secure'));
};

@@ -912,24 +904,2 @@

Connection.prototype.initiateTlsSslHandshake = function () {
var credentials;
credentials = tls.createSecureContext ? tls.createSecureContext(this.config.options.cryptoCredentialsDetails) : crypto.createCredentials(this.config.options.cryptoCredentialsDetails);
this.securePair = tls.createSecurePair(credentials);
this.securePair.on('secure', (function (_this) {
return function () {
var cipher;
cipher = _this.securePair.cleartext.getCipher();
_this.debug.log("TLS negotiated (" + cipher.name + ", " + cipher.version + ")");
_this.emit('secure', _this.securePair.cleartext);
_this.messageIo.encryptAllFutureTraffic();
return _this.dispatchEvent('tlsNegotiated');
};
})(this));
this.securePair.encrypted.on('data', (function (_this) {
return function (data) {
return _this.messageIo.sendMessage(TYPE.PRELOGIN, data);
};
})(this));
return this.messageIo.tlsNegotiationStarting(this.securePair);
};
Connection.prototype.sendDataToTokenStreamParser = function (data) {

@@ -936,0 +906,0 @@ return this.tokenStreamParser.addBuffer(data);

43

lib/message-io.js

@@ -10,5 +10,7 @@ var _regeneratorRuntime = require('babel-runtime/regenerator').default;

TYPE,
crypto,
isPacketComplete,
packetHeaderLength,
packetLength,
tls,
extend = function (child, parent) {

@@ -28,2 +30,6 @@ for (var key in parent) {

tls = require('tls');
crypto = require('crypto');
require('./buffertools');

@@ -152,5 +158,22 @@

MessageIO.prototype.tlsNegotiationStarting = function (securePair) {
this.securePair = securePair;
return this.tlsNegotiationInProgress = true;
MessageIO.prototype.startTls = function (credentialsDetails) {
var credentials;
credentials = tls.createSecureContext ? tls.createSecureContext(credentialsDetails) : crypto.createCredentials(credentialsDetails);
this.securePair = tls.createSecurePair(credentials);
this.tlsNegotiationComplete = false;
this.securePair.on('secure', (function (_this) {
return function () {
var cipher;
cipher = _this.securePair.cleartext.getCipher();
_this.debug.log("TLS negotiated (" + cipher.name + ", " + cipher.version + ")");
_this.emit('secure', _this.securePair.cleartext);
return _this.encryptAllFutureTraffic();
};
})(this));
this.securePair.encrypted.on('data', (function (_this) {
return function (data) {
return _this.sendMessage(TYPE.PRELOGIN, data);
};
})(this));
return this.securePair.cleartext.write('');
};

@@ -164,5 +187,9 @@

this.securePair.cleartext.pipe(this.packetStream);
return this.tlsNegotiationInProgress = false;
return this.tlsNegotiationComplete = true;
};
MessageIO.prototype.tlsHandshakeData = function (data) {
return this.securePair.encrypted.write(data);
};
MessageIO.prototype.sendMessage = function (packetType, data, resetConnection) {

@@ -197,10 +224,6 @@ var i, numberOfPackets, packet, packetNumber, packetPayload, payloadEnd, payloadStart, ref, results;

this.logPacket('Sent', packet);
if (this.tlsNegotiationInProgress && packetType !== TYPE.PRELOGIN) {
if (this.securePair && this.tlsNegotiationComplete) {
return this.securePair.cleartext.write(packet.buffer);
} else {
if (this.securePair && !this.tlsNegotiationInProgress) {
return this.securePair.cleartext.write(packet.buffer);
} else {
return this.socket.write(packet.buffer);
}
return this.socket.write(packet.buffer);
}

@@ -207,0 +230,0 @@ };

@@ -50,3 +50,3 @@ var _regeneratorRuntime = require('babel-runtime/regenerator').default;

case 14:
return context$1$0.delegateYield(valueParse(parser, columnMetaData), 't0', 15);
return context$1$0.delegateYield(valueParse(parser, columnMetaData, options), 't0', 15);

@@ -53,0 +53,0 @@ case 15:

@@ -30,3 +30,3 @@ {

"license": "MIT",
"version": "1.12.0",
"version": "1.12.1",
"main": "./lib/tedious.js",

@@ -33,0 +33,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc