Fixed user consent with guest sharing, #3492
Ylian Saint-Hilaire committed
Jan 24, 2022 at 09:56 UTC
9d621f23c647d2de08738f6176d3d0ad3c9944f2
3 files changed
+9
-2
MeshCentralServer.njsproj
+1
@@ -22,6 +22,7 @@
22
<ItemGroup>
23
<Compile Include="agents\meshcmd.js" />
24
<Compile Include="agents\meshcmd.min.js" />
25
+ <Compile Include="agents\meshcore.js" />
26
<Compile Include="agents\meshcore.min.js" />
27
<Compile Include="agents\meshinstall-linux.js" />
28
<Compile Include="agents\modules_meshcmd\amt-apfclient.js" />
meshagent.js
+8
-1
@@ -1657,7 +1657,14 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
1657
}
1658
case 'getUserImage': {
1659
// Validate input
1660
- if (typeof command.userid != 'string') return;
1660
+ if (typeof command.userid != 'string') {
1661
+ // Send back the default image if required
1662
+ if ((command.default) || (command.sentDefault)) {
1663
+ try { command.image = 'data:image/png;base64,' + Buffer.from(parent.fs.readFileSync(parent.parent.path.join(__dirname, 'public', 'images', 'user-128.png')), 'binary').toString('base64'); } catch (ex) { }
1664
+ obj.send(JSON.stringify(command));
1665
+ }
1666
+ return;
1667
+ }
1668
var useridsplit = command.userid.split('/');
1669
if ((useridsplit.length != 3) || (useridsplit[1] != domain.id)) return;
1670
meshdesktopmultiplex.js
-1
@@ -1333,7 +1333,6 @@ function CreateMeshRelayEx2(parent, ws, req, domain, user, cookie) {
1333
if (user != null) { rcookieData.ruserid = user._id; } else if (obj.nouser === true) { rcookieData.nouser = 1; }
1334
const rcookie = parent.parent.encodeCookie(rcookieData, parent.parent.loginCookieEncryptionKey);
1335
const command = { nodeid: node._id, action: 'msg', type: 'tunnel', value: '*/meshrelay.ashx?p=2&id=' + obj.id + '&rauth=' + rcookie + '&nodeid=' + node._id, soptions: {}, usage: 2, rights: cookie.r, guestname: cookie.gn, consent: cookie.cf, remoteaddr: cleanRemoteAddr(obj.req.clientIp) };
1336
- if (user != null) { command.userid = user._id; }
1336
if (typeof domain.consentmessages == 'object') {
1337
if (typeof domain.consentmessages.title == 'string') { command.soptions.consentTitle = domain.consentmessages.title; }
1338
if (typeof domain.consentmessages.desktop == 'string') { command.soptions.consentMsgDesktop = domain.consentmessages.desktop; }