fix orphanagentuser toLowerCase() (#6317)
https://github.com/Ylianst/MeshCentral/issues/2095#issuecomment-2276360509
Dmitry Kostenkov committed
Sep 15, 2024 at 21:42 UTC
59a3a22ea5686b899c056e9f3fe79ac1215ea255
1 file changed
+6
-6
meshagent.js
+6
-6
@@ -58,15 +58,15 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
58
dataAccounting();
59
60
if ((arg == 1) || (arg == null)) { try { ws.close(); if (obj.nodeid != null) { parent.parent.debug('agent', 'Soft disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); } } catch (e) { console.log(e); } } // Soft close, close the websocket
61
- if (arg == 2) {
62
- try {
61
+ if (arg == 2) {
62
+ try {
63
if (ws._socket._parent != null)
64
ws._socket._parent.end();
65
else
66
ws._socket.end();
67
-
68
- if (obj.nodeid != null) {
69
- parent.parent.debug('agent', 'Hard disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')');
67
+
68
+ if (obj.nodeid != null) {
69
+ parent.parent.debug('agent', 'Hard disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')');
70
}
71
} catch (e) { console.log(e); }
72
}
@@ -616,7 +616,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
616
}
617
618
if ((mesh == null) && (typeof domain.orphanagentuser == 'string')) {
619
- const adminUser = parent.users['user/' + domain.id + '/' + domain.orphanagentuser.toLowerCase()];
619
+ const adminUser = parent.users['user/' + domain.id + '/' + domain.orphanagentuser];
620
if ((adminUser != null) && (adminUser.siteadmin == 0xFFFFFFFF)) {
621
// Mesh name is hex instead of base64
622
const meshname = obj.meshid.substring(0, 18);