mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Partial work for host-based ACM AMT activation.
This commit is contained in:
parent
cfb9af8609
commit
423daaf19d
11 changed files with 143 additions and 15 deletions
|
@ -913,6 +913,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
|
|||
var jsondata = null, jsondatastr = data.substring(5, 5 + jsondatalen);
|
||||
try { jsondata = JSON.parse(jsondatastr); } catch (ex) { }
|
||||
if ((jsondata == null) || (typeof jsondata.action != 'string')) return;
|
||||
parent.debug('mpscmd', '--> JSON_CONTROL', jsondata.action);
|
||||
switch (jsondata.action) {
|
||||
case 'connType':
|
||||
if ((socket.tag.connType != 0) || (socket.tag.SystemId != null)) return; // Once set, the connection type can't be changed.
|
||||
|
@ -930,6 +931,10 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
|
|||
if (socket.tag.connType != 2) break; // Only accept MEI state on CIRA-LMS connection
|
||||
if (obj.parent.amtManager != null) { obj.parent.amtManager.mpsControlMessage(socket.tag.nodeid, socket, socket.tag.connType, jsondata); }
|
||||
break;
|
||||
case 'startTlsHostConfig':
|
||||
if (socket.tag.connType != 2) break; // Only accept MEI state on CIRA-LMS connection
|
||||
if (obj.parent.amtManager != null) { obj.parent.amtManager.mpsControlMessage(socket.tag.nodeid, socket, socket.tag.connType, jsondata); }
|
||||
break;
|
||||
}
|
||||
return 5 + jsondatalen;
|
||||
}
|
||||
|
@ -956,8 +961,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
|
|||
|
||||
obj.SendJsonControl = function(socket, data) {
|
||||
if (socket.tag.connType == 0) return; // This command is valid only for connections that are not really CIRA.
|
||||
parent.debug('mpscmd', '<-- JSON_CONTROL');
|
||||
if (typeof data == 'object') { data = JSON.stringify(data); }
|
||||
if (typeof data == 'object') { parent.debug('mpscmd', '<-- JSON_CONTROL', data.action); data = JSON.stringify(data); } else { parent.debug('mpscmd', '<-- JSON_CONTROL'); }
|
||||
Write(socket, String.fromCharCode(APFProtocol.JSON_CONTROL) + common.IntToStr(data.length) + data);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue