THRIFT-4579: Move up to Ubuntu Bionic for CI builds
make dlang library compatible with openssl-1.1 for Ubuntu Bionic
Requires an upstream deimos update to be compatible.
diff --git a/lib/cpp/src/thrift/stdcxx.h b/lib/cpp/src/thrift/stdcxx.h
index 5113940..c8cabf5 100644
--- a/lib/cpp/src/thrift/stdcxx.h
+++ b/lib/cpp/src/thrift/stdcxx.h
@@ -21,6 +21,7 @@
#define _THRIFT_STDCXX_H_ 1
#include <boost/config.hpp>
+#include <boost/version.hpp>
///////////////////////////////////////////////////////////////////
//
@@ -29,7 +30,11 @@
///////////////////////////////////////////////////////////////////
#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) || (defined(_MSC_VER) && _MSC_VER < 1800) || defined(FORCE_BOOST_FUNCTIONAL)
+#if (BOOST_VERSION <= 106500)
#include <boost/tr1/functional.hpp>
+#else
+#include <tr1/functional>
+#endif
#define _THRIFT_FUNCTIONAL_TR1_ 1
#endif
diff --git a/lib/cpp/test/TFileTransportTest.cpp b/lib/cpp/test/TFileTransportTest.cpp
index 700a1ac..d0c26b3 100644
--- a/lib/cpp/test/TFileTransportTest.cpp
+++ b/lib/cpp/test/TFileTransportTest.cpp
@@ -53,20 +53,6 @@
* Helper code
**************************************************************************/
-// Provide BOOST_WARN_LT() and BOOST_WARN_GT(), in case we're compiled
-// with an older version of boost
-#ifndef BOOST_WARN_LT
-#define BOOST_WARN_CMP(a, b, op, check_fn) \
- check_fn((a)op(b), \
- "check " BOOST_STRINGIZE(a) " " BOOST_STRINGIZE(op) " " BOOST_STRINGIZE( \
- b) " failed: " BOOST_STRINGIZE(a) "=" \
- << (a) << " " BOOST_STRINGIZE(b) "=" << (b))
-
-#define BOOST_WARN_LT(a, b) BOOST_WARN_CMP(a, b, <, BOOST_WARN_MESSAGE)
-#define BOOST_WARN_GT(a, b) BOOST_WARN_CMP(a, b, >, BOOST_WARN_MESSAGE)
-#define BOOST_WARN_LT(a, b) BOOST_WARN_CMP(a, b, <, BOOST_WARN_MESSAGE)
-#endif // BOOST_WARN_LT
-
/**
* Class to record calls to fsync
*/
@@ -218,7 +204,7 @@
// If any attempt takes more than 500ms, treat that as a failure.
// Treat this as a fatal failure, so we'll return now instead of
// looping over a very slow operation.
- BOOST_WARN_LT(delta, 500000);
+ BOOST_WARN( delta < 500000 );
// Normally, it takes less than 100ms on my dev box.
// However, if the box is heavily loaded, some of the test runs
@@ -296,7 +282,7 @@
for (FsyncLog::CallList::const_iterator it = calls->begin(); it != calls->end(); ++it) {
if (prev_time) {
int delta = time_diff(prev_time, &it->time);
- BOOST_WARN_LT(delta, max_allowed_delta);
+ BOOST_WARN( delta < max_allowed_delta );
}
prev_time = &it->time;
}
@@ -346,7 +332,7 @@
// Use a fatal fail so we break out early, rather than continuing to make
// many more slow flush() calls.
int delta = time_diff(&start, &now);
- BOOST_WARN_LT(delta, 2000000);
+ BOOST_WARN( delta < 2000000 );
}
}
diff --git a/lib/d/src/thrift/server/base.d b/lib/d/src/thrift/server/base.d
index f97adbe..b19768e 100644
--- a/lib/d/src/thrift/server/base.d
+++ b/lib/d/src/thrift/server/base.d
@@ -112,12 +112,12 @@
outputProtocolFactory_ = outputProtocolFactory;
}
- TProcessorFactory processorFactory_;
- TServerTransport serverTransport_;
- TTransportFactory inputTransportFactory_;
- TTransportFactory outputTransportFactory_;
- TProtocolFactory inputProtocolFactory_;
- TProtocolFactory outputProtocolFactory_;
+ public TProcessorFactory processorFactory_;
+ public TServerTransport serverTransport_;
+ public TTransportFactory inputTransportFactory_;
+ public TTransportFactory outputTransportFactory_;
+ public TProtocolFactory inputProtocolFactory_;
+ public TProtocolFactory outputProtocolFactory_;
}
/**
diff --git a/lib/d/src/thrift/transport/ssl.d b/lib/d/src/thrift/transport/ssl.d
index fbcb6ee..f8ce40e 100644
--- a/lib/d/src/thrift/transport/ssl.d
+++ b/lib/d/src/thrift/transport/ssl.d
@@ -249,8 +249,12 @@
}
count_++;
- ctx_ = SSL_CTX_new(SSLv23_method());
- SSL_CTX_set_options(ctx_, SSL_OP_NO_SSLv2);
+ static if (OPENSSL_VERSION_NUMBER >= 0x1010000f) { // OPENSSL_VERSION_AT_LEAST(1, 1)) {
+ ctx_ = SSL_CTX_new(TLS_method());
+ } else {
+ ctx_ = SSL_CTX_new(SSLv23_method());
+ SSL_CTX_set_options(ctx_, SSL_OP_NO_SSLv2);
+ }
SSL_CTX_set_options(ctx_, SSL_OP_NO_SSLv3); // THRIFT-3164
enforce(ctx_, getSSLException("SSL_CTX_new"));
SSL_CTX_set_mode(ctx_, SSL_MODE_AUTO_RETRY);
@@ -448,6 +452,7 @@
}
initialized_ = true;
+ static if (OPENSSL_VERSION_NUMBER < 0x1010000f) { // OPENSSL_VERSION_BEFORE(1, 1)) {
SSL_library_init();
SSL_load_error_strings();
@@ -465,12 +470,14 @@
CRYPTO_set_dynlock_create_callback(assumeNothrow(&dynlockCreateCallback));
CRYPTO_set_dynlock_lock_callback(assumeNothrow(&dynlockLockCallback));
CRYPTO_set_dynlock_destroy_callback(assumeNothrow(&dynlockDestroyCallback));
+ }
}
static void cleanupOpenSSL() {
if (!initialized_) return;
initialized_ = false;
+ static if (OPENSSL_VERSION_NUMBER < 0x1010000f) { // OPENSSL_VERSION_BEFORE(1, 1)) {
CRYPTO_set_locking_callback(null);
CRYPTO_set_dynlock_create_callback(null);
CRYPTO_set_dynlock_lock_callback(null);
@@ -478,6 +485,7 @@
CRYPTO_cleanup_all_ex_data();
ERR_free_strings();
ERR_remove_state(0);
+ }
}
static extern(C) {
diff --git a/lib/py/src/transport/TSSLSocket.py b/lib/py/src/transport/TSSLSocket.py
index f85778a..b54ca5d 100644
--- a/lib/py/src/transport/TSSLSocket.py
+++ b/lib/py/src/transport/TSSLSocket.py
@@ -368,7 +368,7 @@
plain_client, addr = self.handle.accept()
try:
client = self._wrap_socket(plain_client)
- except (ssl.SSLError, OSError):
+ except (ssl.SSLError, socket.error, OSError):
logger.exception('Error while accepting from %s', addr)
# failed handshake/ssl wrap, close socket to client
plain_client.close()