Skip to content

Commit

Permalink
fix orphanagentuser toLowerCase() (#6317)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmikoss authored Sep 15, 2024
1 parent 2f34b7e commit 59a3a22
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions meshagent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 59a3a22

Please sign in to comment.