Server fixes when agent comes in with unknown agentid.

This commit is contained in:
Ylian Saint-Hilaire 2019-06-17 15:37:13 -07:00
parent 4f043f7c21
commit 89f37973a0
3 changed files with 15 additions and 13 deletions

View File

@ -141,16 +141,18 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
}
// We need to check if the core is current. Figure out what core we need.
var corename;
if (obj.agentCoreCheck == 1001) {
// If the user asked, use the recovery core.
corename = parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId].rcore;
} else if (obj.agentInfo.capabilities & 0x40) {
// If this is a recovery agent, use the agent recovery core.
corename = parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId].arcore;
} else {
// This is the normal core for this agent type.
corename = parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId].core;
var corename = null;
if (parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId] != null) {
if (obj.agentCoreCheck == 1001) {
// If the user asked, use the recovery core.
corename = parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId].rcore;
} else if (obj.agentInfo.capabilities & 0x40) {
// If this is a recovery agent, use the agent recovery core.
corename = parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId].arcore;
} else {
// This is the normal core for this agent type.
corename = parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId].core;
}
}
// If we have a core, use it.

View File

@ -1,6 +1,6 @@
{
"name": "meshcentral",
"version": "0.3.6-o",
"version": "0.3.6-p",
"keywords": [
"Remote Management",
"Intel AMT",

View File

@ -1721,7 +1721,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
var urlArgs = '', urlName = null, splitUrl = req.originalUrl.split("?");
if (splitUrl.length > 1) { urlArgs = '?' + splitUrl[1]; }
if ((splitUrl.length > 0) && (splitUrl[0].length > 1)) { urlName = splitUrl[0].substring(1).toLowerCase(); }
if ((urlName == null) || (domain.redirects[urlName] == null)) { res.sendStatus(404); return; }
if ((urlName == null) || (domain.redirects[urlName] == null) || (urlName[0] == '_')) { res.sendStatus(404); return; }
res.redirect(domain.redirects[urlName] + urlArgs + getQueryPortion(req));
}
@ -2743,7 +2743,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
obj.app.get(url + 'welcome.jpg', handleWelcomeImageRequest);
// Server redirects
if (parent.config.domains[i].redirects) { for (var j in parent.config.domains[i].redirects) { obj.app.get(url + j, handleDomainRedirect); } }
if (parent.config.domains[i].redirects) { for (var j in parent.config.domains[i].redirects) { if (j[0] != '_') { obj.app.get(url + j, handleDomainRedirect); } } }
// Server picture
obj.app.get(url + 'serverpic.ashx', function (req, res) {