Skip to content

Commit

Permalink
Fixed MeshCMD amtconfig occasionally not matching the device group.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ylianst committed Apr 1, 2021
1 parent 8ec41c7 commit 51bdd97
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions mpsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,16 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
SendUserAuthFail(socket);
return -1;
}
var meshIdStart = '/' + username, mesh = null;
if (obj.parent.webserver.meshes) { for (var i in obj.parent.webserver.meshes) { if (obj.parent.webserver.meshes[i]._id.replace(/\@/g, 'X').replace(/\$/g, 'X').indexOf(meshIdStart) > 0) { mesh = obj.parent.webserver.meshes[i]; break; } } }
// Find the device group for this CIRA connection. Since Intel AMT does not allow @ or $ in the username, we escape these.
// For possible for CIRA-LMS connections to still send @ or $, so we need to escape both sides.
var meshIdStart = ('/' + username).replace(/\@/g, 'X').replace(/\$/g, 'X'), mesh = null;
if (obj.parent.webserver.meshes) {
for (var i in obj.parent.webserver.meshes) {
if (obj.parent.webserver.meshes[i]._id.replace(/\@/g, 'X').replace(/\$/g, 'X').indexOf(meshIdStart) > 0) {
mesh = obj.parent.webserver.meshes[i]; break;
}
}
}
if (mesh == null) {
meshNotFoundCount++;
socket.ControlMsg({ action: 'console', msg: 'Device group not found' });
Expand Down

0 comments on commit 51bdd97

Please sign in to comment.