Fixed Win7 crash with release agent

Ylian Saint-Hilaire committed Jul 27, 2018 at 15:50 UTC 367a386984543ca67c83ac3613ae185f18bbbbb1
8 files changed +7 -7
agents/MeshCmd-signed.exe
Binary files a/agents/MeshCmd-signed.exe and b/agents/MeshCmd-signed.exe differ
agents/MeshCmd64-signed.exe
Binary files a/agents/MeshCmd64-signed.exe and b/agents/MeshCmd64-signed.exe differ
agents/MeshService-signed.exe
Binary files a/agents/MeshService-signed.exe and b/agents/MeshService-signed.exe differ
agents/MeshService.exe
Binary files a/agents/MeshService.exe and b/agents/MeshService.exe differ
agents/MeshService64-signed.exe
Binary files a/agents/MeshService64-signed.exe and b/agents/MeshService64-signed.exe differ
agents/MeshService64.exe
Binary files a/agents/MeshService64.exe and b/agents/MeshService64.exe differ
meshagent.js
+6 -6
@@ -38,8 +38,8 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
38
39 // Disconnect this agent
40 obj.close = function (arg) {
41 - if ((arg == 1) || (arg == null)) { try { obj.ws.close(); obj.parent.parent.debug(1, 'Soft disconnect ' + obj.nodeid + ' (' + obj.remoteaddr + ')'); } catch (e) { console.log(e); } } // Soft close, close the websocket
42 - if (arg == 2) { try { obj.ws._socket._parent.end(); obj.parent.parent.debug(1, 'Hard disconnect ' + obj.nodeid + ' (' + obj.remoteaddr + ')'); } catch (e) { console.log(e); } } // Hard close, close the TCP socket
41 + if ((arg == 1) || (arg == null)) { try { obj.ws.close(); if (obj.nodeid != null) { obj.parent.parent.debug(1, 'Soft disconnect ' + obj.nodeid + ' (' + obj.remoteaddr + ')'); } } catch (e) { console.log(e); } } // Soft close, close the websocket
42 + if (arg == 2) { try { obj.ws._socket._parent.end(); if (obj.nodeid != null) { obj.parent.parent.debug(1, 'Hard disconnect ' + obj.nodeid + ' (' + obj.remoteaddr + ')'); } } catch (e) { console.log(e); } } // Hard close, close the TCP socket
43 if (arg == 3) { obj.authenticated = -1; } // Don't communicate with this agent anymore, but don't disconnect (Duplicate agent).
44 if (obj.parent.wsagents[obj.dbNodeKey] == obj) {
45 delete obj.parent.wsagents[obj.dbNodeKey];
@@ -108,7 +108,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
108 var agenthash = obj.common.rstr2hex(msg.substring(4)).toLowerCase();
109 if (agenthash != obj.agentExeInfo.hash) {
110 // Mesh agent update required
111 - console.log('Agent update required, NodeID=0x' + obj.nodeid.substring(0, 16) + ', ' + obj.agentExeInfo.desc);
111 + if (obj.nodeid != null) { obj.parent.parent.debug(1, 'Agent update required, NodeID=0x' + obj.nodeid.substring(0, 16) + ', ' + obj.agentExeInfo.desc); }
112 obj.fs.open(obj.agentExeInfo.path, 'r', function (err, fd) {
113 if (err) { return console.error(err); }
114 obj.agentUpdate = { oldHash: agenthash, ptr: 0, buf: new Buffer(agentUpdateBlockSize + 4), fd: fd };
@@ -249,8 +249,8 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
249 ws.on('error', function (err) { console.log('AGENT WSERR: ' + err); });
250
251 // If the mesh agent web socket is closed, clean up.
252 - ws.on('close', function (req) { obj.parent.parent.debug(1, 'Agent disconnect ' + obj.nodeid + ' (' + obj.remoteaddr + ')'); obj.close(0); });
253 - // obj.ws._socket._parent.on('close', function (req) { obj.parent.parent.debug(1, 'Agent TCP disconnect ' + obj.nodeid + ' (' + obj.remoteaddr + ')'); });
252 + ws.on('close', function (req) { if (obj.nodeid != null) { obj.parent.parent.debug(1, 'Agent disconnect ' + obj.nodeid + ' (' + obj.remoteaddr + ')'); } obj.close(0); });
253 + // obj.ws._socket._parent.on('close', function (req) { if (obj.nodeid != null) { obj.parent.parent.debug(1, 'Agent TCP disconnect ' + obj.nodeid + ' (' + obj.remoteaddr + ')'); } });
254
255 // Start authenticate the mesh agent by sending a auth nonce & server TLS cert hash.
256 // Send 384 bits SHA384 hash of TLS cert public key + 384 bits nonce
@@ -319,7 +319,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
319 obj.parent.wsagents[obj.dbNodeKey] = obj;
320 if (dupAgent) {
321 // Close the duplicate agent
322 - obj.parent.parent.debug(1, 'Duplicate agent ' + obj.nodeid + ' (' + obj.remoteaddr + ')');
322 + if (obj.nodeid != null) { obj.parent.parent.debug(1, 'Duplicate agent ' + obj.nodeid + ' (' + obj.remoteaddr + ')'); }
323 dupAgent.close(3);
324 } else {
325 // Indicate the agent is connected
package.json
+1 -1
@@ -1,6 +1,6 @@
1 {
2 "name": "meshcentral",
3 - "version": "0.1.9-c",
3 + "version": "0.1.9-d",
4 "keywords": [
5 "Remote Management",
6 "Intel AMT",