mirror of
https://github.com/danbulant/node-x11
synced 2026-05-20 21:09:10 +00:00
fix for incorrect length of authType & authData strings in handshake
This commit is contained in:
parent
956ba1e241
commit
d24332c90f
2 changed files with 4 additions and 6 deletions
|
|
@ -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;
|
||||
module.exports.writeClientHello = writeClientHello;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue