Socket
Socket
Sign inDemoInstall

tedious

Package Overview
Dependencies
Maintainers
4
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.4.3 to 1.5.1

60

lib/connection.js

@@ -119,2 +119,22 @@ // Generated by CoffeeScript 1.7.1

},
REROUTING: {
name: 'ReRouting',
enter: function() {
return this.cleanupConnection();
},
events: {
message: function() {},
socketError: function(error) {
return this.transitionTo(this.STATE.FINAL);
},
connectTimeout: function() {
return this.transitionTo(this.STATE.FINAL);
},
reconnect: function() {
this.config.server = this.routingData.server;
this.config.options.port = this.routingData.port;
return this.transitionTo(this.STATE.CONNECTING);
}
}
},
SENT_TLSSSLNEGOTIATION: {

@@ -160,2 +180,5 @@ name: 'SentTLSSSLNegotiation',

},
routingChange: function() {
return this.transitionTo(this.STATE.REROUTING);
},
loginFailed: function() {

@@ -211,2 +234,5 @@ return this.transitionTo(this.STATE.FINAL);

},
routingChange: function() {
return this.transitionTo(this.STATE.REROUTING);
},
message: function() {

@@ -311,2 +337,3 @@ return this.processLogin7NTLMAck();

this.socketClose = __bind(this.socketClose, this);
this.socketEnd = __bind(this.socketEnd, this);
this.socketConnect = __bind(this.socketConnect, this);

@@ -346,3 +373,3 @@ this.socketError = __bind(this.socketError, this);

Connection.prototype.defaultConfig = function() {
var _base, _base1, _base10, _base11, _base12, _base2, _base3, _base4, _base5, _base6, _base7, _base8, _base9;
var _base, _base1, _base10, _base11, _base12, _base13, _base2, _base3, _base4, _base5, _base6, _base7, _base8, _base9;
(_base = this.config).options || (_base.options = {});

@@ -365,2 +392,5 @@ (_base1 = this.config.options).textsize || (_base1.textsize = DEFAULT_TEXTSIZE);

(_base12 = this.config.options).connectionIsolationLevel || (_base12.connectionIsolationLevel = ISOLATION_LEVEL.READ_COMMITTED);
if ((_base13 = this.config.options).readOnlyIntent == null) {
_base13.readOnlyIntent = false;
}
if (!this.config.options.port && !this.config.options.instanceName) {

@@ -444,2 +474,8 @@ return this.config.options.port = DEFAULT_PORT;

})(this));
this.tokenStreamParser.on('routingChange', (function(_this) {
return function(token) {
_this.routingData = token.newValue;
return _this.dispatchEvent('routingChange');
};
})(this));
this.tokenStreamParser.on('packetSizeChange', (function(_this) {

@@ -607,3 +643,3 @@ return function(token) {

this.socket.on('close', this.socketClose);
this.socket.on('end', this.socketClose);
this.socket.on('end', this.socketEnd);
this.messageIo = new MessageIO(this.socket, this.config.options.packetSize, this.debug);

@@ -666,2 +702,6 @@ this.messageIo.on('data', (function(_this) {

var _ref1, _ref2;
if (this.state === newState) {
this.debug.log("State is already " + newState.name);
return;
}
if ((_ref1 = this.state) != null ? _ref1.exit : void 0) {

@@ -701,2 +741,3 @@ this.state.exit.apply(this);

Connection.prototype.socketConnect = function() {
this.closed = false;
this.debug.log("connected to " + this.config.server + ":" + this.config.options.port);

@@ -706,5 +747,15 @@ return this.dispatchEvent('socketConnect');

Connection.prototype.socketEnd = function() {
this.debug.log("socket ended");
return this.transitionTo(this.STATE.FINAL);
};
Connection.prototype.socketClose = function() {
this.debug.log("connection to " + this.config.server + ":" + this.config.options.port + " closed");
return this.transitionTo(this.STATE.FINAL);
if (this.state === this.STATE.REROUTING) {
this.debug.log("Rerouting to " + this.routingData.server + ":" + this.routingData.port);
return this.dispatchEvent('reconnect');
} else {
return this.transitionTo(this.STATE.FINAL);
}
};

@@ -754,3 +805,4 @@

tdsVersion: this.config.options.tdsVersion,
initDbFatal: !this.config.options.fallbackToDefaultDb
initDbFatal: !this.config.options.fallbackToDefaultDb,
readOnlyIntent: this.config.options.readOnlyIntent
};

@@ -757,0 +809,0 @@ payload = new Login7Payload(loginData);

12

lib/login7-payload.js

@@ -51,6 +51,7 @@ // Generated by CoffeeScript 1.7.1

SQL_DFLT: 0x00,
SQL_TSQL: 0x01,
SQL_TSQL: 0x08,
OLEDB_OFF: 0x00,
OLEDB_ON: 0x02,
READ_ONLY_INTENT: 0x04
OLEDB_ON: 0x10,
READ_WRITE_INTENT: 0x00,
READ_ONLY_INTENT: 0x20
};

@@ -144,2 +145,7 @@

this.typeFlags = TYPE_FLAGS.SQL_DFLT | TYPE_FLAGS.OLEDB_OFF;
if (this.loginData.readOnlyIntent) {
this.typeFlags |= TYPE_FLAGS.READ_ONLY_INTENT;
} else {
this.typeFlags |= TYPE_FLAGS.READ_WRITE_INTENT;
}
buffer = new WritableTrackingBuffer(100);

@@ -146,0 +152,0 @@ buffer.writeUInt32LE(this.tdsVersion);

@@ -49,2 +49,6 @@ // Generated by CoffeeScript 1.7.1

event: 'resetConnection'
},
20: {
name: 'ROUTING_CHANGE',
event: 'routingChange'
}

@@ -54,3 +58,3 @@ };

module.exports = function(buffer) {
var length, newValue, oldValue, type, typeNumber, valueLength;
var length, newValue, oldValue, port, protocol, routePacket, server, serverLen, type, typeNumber, valueLength;
length = buffer.readUInt16LE();

@@ -79,2 +83,20 @@ typeNumber = buffer.readUInt8();

break;
case 'ROUTING_CHANGE':
valueLength = buffer.readUInt16LE();
routePacket = buffer.readBuffer(valueLength);
protocol = routePacket.readUInt8(0);
if (protocol !== 0) {
throw new Error('Unknown protocol byte in routing change event');
}
port = routePacket.readUInt16LE(1);
serverLen = routePacket.readUInt16LE(3);
server = routePacket.toString('ucs2', 5, 5 + (serverLen * 2));
newValue = {
protocol: protocol,
port: port,
server: server
};
valueLength = buffer.readUInt16LE();
oldValue = buffer.readBuffer(valueLength);
break;
default:

@@ -81,0 +103,0 @@ console.error("Tedious > Unsupported ENVCHANGE type " + typeNumber + " " + type.name + " at offset " + (buffer.position - 1));

@@ -33,3 +33,3 @@ {

],
"version": "1.4.3",
"version": "1.5.1",
"main": "./lib/tedious.js",

@@ -36,0 +36,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