From d86cc2d911a0d2d5aa51c3ff654e2fbcd650d934 Mon Sep 17 00:00:00 2001 From: Brian Rak Date: Thu, 30 Jan 2014 19:20:41 -0500 Subject: [PATCH] Add support for TightVNC auth type --- include/rfb.js | 93 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 92 insertions(+), 1 deletion(-) diff --git a/include/rfb.js b/include/rfb.js index 55d38c08..b0719357 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -45,6 +45,7 @@ var that = {}, // Public API methods rfb_version = 0, rfb_max_version= 3.8, rfb_auth_scheme= '', + rfb_tightvnc = false, // In preference order @@ -709,7 +710,7 @@ init_msg = function() { types = ws.rQshiftBytes(num_types); Util.Debug("Server security types: " + types); for (i=0; i < types.length; i+=1) { - if ((types[i] > rfb_auth_scheme) && (types[i] < 3)) { + if ((types[i] > rfb_auth_scheme) && (types[i] <= 16)) { rfb_auth_scheme = types[i]; } } @@ -764,6 +765,68 @@ init_msg = function() { //Util.Debug("Sending DES encrypted auth response"); ws.send(response); updateState('SecurityResult'); + return; + case 16: // TightVNC Security Type + if (ws.rQwait("num tunnels", 4)) { return false; } + var numTunnels = ws.rQshift32(); + //console.log("Number of tunnels: "+numTunnels); + + rfb_tightvnc = true; + + if (numTunnels != 0) + { + fail("Protocol requested tunnels, not currently supported. numTunnels: " + numTunnels); + return; + } + + var clientSupportedTypes = { + 'STDVNOAUTH__': 1, + 'STDVVNCAUTH_': 2 + }; + + var serverSupportedTypes = []; + + if (ws.rQwait("sub auth count", 4)) { return false; } + var subAuthCount = ws.rQshift32(); + //console.log("Sub auth count: "+subAuthCount); + for (var i=0;i