mirror of
https://github.com/danbulant/node-x11
synced 2026-07-03 18:20:37 +00:00
dont assume darwin is win*
This commit is contained in:
parent
908b501dd5
commit
5645841b80
1 changed files with 13 additions and 13 deletions
26
lib/auth.js
26
lib/auth.js
|
|
@ -15,22 +15,22 @@ function parseXauth( buf )
|
||||||
var length = buf.unpack('n', offset)[0];
|
var length = buf.unpack('n', offset)[0];
|
||||||
offset += 2;
|
offset += 2;
|
||||||
cookie[property] = buf.unpackString(length, offset);
|
cookie[property] = buf.unpackString(length, offset);
|
||||||
offset += length;
|
offset += length;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (offset < buf.length)
|
while (offset < buf.length)
|
||||||
{
|
{
|
||||||
var cookie = {};
|
var cookie = {};
|
||||||
var typeToName = {
|
var typeToName = {
|
||||||
256: 'Local',
|
256: 'Local',
|
||||||
65535: 'Wild',
|
65535: 'Wild',
|
||||||
254: 'Netname',
|
254: 'Netname',
|
||||||
253: 'Krb5Principal',
|
253: 'Krb5Principal',
|
||||||
252: 'LocalHost',
|
252: 'LocalHost',
|
||||||
0: 'Internet',
|
0: 'Internet',
|
||||||
1: 'DECnet',
|
1: 'DECnet',
|
||||||
2: 'Chaos',
|
2: 'Chaos',
|
||||||
5: 'ServerInterpreted',
|
5: 'ServerInterpreted',
|
||||||
6: 'InternetV6'
|
6: 'InternetV6'
|
||||||
};
|
};
|
||||||
cookie.type = buf.unpack('n')[0];
|
cookie.type = buf.unpack('n')[0];
|
||||||
|
|
@ -50,12 +50,12 @@ module.exports = function( display, host, cb )
|
||||||
var XAuthorityFile = process.env.XAUTHORITY;
|
var XAuthorityFile = process.env.XAUTHORITY;
|
||||||
if (!XAuthorityFile)
|
if (!XAuthorityFile)
|
||||||
{
|
{
|
||||||
if ( process.platform.match(/win/) ) {
|
if ( process.platform.match(/^win/) ) {
|
||||||
// http://www.straightrunning.com/XmingNotes/trouble.php
|
// http://www.straightrunning.com/XmingNotes/trouble.php
|
||||||
//
|
//
|
||||||
// The Xming magic cookie program, xauth (user-based), uses an
|
// The Xming magic cookie program, xauth (user-based), uses an
|
||||||
// Xauthority file (not the traditional .Xauthority file) in
|
// Xauthority file (not the traditional .Xauthority file) in
|
||||||
// the %HOME% directory. To use xauth from Command Processor
|
// the %HOME% directory. To use xauth from Command Processor
|
||||||
// e.g. on Windows machine 192.168.0.2 with user colin...
|
// e.g. on Windows machine 192.168.0.2 with user colin...
|
||||||
XAuthorityFile = process.env.USERPROFILE + '\\Xauthority';
|
XAuthorityFile = process.env.USERPROFILE + '\\Xauthority';
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -65,7 +65,7 @@ module.exports = function( display, host, cb )
|
||||||
|
|
||||||
fs.readFile(XAuthorityFile, function (err, data) {
|
fs.readFile(XAuthorityFile, function (err, data) {
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
if (err.code == 'ENOENT')
|
if (err.code == 'ENOENT')
|
||||||
{
|
{
|
||||||
|
|
@ -86,6 +86,6 @@ module.exports = function( display, host, cb )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// throw 'No auth cookie matching display=' + display + ' and host=' + host;
|
// throw 'No auth cookie matching display=' + display + ' and host=' + host;
|
||||||
cb( '', '' );
|
cb( '', '' );
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue