From 2cec49d4392cae67d04af2e2b48645e4ccfd5500 Mon Sep 17 00:00:00 2001 From: Kevin Chan Date: Tue, 11 May 2010 04:55:47 +0800 Subject: [PATCH] If no password is provided, defaults to use no auth --- vnc.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/vnc.js b/vnc.js index 93dabc4f..ed33a5f4 100644 --- a/vnc.js +++ b/vnc.js @@ -260,11 +260,17 @@ init_msg: function () { return; } var types = RQ.shiftBytes(num_types); + if ((types[0] != 1) && (types[0] != 2)) { RFB.updateState('failed', "Disconnected: invalid security types list: " + types); return; } - RFB.auth_scheme = types[0]; + + if (RFB.password.length == 0) { + RFB.auth_scheme = 1; + } else { + RFB.auth_scheme = type[0]; + } RFB.send_array([RFB.auth_scheme]); } else if (RFB.version == 3.3) { if (RQ.length < 4) { @@ -289,8 +295,8 @@ init_msg: function () { RFB.updateState('failed', "Disconnected: auth failure: " + reason); return; case 1: // no authentication - RFB.send_array([RFB.shared]); // ClientInitialisation - RFB.updateState('ServerInitialisation'); + // RFB.send_array([RFB.shared]); // ClientInitialisation + RFB.updateState('SecurityResult'); break; case 2: // VNC authentication if (RQ.length < 16) {