diff --git a/lib/x11/handshake.js b/lib/x11/handshake.js index e23e74c..8e27dfc 100644 --- a/lib/x11/handshake.js +++ b/lib/x11/handshake.js @@ -183,13 +183,11 @@ bl.unpack('C', function(res) { function writeClientHello(stream, displayNum, authHost) { getAuthString( displayNum, authHost, function( authType, authData ) { - authType = xutil.padded_string( authType ); - authData = xutil.padded_string( authData ); var byte_order = 'l'.charCodeAt(0); // TODO: byteorder!!! var protocol_major = 11; // TODO: config? env? var protocol_minor = 0; stream.pack( - 'CxSSSSxxaa', + 'CxSSSSxxpp', [ byte_order, protocol_major, @@ -205,4 +203,4 @@ function writeClientHello(stream, displayNum, authHost) } module.exports.readServerHello = readServerHello; -module.exports.writeClientHello = writeClientHello; \ No newline at end of file +module.exports.writeClientHello = writeClientHello; diff --git a/lib/x11/unpackstream.js b/lib/x11/unpackstream.js index fd0f34b..5ff46e7 100644 --- a/lib/x11/unpackstream.js +++ b/lib/x11/unpackstream.js @@ -273,11 +273,11 @@ UnpackStream.prototype.pack = function(format, args) break; case 'p': // padded string var str = args[arg++]; - var len = padded(str); + var len = xutil.padded_length(str.length); // TODO: buffer.write could be faster var c = 0; for (; c < str.length; ++c) - buf[offset++] = str[c]; + buf[offset++] = str.charCodeAt(c); for (; c < len; ++c) buf[offset++] = 0; break;