Fixed server crash on unknown CIRA device connection, #3036

This commit is contained in:
Ylian Saint-Hilaire 2021-08-17 12:28:46 -07:00
parent 4e506beda1
commit 348cd452ff

View File

@ -280,7 +280,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
obj.onWebSocketConnection = function (socket, req) { obj.onWebSocketConnection = function (socket, req) {
connectionCount++; connectionCount++;
// connType: 0 = CIRA, 1 = Relay, 2 = LMS // connType: 0 = CIRA, 1 = Relay, 2 = LMS
socket.tag = { first: true, connType: 0, clientCert: null, accumulator: '', activetunnels: 0, boundPorts: [], websocket: true, socket: socket, host: null, nextchannelid: 4, channels: {}, nextsourceport: 0 }; socket.tag = { first: true, connType: 0, clientCert: null, accumulator: '', activetunnels: 0, boundPorts: [], websocket: true, socket: socket, host: null, nextchannelid: 4, channels: {}, nextsourceport: 0, meiState: {} };
socket.SetupChannel = function SetupChannel(targetport) { return SetupChannel.parent.SetupChannel(SetupChannel.conn, targetport); } socket.SetupChannel = function SetupChannel(targetport) { return SetupChannel.parent.SetupChannel(SetupChannel.conn, targetport); }
socket.SetupChannel.parent = obj; socket.SetupChannel.parent = obj;
socket.SetupChannel.conn = socket; socket.SetupChannel.conn = socket;
@ -337,9 +337,9 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
connectionCount++; connectionCount++;
// connType: 0 = CIRA, 1 = Relay, 2 = LMS // connType: 0 = CIRA, 1 = Relay, 2 = LMS
if (obj.args.mpstlsoffload) { if (obj.args.mpstlsoffload) {
socket.tag = { first: true, connType: 0, clientCert: null, accumulator: '', activetunnels: 0, boundPorts: [], socket: socket, host: null, nextchannelid: 4, channels: {}, nextsourceport: 0 }; socket.tag = { first: true, connType: 0, clientCert: null, accumulator: '', activetunnels: 0, boundPorts: [], socket: socket, host: null, nextchannelid: 4, channels: {}, nextsourceport: 0, meiState: {} };
} else { } else {
socket.tag = { first: true, connType: 0, clientCert: socket.getPeerCertificate(true), accumulator: '', activetunnels: 0, boundPorts: [], socket: socket, host: null, nextchannelid: 4, channels: {}, nextsourceport: 0 }; socket.tag = { first: true, connType: 0, clientCert: socket.getPeerCertificate(true), accumulator: '', activetunnels: 0, boundPorts: [], socket: socket, host: null, nextchannelid: 4, channels: {}, nextsourceport: 0, meiState: {} };
} }
socket.SetupChannel = function SetupChannel(targetport) { return SetupChannel.parent.SetupChannel(SetupChannel.conn, targetport); } socket.SetupChannel = function SetupChannel(targetport) { return SetupChannel.parent.SetupChannel(SetupChannel.conn, targetport); }
socket.SetupChannel.parent = obj; socket.SetupChannel.parent = obj;