From 59a3a22ea5686b899c056e9f3fe79ac1215ea255 Mon Sep 17 00:00:00 2001 From: Dmitry Kostenkov Date: Sun, 15 Sep 2024 21:42:15 +0500 Subject: [PATCH] fix orphanagentuser toLowerCase() (#6317) https://github.com/Ylianst/MeshCentral/issues/2095#issuecomment-2276360509 --- meshagent.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/meshagent.js b/meshagent.js index 68d78790ea..9c1fcb9838 100644 --- a/meshagent.js +++ b/meshagent.js @@ -58,15 +58,15 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { dataAccounting(); 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 - if (arg == 2) { - try { + if (arg == 2) { + try { if (ws._socket._parent != null) ws._socket._parent.end(); else ws._socket.end(); - - if (obj.nodeid != null) { - parent.parent.debug('agent', 'Hard disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); + + if (obj.nodeid != null) { + parent.parent.debug('agent', 'Hard disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); } } catch (e) { console.log(e); } } @@ -616,7 +616,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { } if ((mesh == null) && (typeof domain.orphanagentuser == 'string')) { - const adminUser = parent.users['user/' + domain.id + '/' + domain.orphanagentuser.toLowerCase()]; + const adminUser = parent.users['user/' + domain.id + '/' + domain.orphanagentuser]; if ((adminUser != null) && (adminUser.siteadmin == 0xFFFFFFFF)) { // Mesh name is hex instead of base64 const meshname = obj.meshid.substring(0, 18);