From b48a1b3a5d15e6c95fa64222342033eb584dc0a3 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 26 Sep 2018 21:51:07 -0700 Subject: [PATCH] GUACAMOLE-623: Use libwebsockets' dummy callback only if defined. --- configure.ac | 8 ++++++++ src/protocols/kubernetes/kubernetes.c | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index bb23f62c..672d19eb 100644 --- a/configure.ac +++ b/configure.ac @@ -1224,6 +1224,14 @@ then [Whether LCCSCF_USE_SSL is defined])],, [#include ]) + # Older versions of libwebsockets do not define a dummy callback which + # must be invoked after the main event callback is invoked; the main event + # callback must instead manually return zero + AC_CHECK_DECL([lws_callback_http_dummy], + [AC_DEFINE([HAVE_LWS_CALLBACK_HTTP_DUMMY],, + [Whether lws_callback_http_dummy() is defined])],, + [#include ]) + fi AM_CONDITIONAL([ENABLE_WEBSOCKETS], diff --git a/src/protocols/kubernetes/kubernetes.c b/src/protocols/kubernetes/kubernetes.c index 9cb0b13b..fb38d680 100644 --- a/src/protocols/kubernetes/kubernetes.c +++ b/src/protocols/kubernetes/kubernetes.c @@ -66,8 +66,13 @@ static int guac_kubernetes_lws_callback(struct lws* wsi, guac_client* client = guac_kubernetes_lws_current_client; /* Do not handle any further events if connection is closing */ - if (client->state != GUAC_CLIENT_RUNNING) + if (client->state != GUAC_CLIENT_RUNNING) { +#ifdef HAVE_LWS_CALLBACK_HTTP_DUMMY return lws_callback_http_dummy(wsi, reason, user, in, length); +#else + return 0; +#endif + } switch (reason) { @@ -127,7 +132,11 @@ static int guac_kubernetes_lws_callback(struct lws* wsi, } +#ifdef HAVE_LWS_CALLBACK_HTTP_DUMMY return lws_callback_http_dummy(wsi, reason, user, in, length); +#else + return 0; +#endif }