mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-14 15:23:39 +00:00
updated user-sessions on linux, so that if 'who' is not supported, consoleUid will return root. This fixes platforms such as puppy, where the platform is logged in as root.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -544,11 +544,13 @@ function UserSessions()
|
|||||||
this.consoleUid = function consoleUid()
|
this.consoleUid = function consoleUid()
|
||||||
{
|
{
|
||||||
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||||
child.stdout.str = '';
|
child.stdout.str = ''; child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
|
||||||
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
|
child.stderr.str = ''; child.stderr.on('data', function (chunk) { this.str += chunk.toString(); });
|
||||||
child.stdin.write('who\nexit\n');
|
child.stdin.write('who\nexit\n');
|
||||||
child.waitExit();
|
child.waitExit();
|
||||||
|
|
||||||
|
if (child.stderr.str != '') { return (0); }
|
||||||
|
|
||||||
var lines = child.stdout.str.split('\n');
|
var lines = child.stdout.str.split('\n');
|
||||||
var tokens, i, j;
|
var tokens, i, j;
|
||||||
for (i in lines) {
|
for (i in lines) {
|
||||||
|
|||||||
Reference in New Issue
Block a user