Intel AMT fixes for #2628
Ylian Saint-Hilaire committed
May 12, 2021 at 09:10 UTC
ad9744e880252bd30270524b0cecc7b4f496b453
2 files changed
+6
-7
apprelays.js
+4
-5
@@ -216,8 +216,8 @@ module.exports.CreateSshRelay = function (parent, db, ws, req, args, domain) {
216
delete obj.wsClient;
217
}
218
219
- if ((arg == 1) || (arg == null)) { try { ws.close(); } catch (e) { console.log(e); } } // Soft close, close the websocket
220
- if (arg == 2) { try { ws._socket._parent.end(); } catch (e) { console.log(e); } } // Hard close, close the TCP socket
219
+ if ((arg == 1) || (arg == null)) { try { ws.close(); } catch (ex) { console.log(ex); } } // Soft close, close the websocket
220
+ if (arg == 2) { try { ws._socket._parent.end(); } catch (ex) { console.log(ex); } } // Hard close, close the TCP socket
221
obj.ws.removeAllListeners();
222
223
obj.relayActive = false;
@@ -229,7 +229,6 @@ module.exports.CreateSshRelay = function (parent, db, ws, req, args, domain) {
229
// Decode the authentication cookie
230
obj.cookie = parent.parent.decodeCookie(req.query.auth, parent.parent.loginCookieEncryptionKey);
231
if (obj.cookie == null) { obj.ws.send(JSON.stringify({ action: 'sessionerror' })); obj.close(); return; }
232
- console.log(obj.cookie);
232
233
// Start the looppback server
234
function startRelayConnection() {
@@ -391,8 +390,8 @@ module.exports.CreateSshTerminalRelay = function (parent, db, ws, req, domain, u
390
delete obj.wsClient;
391
}
392
394
- if ((arg == 1) || (arg == null)) { try { ws.close(); } catch (e) { console.log(e); } } // Soft close, close the websocket
395
- if (arg == 2) { try { ws._socket._parent.end(); } catch (e) { console.log(e); } } // Hard close, close the TCP socket
393
+ if ((arg == 1) || (arg == null)) { try { ws.close(); } catch (ex) { console.log(ex); } } // Soft close, close the websocket
394
+ if (arg == 2) { try { ws._socket._parent.end(); } catch (ex) { console.log(ex); } } // Hard close, close the TCP socket
395
obj.ws.removeAllListeners();
396
397
obj.relayActive = false;
views/default.handlebars
+2
-2
@@ -6417,7 +6417,7 @@
6417
6418
x += '</table><br />';
6419
// Show action button, only show if we have permissions 4, 8, 64
6420
- if (((meshrights & (4 + 8 + 64)) != 0) && (node.mtype != 3) && (node.agent.id != 34)) { x += '<input type=button value="' + "Actions" + '" title="' + "Perform power actions on the device" + '" onclick=deviceActionFunction() />'; }
6420
+ if (((meshrights & (4 + 8 + 64)) != 0) && (node.mtype != 3) && ((node.agent == null) || (node.agent.id != 34))) { x += '<input type=button value="' + "Actions" + '" title="' + "Perform power actions on the device" + '" onclick=deviceActionFunction() />'; }
6421
x += '<input type=button value="' + "Notes" + '" title="' + "View notes about this device" + '" onclick=showNotes(' + ((meshrights & 128) == 0) + ',"' + encodeURIComponentEx(node._id) + '") />';
6422
x += '<input type=button value="' + "Log Event" + '" title="' + "Write an event for this device" + '" onclick=writeDeviceEvent("' + encodeURIComponentEx(node._id) + '") />';
6423
if ((meshrights & 8) && ((connectivity & 1) || ((node.pmt == 1) && ((features2 & 2) != 0)))) { x += '<input type=button value="' + "Message" + '" title="' + "Display a text message on the remote device" + '" onclick=deviceMessageFunction() />'; }
@@ -6460,7 +6460,7 @@
6460
x += '</div><div class="p10html3left">';
6461
if ((node.agent) && (node.mtype != 3)) x += '<a href=# onclick=p10showNodeNetInfoDialog("' + node._id + '") title="' + "Show device network interface information" + '">' + "Interfaces" + '</a> ';
6462
if ((features & 0x00008000) && (xxmap != null)) x += '<a href=# onclick=p10showNodeLocationDialog("' + node._id + '") title="' + "Show device locations information" + '">' + "Location" + '</a> ';
6463
- if ((node.agent.id != 14) && (node.agent.id != 34)) {
6463
+ if ((node.agent == null) || ((node.agent.id != 14) && (node.agent.id != 34))) {
6464
if ((userinfo.siteadmin == 0xFFFFFFFF) || ((userinfo.siteadmin & 128) == 0)) { // Check if we should view tools
6465
if ((terminalAccess) && ((meshrights & 8) != 0) && (node.agent != null) && (node.agent.id != 14)) x += '<a href=# onclick=p10showMeshCmdDialog(1,"' + node._id + '") title="' + "Traffic router used to connect to a device thru this server" + '.">' + "MeshCmd" + '</a> ';
6466
}