This patch adds ability to use TightVNC protocol with rfbAuthNone, e.g.
when running with TurboVNC server.

James 2014

diff -ur ssvnc-1.0.30-old/vnc_unixsrc/vncviewer/rfbproto.c ssvnc-1.0.30/vnc_unixsrc/vncviewer/rfbproto.c
--- ssvnc-1.0.30-old/vnc_unixsrc/vncviewer/rfbproto.c	2011-05-23 07:06:37.000000000 +0700
+++ ssvnc-1.0.30/vnc_unixsrc/vncviewer/rfbproto.c	2014-06-12 00:01:06.946248970 +0700
@@ -238,6 +238,8 @@
 	  "Standard VNC password authentication");
   CapsAdd(authCaps, rfbAuthUnixLogin, rfbTightVncVendor, sig_rfbAuthUnixLogin,
 	  "Login-style Unix authentication");
+  CapsAdd(authCaps, rfbAuthNone, rfbStandardVendor, sig_rfbAuthNone,
+	  "No authentication");
 
   /* Supported encoding types */
   CapsAdd(encodingCaps, rfbEncodingCopyRect, rfbStandardVendor,
@@ -1224,7 +1226,7 @@
 /*
  * Negotiate authentication scheme (protocol version 3.7t)
  */
-
+static Bool AcknowledgeAuthNone(void);
 static Bool
 PerformAuthenticationTight(void)
 {
@@ -1242,25 +1244,7 @@
 	caps.nAuthTypes = Swap32IfLE(caps.nAuthTypes);
 
 	if (!caps.nAuthTypes) {
-		fprintf(stderr, "No VNC authentication needed\n\n");
-		if (viewer_minor >= 8) {
-			CARD32 authResult;
-
-			if (!ReadFromRFBServer((char *)&authResult, 4)) {
-				return False;
-			}
-
-			authResult = Swap32IfLE(authResult);
-
-			if (authResult == rfbVncAuthOK) {
-				fprintf(stderr, "VNC authentication succeeded (%d) for PerformAuthenticationTight rfbSecTypeNone (RFB 3.8)\n", (int) authResult);
-			} else {
-				sprintf(msgbuf, "VNC authentication failed (%d) for PerformAuthenticationTight rfbSecTypeNone (RFB 3.8)\n\n", (int) authResult);
-				wmsg(msgbuf, 1);
-				return False;
-			}
-		}
-		return True;
+		return AcknowledgeAuthNone();
 	}
 
 	if (!ReadCapabilityList(authCaps, caps.nAuthTypes)) {
@@ -1279,7 +1263,7 @@
 	/* Otherwise, try server's preferred authentication scheme. */
 	for (i = 0; i < CapsNumEnabled(authCaps); i++) {
 		authScheme = CapsGetByOrder(authCaps, i);
-		if (authScheme != rfbAuthUnixLogin && authScheme != rfbAuthVNC) {
+		if (authScheme != rfbAuthUnixLogin && authScheme != rfbAuthVNC && authScheme != rfbAuthNone) {
 			continue;                 /* unknown scheme - cannot use it */
 		}
 		authScheme = Swap32IfLE(authScheme);
@@ -1291,6 +1275,8 @@
 			return AuthenticateUnixLogin();
 		} else if (authScheme == rfbAuthVNC) {
 			return AuthenticateVNC();
+		} else if (authScheme == rfbAuthNone) {
+			return AcknowledgeAuthNone();
 		} else {
 			/* Should never happen. */
 			fprintf(stderr, "Assertion failed: unknown authentication scheme\n");
@@ -1302,6 +1288,27 @@
 	wmsg(msgbuf, 1);
 	return False;
 }
+static Bool
+AcknowledgeAuthNone() {
+	CARD32 authResult;
+	
+	fprintf(stderr, "No VNC authentication needed\n\n");
+	if (viewer_minor < 8) return True; // no acknowledgement needed for pre 3.8
+	
+	if (!ReadFromRFBServer((char *)&authResult, 4)) {
+		return False;
+	}
+
+	authResult = Swap32IfLE(authResult);
+	if (authResult == rfbVncAuthOK) {
+		fprintf(stderr, "VNC authentication succeeded (%d) for PerformAuthenticationTight rfbSecTypeNone (RFB 3.8)\n", (int) authResult);
+	} else {
+		sprintf(msgbuf, "VNC authentication failed (%d) for PerformAuthenticationTight rfbSecTypeNone (RFB 3.8)\n\n", (int) authResult);
+		wmsg(msgbuf, 1);
+		return False;
+	}
+	return True;
+}
 
 #if 0
 unsigned char encPasswd[8];
