summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@tsaousis.gr>2020-05-30 00:13:42 -0700
committerGitHub <noreply@github.com>2020-05-30 10:13:42 +0300
commit1ac12904b0697f1a3131af2f9ed3addc6b396ad9 (patch)
tree32aa7f70fc7bdbe4c80925161547199c02466266
parentfd109551e37532201a22f672c7d5ad1304206ed9 (diff)
fix compilation for older systems (#9198)
inherit libs for clock_gettime() when building libmosquitto; Check that X509_VERIFY_PARAM_set1_host is available on the target system
-rw-r--r--aclk/aclk_lws_https_client.c4
-rw-r--r--aclk/aclk_lws_wss_client.c4
-rw-r--r--configure.ac16
3 files changed, 23 insertions, 1 deletions
diff --git a/aclk/aclk_lws_https_client.c b/aclk/aclk_lws_https_client.c
index cd17625232..018aee259c 100644
--- a/aclk/aclk_lws_https_client.c
+++ b/aclk/aclk_lws_https_client.c
@@ -193,6 +193,10 @@ int aclk_send_https_request(char *method, char *host, char *port, char *url, cha
#else
i.ssl_connection = LCCSCF_USE_SSL;
#endif
+#if defined(HAVE_X509_VERIFY_PARAM_set1_host) && HAVE_X509_VERIFY_PARAM_set1_host == 0
+#warning DISABLING SSL HOSTNAME VALIDATION BECAUSE IT IS NOT AVAILABLE ON THIS SYSTEM.
+ i.ssl_connection |= LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK;
+#endif
i.port = atoi(port);
i.address = host;
diff --git a/aclk/aclk_lws_wss_client.c b/aclk/aclk_lws_wss_client.c
index 9b29188a76..9317d835b5 100644
--- a/aclk/aclk_lws_wss_client.c
+++ b/aclk/aclk_lws_wss_client.c
@@ -322,6 +322,10 @@ int aclk_lws_wss_connect(char *host, int port)
#else
i.ssl_connection = LCCSCF_USE_SSL;
#endif
+#if defined(HAVE_X509_VERIFY_PARAM_set1_host) && HAVE_X509_VERIFY_PARAM_set1_host == 0
+#warning DISABLING SSL HOSTNAME VALIDATION BECAUSE IT IS NOT AVAILABLE ON THIS SYSTEM.
+ i.ssl_connection |= LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK;
+#endif
lws_client_connect_via_info(&i);
return 0;
}
diff --git a/configure.ac b/configure.ac
index 35cf90367d..8fa593c001 100644
--- a/configure.ac
+++ b/configure.ac
@@ -371,6 +371,20 @@ AC_CHECK_LIB(
[SSL_LIBS="-lcrypto -lssl"]
)
+AC_CHECK_LIB(
+ [crypto],
+ [X509_VERIFY_PARAM_set1_host],
+ [ssl_host_validation="yes"],
+ [ssl_host_validation="no"]
+)
+
+if test "${ssl_host_validation}" = "no"; then
+ AC_DEFINE([HAVE_X509_VERIFY_PARAM_set1_host], [0], [ssl host validation])
+ AC_MSG_WARN([DISABLING SSL HOSTNAME VALIDATION BECAUSE IT IS NOT AVAILABLE ON THIS SYSTEM.])
+else
+ AC_DEFINE([HAVE_X509_VERIFY_PARAM_set1_host], [1], [ssl host validation])
+fi
+
# -----------------------------------------------------------------------------
# JSON-C library
@@ -586,7 +600,7 @@ if test "$enable_cloud" != "no"; then
AC_MSG_CHECKING([if libmosquitto static lib is present (and builds)])
if test -f "externaldeps/mosquitto/libmosquitto.a"; then
LIBS_BKP="${LIBS}"
- LIBS="externaldeps/mosquitto/libmosquitto.a ${OPTIONAL_SSL_LIBS}"
+ LIBS="externaldeps/mosquitto/libmosquitto.a ${OPTIONAL_SSL_LIBS} ${LIBS_BKP}"
AC_LINK_IFELSE([AC_LANG_SOURCE([[#include "externaldeps/mosquitto/mosquitto.h"
int main (int argc, char **argv) {
int m,mm,r;