Fixed server exception.
Ylian Saint-Hilaire committed
Mar 11, 2019 at 11:18 UTC
edbf55dbbf04f30b9e5e3e34df698dfb7f196577
2 files changed
+7
-4
meshagent.js
+6
-3
@@ -695,6 +695,9 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
695
return;
696
}
697
698
+ // Not sure why, but in rare cases, obj.agentInfo is undefined here.
699
+ if ((obj.agentInfo == null) || (typeof obj.agentInfo.capabilities != 'number')) { return; } // This is an odd case.
700
+
701
if ((obj.agentInfo.capabilities & 64) != 0) {
702
// This is a recovery agent
703
obj.send(common.ShortToStr(11) + common.ShortToStr(0)); // Command 11, ask for mesh core hash.
@@ -755,7 +758,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
758
obj.sendUpdatedIntelAmtPolicy = function (policy) {
759
if (obj.agentExeInfo && (obj.agentExeInfo.amt == true)) { // Only send Intel AMT policy to agents what could have AMT.
760
if (policy == null) { var mesh = parent.meshes[obj.dbMeshKey]; if (mesh == null) return; policy = mesh.amt; }
758
- obj.send(JSON.stringify({ action: 'amtPolicy', amtPolicy: completeIntelAmtPolicy(common.Clone(policy)) }));
761
+ if (policy != null) { try { obj.send(JSON.stringify({ action: 'amtPolicy', amtPolicy: completeIntelAmtPolicy(common.Clone(policy)) })); } catch (ex) { } }
762
}
763
}
764
@@ -768,8 +771,8 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
771
}
772
773
// Send Intel AMT policy
771
- if (obj.agentExeInfo && (obj.agentExeInfo.amt == true)) { // Only send Intel AMT policy to agents what could have AMT.
772
- obj.send(JSON.stringify({ action: 'amtPolicy', amtPolicy: completeIntelAmtPolicy(common.Clone(mesh.amt)) }));
774
+ if (obj.agentExeInfo && (obj.agentExeInfo.amt == true) && (mesh.amt != null)) { // Only send Intel AMT policy to agents what could have AMT.
775
+ try { obj.send(JSON.stringify({ action: 'amtPolicy', amtPolicy: completeIntelAmtPolicy(common.Clone(mesh.amt)) })); } catch (ex) { }
776
}
777
778
// Do this if IP location is enabled on this domain TODO: Set IP location per device group?
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.3.0-e",
3
+ "version": "0.3.0-h",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",