1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Improved MSTSC.js login access options.

This commit is contained in:
Ylian Saint-Hilaire 2020-06-13 17:43:12 -07:00
parent ba6d15a79d
commit 48dc17a32e
58 changed files with 74 additions and 66 deletions

View file

@ -16,12 +16,11 @@
// Construct a MSTSC Relay object, called upon connection
// This is a bit of a hack as we are going to run the RDP connection thru a loopback connection.
// If the "node-rdpjs-2" module supported passing a socket, we would do something different.
module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain, user) {
module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain) {
const Net = require('net');
const WebSocket = require('ws');
var obj = {};
obj.user = user;
obj.domain = domain;
obj.ws = ws;
obj.wsClient = null;
@ -34,14 +33,13 @@ module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain, u
parent.parent.debug('relay', 'RDP: Request for RDP relay (' + req.clientIp + ')');
// Disconnect this user
// Disconnect
obj.close = function (arg) {
if ((arg == 1) || (arg == null)) { try { ws.close(); } catch (e) { console.log(e); } } // Soft close, close the websocket
if (arg == 2) { try { ws._socket._parent.end(); } catch (e) { console.log(e); } } // Hard close, close the TCP socket
if (obj.wsClient) { obj.wsClient.close(); obj.wsClient = null; }
if (obj.tcpServer) { obj.tcpServer.close(); obj.tcpServer = null; }
if (rdpClient) { rdpClient.close(); rdpClient = null; }
delete obj.user;
delete obj.domain;
delete obj.ws;
};