From 27b4372c94e4d2054d101de9a1eef745e1ebdbae Mon Sep 17 00:00:00 2001
From: Christian Beier <dontmind@freeshell.org>
Date: Wed, 9 Nov 2011 00:25:56 +0100
Subject: When GetCredential() callback is not set, don't use authentications
 requiring it.

The auth methods that employ Getcredential() will only be used if the client's
GetCredential callback is actually set.
---
 libvncclient/rfbproto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c
index d424b04..a7faab1 100644
--- a/libvncclient/rfbproto.c
+++ b/libvncclient/rfbproto.c
@@ -569,8 +569,8 @@ ReadSupportedSecurityType(rfbClient* client, uint32_t *result, rfbBool subAuth)
         rfbClientLog("%d) Received security type %d\n", loop, tAuth[loop]);
         if (flag) continue;
         if (tAuth[loop]==rfbVncAuth || tAuth[loop]==rfbNoAuth ||
-            tAuth[loop]==rfbARD ||
-            (!subAuth && (tAuth[loop]==rfbTLS || tAuth[loop]==rfbVeNCrypt)))
+            (tAuth[loop]==rfbARD && client->GetCredential) ||
+            (!subAuth && (tAuth[loop]==rfbTLS || (tAuth[loop]==rfbVeNCrypt && client->GetCredential))))
         {
             if (!subAuth && client->clientAuthSchemes)
             {
-- 
cgit v1.2.3

