Server fixes when agent comes in with unknown agentid.
Ylian Saint-Hilaire committed
Jun 17, 2019 at 15:37 UTC
89f37973a0314755d2ec19df21ead0f3ee7fd461
3 files changed
+15
-13
meshagent.js
+12
-10
@@ -141,16 +141,18 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
141
}
142
143
// We need to check if the core is current. Figure out what core we need.
144
- var corename;
145
- if (obj.agentCoreCheck == 1001) {
146
- // If the user asked, use the recovery core.
147
- corename = parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId].rcore;
148
- } else if (obj.agentInfo.capabilities & 0x40) {
149
- // If this is a recovery agent, use the agent recovery core.
150
- corename = parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId].arcore;
151
- } else {
152
- // This is the normal core for this agent type.
153
- corename = parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId].core;
144
+ var corename = null;
145
+ if (parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId] != null) {
146
+ if (obj.agentCoreCheck == 1001) {
147
+ // If the user asked, use the recovery core.
148
+ corename = parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId].rcore;
149
+ } else if (obj.agentInfo.capabilities & 0x40) {
150
+ // If this is a recovery agent, use the agent recovery core.
151
+ corename = parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId].arcore;
152
+ } else {
153
+ // This is the normal core for this agent type.
154
+ corename = parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId].core;
155
+ }
156
}
157
158
// If we have a core, use it.
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.3.6-o",
3
+ "version": "0.3.6-p",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
webserver.js
+2
-2
@@ -1721,7 +1721,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
1721
var urlArgs = '', urlName = null, splitUrl = req.originalUrl.split("?");
1722
if (splitUrl.length > 1) { urlArgs = '?' + splitUrl[1]; }
1723
if ((splitUrl.length > 0) && (splitUrl[0].length > 1)) { urlName = splitUrl[0].substring(1).toLowerCase(); }
1724
- if ((urlName == null) || (domain.redirects[urlName] == null)) { res.sendStatus(404); return; }
1724
+ if ((urlName == null) || (domain.redirects[urlName] == null) || (urlName[0] == '_')) { res.sendStatus(404); return; }
1725
res.redirect(domain.redirects[urlName] + urlArgs + getQueryPortion(req));
1726
}
1727
@@ -2743,7 +2743,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
2743
obj.app.get(url + 'welcome.jpg', handleWelcomeImageRequest);
2744
2745
// Server redirects
2746
- if (parent.config.domains[i].redirects) { for (var j in parent.config.domains[i].redirects) { obj.app.get(url + j, handleDomainRedirect); } }
2746
+ if (parent.config.domains[i].redirects) { for (var j in parent.config.domains[i].redirects) { if (j[0] != '_') { obj.app.get(url + j, handleDomainRedirect); } } }
2747
2748
// Server picture
2749
obj.app.get(url + 'serverpic.ashx', function (req, res) {