Merge pull request #2663

4b228dd3 cmake: epee: use var from FindOpenSSL.cmake (redfish)
29497f79 epee: use boost type for SSL error code (redfish)
This commit is contained in:
Riccardo Spagni 2017-11-01 11:25:53 +02:00
commit 35dbb3be33
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
3 changed files with 15 additions and 3 deletions

View File

@ -658,6 +658,11 @@ if(NOT Boost_FOUND)
die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (1.58) or the equivalent") die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (1.58) or the equivalent")
elseif(Boost_FOUND) elseif(Boost_FOUND)
message(STATUS "Found Boost Version: ${Boost_VERSION}") message(STATUS "Found Boost Version: ${Boost_VERSION}")
if (Boost_VERSION VERSION_LESS 1.62 AND NOT (OPENSSL_VERSION VERSION_LESS 1.1))
message(FATAL_ERROR "Boost older than 1.62 is too old to link with OpenSSL 1.1 or newer. "
"Update Boost or install OpenSSL 1.0 and set path to it when running cmake: "
"cmake -DOPENSSL_ROOT_DIR='/usr/include/openssl-1.0;/usr/lib/openssl-1.0'")
endif()
endif() endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) include_directories(SYSTEM ${Boost_INCLUDE_DIRS})

View File

@ -36,6 +36,7 @@
#include <istream> #include <istream>
#include <ostream> #include <ostream>
#include <string> #include <string>
#include <boost/version.hpp>
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include <boost/asio/ssl.hpp> #include <boost/asio/ssl.hpp>
#include <boost/asio/steady_timer.hpp> #include <boost/asio/steady_timer.hpp>
@ -576,7 +577,14 @@ namespace net_utils
m_io_service.run_one(); m_io_service.run_one();
} }
// Ignore "short read" error // Ignore "short read" error
if (ec.category() == boost::asio::error::get_ssl_category() && ec.value() != ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ)) if (ec.category() == boost::asio::error::get_ssl_category() &&
ec.value() !=
#if BOOST_VERSION >= 106200
boost::asio::ssl::error::stream_truncated
#else // older Boost supports only OpenSSL 1.0, so 1.0-only macros are appropriate
ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ)
#endif
)
MDEBUG("Problems at ssl shutdown: " << ec.message()); MDEBUG("Problems at ssl shutdown: " << ec.message());
} }

View File

@ -49,6 +49,5 @@ target_link_libraries(epee
easylogging easylogging
${Boost_FILESYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}
PRIVATE PRIVATE
ssl ${OPENSSL_LIBRARIES}
crypto
${EXTRA_LIBRARIES}) ${EXTRA_LIBRARIES})