Fixed meshagent PDB download.
Ylian Saint-Hilaire committed
Oct 26, 2020 at 11:13 UTC
55686471c8cfa1367c481bcd62b51fa52aa2f383
1 file changed
+9
-3
webserver.js
+9
-3
@@ -4028,9 +4028,15 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
4028
if (argentInfo == null) { res.sendStatus(404); return; }
4029
4030
// Download PDB debug files, only allowed for administrator or accounts with agent dump access
4031
- if ((req.query.pdb == 1) && ((user.siteadmin == 0xFFFFFFFF) || ((Array.isArray(obj.parent.config.settings.agentcoredumpusers)) && (obj.parent.config.settings.agentcoredumpusers.indexOf(user._id) >= 0)))) {
4032
- if (argentInfo.id == 3) { setContentDispositionHeader(res, 'application/octet-stream', 'MeshService.pdb', null, 'MeshService.pdb'); res.sendFile(argentInfo.path.split('MeshService-signed.exe').join('MeshService.pdb')); return; }
4033
- if (argentInfo.id == 4) { setContentDispositionHeader(res, 'application/octet-stream', 'MeshService64.pdb', null, 'MeshService64.pdb'); res.sendFile(argentInfo.path.split('MeshService64-signed.exe').join('MeshService64.pdb')); return; }
4031
+ if (req.query.pdb == 1) {
4032
+ if ((req.session == null) || (req.session.userid == null)) { res.sendStatus(404); return; }
4033
+ var user = obj.users[req.session.userid];
4034
+ if (user == null) { res.sendStatus(404); return; }
4035
+ if ((user != null) && ((user.siteadmin == 0xFFFFFFFF) || ((Array.isArray(obj.parent.config.settings.agentcoredumpusers)) && (obj.parent.config.settings.agentcoredumpusers.indexOf(user._id) >= 0)))) {
4036
+ if (argentInfo.id == 3) { setContentDispositionHeader(res, 'application/octet-stream', 'MeshService.pdb', null, 'MeshService.pdb'); res.sendFile(argentInfo.path.split('MeshService-signed.exe').join('MeshService.pdb')); return; }
4037
+ if (argentInfo.id == 4) { setContentDispositionHeader(res, 'application/octet-stream', 'MeshService64.pdb', null, 'MeshService64.pdb'); res.sendFile(argentInfo.path.split('MeshService64-signed.exe').join('MeshService64.pdb')); return; }
4038
+ }
4039
+ res.sendStatus(404); return;
4040
}
4041
4042
if ((req.query.meshid == null) || (argentInfo.platform != 'win32')) {