GUACAMOLE-623: Support older libwebsockets SSL initialization.

This commit is contained in:
Michael Jumper 2018-09-26 21:50:19 -07:00
parent af93cfb32a
commit d8618b0682
2 changed files with 26 additions and 2 deletions

View File

@ -1198,14 +1198,32 @@ then
have_libwebsockets=no])
fi
# Check for client-specific closed event, which must be used in favor of the
# generic closed event if libwebsockets is recent enough to provide this
if test "x$with_websockets" != "xno"
then
# Check for client-specific closed event, which must be used in favor of
# the generic closed event if libwebsockets is recent enough to provide
# this
AC_CHECK_DECL([LWS_CALLBACK_CLIENT_CLOSED],
[AC_DEFINE([HAVE_LWS_CALLBACK_CLIENT_CLOSED],,
[Whether LWS_CALLBACK_CLIENT_CLOSED is defined])],,
[#include <libwebsockets.h>])
# Older versions of libwebsockets may not define a flag for requesting
# global initialization of OpenSSL, instead performing that initialization
# by default
AC_CHECK_DECL([LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT],
[AC_DEFINE([HAVE_LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT],,
[Whether LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT is defined])],,
[#include <libwebsockets.h>])
# Older versions of libwebsockets do not define special macros for SSL
# connection flags, instead relying on documented integer values
AC_CHECK_DECL([LCCSCF_USE_SSL],
[AC_DEFINE([HAVE_LCCSCF_USE_SSL],,
[Whether LCCSCF_USE_SSL is defined])],,
[#include <libwebsockets.h>])
fi
AM_CONDITIONAL([ENABLE_WEBSOCKETS],

View File

@ -268,9 +268,15 @@ void* guac_kubernetes_client_thread(void* data) {
* do our own validation - libwebsockets does not validate properly if
* IP addresses are used. */
if (settings->use_ssl) {
#ifdef HAVE_LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT
context_info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
#endif
#ifdef HAVE_LCCSCF_USE_SSL
connection_info.ssl_connection = LCCSCF_USE_SSL
| LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK;
#else
connection_info.ssl_connection = 2; /* SSL + no hostname check */
#endif
}
/* Create libwebsockets context */