From f481e2f194d60e9be39ca44ede8d46717937451e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sat, 28 Apr 2018 13:37:46 +0200 Subject: =?UTF-8?q?Fix=20the=20test=5Fsuite=20by=20using=20catch=E2=80=99s?= =?UTF-8?q?=20single=5Finclude=20directory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 +- tests/network.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d31900..1fe8010 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -308,7 +308,7 @@ set_target_properties(catch PROPERTIES EXCLUDE_FROM_ALL TRUE) ExternalProject_Get_Property(catch SOURCE_DIR) if(NOT EXISTS ${CMAKE_SOURCE_DIR}/tests/catch.hpp) target_include_directories(test_suite - PUBLIC "${SOURCE_DIR}/include/" + PUBLIC "${SOURCE_DIR}/single_include/" ) add_dependencies(test_suite catch) endif() diff --git a/tests/network.cpp b/tests/network.cpp index 33cf023..a52eb6a 100644 --- a/tests/network.cpp +++ b/tests/network.cpp @@ -1,5 +1,6 @@ #include "catch.hpp" #include +#include #ifdef BOTAN_FOUND TEST_CASE("tls_policy") -- cgit v1.2.3 From d887baa064318fdb350fb6c3f7b8e2104a644fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sat, 28 Apr 2018 13:55:35 +0200 Subject: Fix a crash when botan policy does not allow any available ciphersuite --- CHANGELOG.rst | 6 ++++++ src/network/tcp_client_socket_handler.cpp | 15 +++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8fdafe9..338b6ac 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,9 @@ +Version 7.3 +=========== + +- Fix an uncaught exception with botan, when policy does not allow any + available ciphersuite. + Version 7.2 - 2018-01-24 ======================== diff --git a/src/network/tcp_client_socket_handler.cpp b/src/network/tcp_client_socket_handler.cpp index aac13d0..9dda73d 100644 --- a/src/network/tcp_client_socket_handler.cpp +++ b/src/network/tcp_client_socket_handler.cpp @@ -146,15 +146,22 @@ void TCPClientSocketHandler::connect(const std::string& address, const std::stri || errno == EISCONN) { log_info("Connection success."); +#ifdef BOTAN_FOUND + if (this->use_tls) + try { + this->start_tls(this->address, this->port); + } catch (const Botan::Exception& e) + { + this->on_connection_failed("TLS error: "s + e.what()); + this->close(); + return ; + } +#endif TimedEventsManager::instance().cancel("connection_timeout" + std::to_string(this->socket)); this->poller->add_socket_handler(this); this->connected = true; this->connecting = false; -#ifdef BOTAN_FOUND - if (this->use_tls) - this->start_tls(this->address, this->port); -#endif this->connection_date = std::chrono::system_clock::now(); // Get our local TCP port and store it -- cgit v1.2.3