From d40db7cd3cfd12256f0751af630540930e814393 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 2 Dec 2020 22:55:16 -0800 Subject: [PATCH] GUACAMOLE-1227: Build support for generic VNC credentials only if supported by libvncclient. --- configure.ac | 28 ++++++++++++++++++++++++++++ src/protocols/vnc/auth.c | 2 ++ src/protocols/vnc/auth.h | 2 ++ src/protocols/vnc/vnc.c | 2 ++ 4 files changed, 34 insertions(+) diff --git a/configure.ac b/configure.ac index e23003ff..ffd0e233 100644 --- a/configure.ac +++ b/configure.ac @@ -572,6 +572,34 @@ then fi +# +# Generic credential support within libVNCServer (authentication beyond +# basic, standard VNC passwords) +# + +if test "x${have_libvncserver}" = "xyes" +then + + have_vnc_creds=yes + AC_CHECK_MEMBERS([rfbClient.GetCredential], + [], [have_vnc_creds=no], + [[#include ]]) + + if test "x${have_vnc_creds}" = "xno" + then + AC_MSG_WARN([ + -------------------------------------------- + No generic credential support found in libvncclient. + VNC authentication support will be limited to passwords. + --------------------------------------------]) + else + AC_DEFINE([ENABLE_VNC_GENERIC_CREDENTIALS],, + [Whether support for generic VNC credentials is available.]) + fi + +fi + + # # FreeRDP 2 (libfreerdp2, libfreerdp-client2, and libwinpr2) # diff --git a/src/protocols/vnc/auth.c b/src/protocols/vnc/auth.c index c26e4d2e..45dacb64 100644 --- a/src/protocols/vnc/auth.c +++ b/src/protocols/vnc/auth.c @@ -63,6 +63,7 @@ char* guac_vnc_get_password(rfbClient* client) { } +#ifdef ENABLE_VNC_GENERIC_CREDENTIALS rfbCredential* guac_vnc_get_credentials(rfbClient* client, int credentialType) { guac_client* gc = rfbClientGetClientData(client, GUAC_VNC_CLIENT_KEY); @@ -117,3 +118,4 @@ rfbCredential* guac_vnc_get_credentials(rfbClient* client, int credentialType) { return NULL; } +#endif diff --git a/src/protocols/vnc/auth.h b/src/protocols/vnc/auth.h index 155a48db..46793b46 100644 --- a/src/protocols/vnc/auth.h +++ b/src/protocols/vnc/auth.h @@ -38,6 +38,7 @@ */ char* guac_vnc_get_password(rfbClient* client); +#ifdef ENABLE_VNC_GENERIC_CREDENTIALS /** * Callback which is invoked by libVNCServer when it needs to read the user's * VNC credentials. The credentials are stored in the connection settings, @@ -55,6 +56,7 @@ char* guac_vnc_get_password(rfbClient* client); * The rfbCredential object that contains the required credentials. */ rfbCredential* guac_vnc_get_credentials(rfbClient* client, int credentialType); +#endif #endif diff --git a/src/protocols/vnc/vnc.c b/src/protocols/vnc/vnc.c index 33bd5c59..a310e515 100644 --- a/src/protocols/vnc/vnc.c +++ b/src/protocols/vnc/vnc.c @@ -154,8 +154,10 @@ rfbClient* guac_vnc_get_client(guac_client* client) { } +#ifdef ENABLE_VNC_GENERIC_CREDENTIALS /* Authentication */ rfb_client->GetCredential = guac_vnc_get_credentials; +#endif /* Password */ rfb_client->GetPassword = guac_vnc_get_password;