diff options
author | runge <runge@karlrunge.com> | 2010-01-02 20:57:46 -0500 |
---|---|---|
committer | runge <runge@karlrunge.com> | 2010-01-02 20:57:46 -0500 |
commit | 671a759d38bde1803048e7d84a999c8af5443d8b (patch) | |
tree | 4c554d088aafdb2eec325b4cf8bdb4e0803e6407 | |
parent | c15b6165abab0583e0975a2aa58a85b6d0901b8a (diff) | |
parent | b019572e73be8f861626943ced1a9e48ebeba838 (diff) | |
download | libvncserver-671a759d38bde1803048e7d84a999c8af5443d8b.zip libvncserver-671a759d38bde1803048e7d84a999c8af5443d8b.tar.gz |
Merge branch 'master' of ssh://runge@libvncserver.git.sourceforge.net/gitroot/libvncserver/libvncserver
-rw-r--r-- | libvncclient/rfbproto.c | 59 | ||||
-rw-r--r-- | libvncclient/vncviewer.c | 3 | ||||
-rw-r--r-- | rfb/rfbclient.h | 5 |
3 files changed, 61 insertions, 6 deletions
diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c index d0e324d..83cfbf9 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -509,12 +509,30 @@ ReadSupportedSecurityType(rfbClient* client, uint32_t *result, rfbBool subAuth) if (tAuth[loop]==rfbVncAuth || tAuth[loop]==rfbNoAuth || tAuth[loop]==rfbMSLogon || (!subAuth && (tAuth[loop]==rfbTLS || tAuth[loop]==rfbVeNCrypt))) { - flag++; - authScheme=tAuth[loop]; - rfbClientLog("Selecting security type %d (%d/%d in the list)\n", authScheme, loop, count); - /* send back a single byte indicating which security type to use */ - if (!WriteToRFBServer(client, (char *)&tAuth[loop], 1)) return FALSE; - + if (!subAuth && client->clientAuthSchemes) + { + int i; + for (i=0;client->clientAuthSchemes[i];i++) + { + if (client->clientAuthSchemes[i]==(uint32_t)tAuth[loop]) + { + flag++; + authScheme=tAuth[loop]; + break; + } + } + } + else + { + flag++; + authScheme=tAuth[loop]; + } + if (flag) + { + rfbClientLog("Selecting security type %d (%d/%d in the list)\n", authScheme, loop, count); + /* send back a single byte indicating which security type to use */ + if (!WriteToRFBServer(client, (char *)&tAuth[loop], 1)) return FALSE; + } } } if (authScheme==0) @@ -719,6 +737,35 @@ HandleMSLogonAuth(rfbClient *client) } /* + * SetClientAuthSchemes. + */ + +void +SetClientAuthSchemes(rfbClient* client,const uint32_t *authSchemes, int size) +{ + int i; + + if (client->clientAuthSchemes) + { + free(client->clientAuthSchemes); + client->clientAuthSchemes = NULL; + } + if (authSchemes) + { + if (size<0) + { + /* If size<0 we assume the passed-in list is also 0-terminate, so we + * calculate the size here */ + for (size=0;authSchemes[size];size++) ; + } + client->clientAuthSchemes = (uint32_t*)malloc(sizeof(uint32_t)*(size+1)); + for (i=0;i<size;i++) + client->clientAuthSchemes[i] = authSchemes[i]; + client->clientAuthSchemes[size] = 0; + } +} + +/* * InitialiseRFBConnection. */ diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c index 0361827..111a7f6 100644 --- a/libvncclient/vncviewer.c +++ b/libvncclient/vncviewer.c @@ -192,6 +192,7 @@ rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel, #endif client->sock = -1; client->listenSock = -1; + client->clientAuthSchemes = NULL; return client; } @@ -341,5 +342,7 @@ void rfbClientCleanup(rfbClient* client) { close(client->listenSock); free(client->desktopName); free(client->serverHost); + if (client->clientAuthSchemes) + free(client->clientAuthSchemes); free(client); } diff --git a/rfb/rfbclient.h b/rfb/rfbclient.h index d70ece1..a82ea22 100644 --- a/rfb/rfbclient.h +++ b/rfb/rfbclient.h @@ -305,6 +305,10 @@ typedef struct _rfbClient { * be bypassed. */ GetCredentialProc GetCredential; + + /* The 0-terminated security types supported by the client. + * Set by function SetClientAuthSchemes() */ + uint32_t *clientAuthSchemes; } rfbClient; /* cursor.c */ @@ -322,6 +326,7 @@ extern rfbBool rfbEnableClientLogging; typedef void (*rfbClientLogProc)(const char *format, ...); extern rfbClientLogProc rfbClientLog,rfbClientErr; extern rfbBool ConnectToRFBServer(rfbClient* client,const char *hostname, int port); +extern void SetClientAuthSchemes(rfbClient* client,const uint32_t *authSchemes, int size); extern rfbBool InitialiseRFBConnection(rfbClient* client); extern rfbBool SetFormatAndEncodings(rfbClient* client); extern rfbBool SendIncrementalFramebufferUpdateRequest(rfbClient* client); |