diff --git a/lib/auth.js b/lib/auth.js index e62e910..61c1aa0 100644 --- a/lib/auth.js +++ b/lib/auth.js @@ -15,22 +15,22 @@ function parseXauth( buf ) var length = buf.unpack('n', offset)[0]; offset += 2; cookie[property] = buf.unpackString(length, offset); - offset += length; + offset += length; } while (offset < buf.length) { - var cookie = {}; + var cookie = {}; var typeToName = { 256: 'Local', 65535: 'Wild', 254: 'Netname', - 253: 'Krb5Principal', + 253: 'Krb5Principal', 252: 'LocalHost', - 0: 'Internet', - 1: 'DECnet', + 0: 'Internet', + 1: 'DECnet', 2: 'Chaos', - 5: 'ServerInterpreted', + 5: 'ServerInterpreted', 6: 'InternetV6' }; cookie.type = buf.unpack('n')[0]; @@ -50,12 +50,12 @@ module.exports = function( display, host, cb ) var XAuthorityFile = process.env.XAUTHORITY; if (!XAuthorityFile) { - if ( process.platform.match(/win/) ) { + if ( process.platform.match(/^win/) ) { // http://www.straightrunning.com/XmingNotes/trouble.php // - // The Xming magic cookie program, xauth (user-based), uses an - // Xauthority file (not the traditional .Xauthority file) in - // the %HOME% directory. To use xauth from Command Processor + // The Xming magic cookie program, xauth (user-based), uses an + // Xauthority file (not the traditional .Xauthority file) in + // the %HOME% directory. To use xauth from Command Processor // e.g. on Windows machine 192.168.0.2 with user colin... XAuthorityFile = process.env.USERPROFILE + '\\Xauthority'; } else { @@ -65,7 +65,7 @@ module.exports = function( display, host, cb ) fs.readFile(XAuthorityFile, function (err, data) { - if (err) + if (err) { if (err.code == 'ENOENT') { @@ -86,6 +86,6 @@ module.exports = function( display, host, cb ) } } // throw 'No auth cookie matching display=' + display + ' and host=' + host; - cb( '', '' ); - }); + cb( '', '' ); + }); };