GUACAMOLE-623: Support older libwebsockets SSL initialization.
diff --git a/configure.ac b/configure.ac
index d26db39..bb23f62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1198,14 +1198,32 @@
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],
diff --git a/src/protocols/kubernetes/kubernetes.c b/src/protocols/kubernetes/kubernetes.c
index f314c59..9cb0b13 100644
--- a/src/protocols/kubernetes/kubernetes.c
+++ b/src/protocols/kubernetes/kubernetes.c
@@ -268,9 +268,15 @@
* 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 */