diff --git a/agents/meshcore.js b/agents/meshcore.js index 11a6856f..151058c5 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -1012,7 +1012,7 @@ function handleServerCommand(data) { woptions.checkServerIdentity.servertlshash = data.servertlshash; //sendConsoleText(JSON.stringify(woptions)); - //sendConsoleText('TUNNEL: ' + JSON.stringify(data)); + //sendConsoleText('TUNNEL: ' + JSON.stringify(data, null, 2)); var tunnel = http.request(woptions); tunnel.upgrade = onTunnelUpgrade; tunnel.on('error', function (e) { sendConsoleText("ERROR: Unable to connect relay tunnel to: " + this.url + ", " + JSON.stringify(e)); }); @@ -1023,6 +1023,7 @@ function handleServerCommand(data) { tunnel.privacybartext = data.privacybartext ? data.privacybartext : currentTranslation['privacyBar']; tunnel.username = data.username + (data.guestname ? (' - ' + data.guestname) : ''); tunnel.realname = (data.realname ? data.realname : data.username) + (data.guestname ? (' - ' + data.guestname) : ''); + tunnel.guestuserid = data.guestuserid; tunnel.guestname = data.guestname; tunnel.userid = data.userid; if (server_check_consentTimer(tunnel.userid)) { tunnel.consent = (tunnel.consent & -57); } // Deleting Consent Requirement @@ -1828,7 +1829,7 @@ function onTunnelUpgrade(response, s, head) { // If the HTTP Request has a guest name, we need to form a userid that includes the guest name in hex. // This is so we can tell the server that a session is for a given userid/guest sharing pair. function getUserIdAndGuestNameFromHttpRequest(request) { - if (request.guestname == null) return request.userid; else return request.userid + '/guest:' + Buffer.from(request.guestname).toString('base64'); + if (request.guestname == null) return request.userid; else return request.guestuserid + '/guest:' + Buffer.from(request.guestname).toString('base64'); } // Called when UDP relay data is received // TODO**** diff --git a/meshdesktopmultiplex.js b/meshdesktopmultiplex.js index b8acb0fa..9fedec9c 100644 --- a/meshdesktopmultiplex.js +++ b/meshdesktopmultiplex.js @@ -1333,7 +1333,7 @@ function CreateMeshRelayEx2(parent, ws, req, domain, user, cookie) { const rcookieData = { nodeid: node._id }; if (user != null) { rcookieData.ruserid = user._id; } else if (obj.nouser === true) { rcookieData.nouser = 1; } const rcookie = parent.parent.encodeCookie(rcookieData, parent.parent.loginCookieEncryptionKey); - 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) }; + 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, guestuserid: user._id, guestname: cookie.gn, consent: cookie.cf, remoteaddr: cleanRemoteAddr(obj.req.clientIp) }; if (typeof domain.consentmessages == 'object') { if (typeof domain.consentmessages.title == 'string') { command.soptions.consentTitle = domain.consentmessages.title; } if (typeof domain.consentmessages.desktop == 'string') { command.soptions.consentMsgDesktop = domain.consentmessages.desktop; } diff --git a/meshrelay.js b/meshrelay.js index 226a1868..f0d6f009 100644 --- a/meshrelay.js +++ b/meshrelay.js @@ -971,7 +971,7 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { const rcookieData = { nodeid: node._id }; if (user != null) { rcookieData.ruserid = user._id; } else if (obj.nouser === true) { rcookieData.nouser = 1; } const rcookie = parent.parent.encodeCookie(rcookieData, parent.parent.loginCookieEncryptionKey); - const command = { nodeid: node._id, action: 'msg', type: 'tunnel', value: '*/' + xdomain + 'meshrelay.ashx?p=' + obj.req.query.p + '&id=' + obj.id + '&rauth=' + rcookie + '&nodeid=' + node._id, soptions: {}, rights: cookie.r, guestname: cookie.gn, consent: cookie.cf, remoteaddr: cleanRemoteAddr(obj.req.clientIp) }; + const command = { nodeid: node._id, action: 'msg', type: 'tunnel', value: '*/' + xdomain + 'meshrelay.ashx?p=' + obj.req.query.p + '&id=' + obj.id + '&rauth=' + rcookie + '&nodeid=' + node._id, soptions: {}, rights: cookie.r, guestuserid: user._id, guestname: cookie.gn, consent: cookie.cf, remoteaddr: cleanRemoteAddr(obj.req.clientIp) }; obj.guestname = cookie.gn; // Limit what this relay connection can do