GEODE-3415: Use SslException with fixed circular dependency
* Throw std::invalid_argument instead of std::exception to allow passing a message
diff --git a/cppcache/src/TcpSslConn.cpp b/cppcache/src/TcpSslConn.cpp
index 8712ad0..de80c4d 100644
--- a/cppcache/src/TcpSslConn.cpp
+++ b/cppcache/src/TcpSslConn.cpp
@@ -55,7 +55,11 @@
void TcpSslConn::createSocket(ACE_HANDLE sock) {
LOGDEBUG("Creating SSL socket stream");
- m_ssl = getSSLImpl(sock, m_pubkeyfile, m_privkeyfile);
+ try {
+ m_ssl = getSSLImpl(sock, m_pubkeyfile, m_privkeyfile);
+ } catch (std::exception e) {
+ throw SslException(e.what());
+ }
}
void TcpSslConn::listen(ACE_INET_Addr addr,
diff --git a/cryptoimpl/CMakeLists.txt b/cryptoimpl/CMakeLists.txt
index 5d4a609..22a3856 100644
--- a/cryptoimpl/CMakeLists.txt
+++ b/cryptoimpl/CMakeLists.txt
@@ -42,7 +42,6 @@
ACE::ACE_SSL
_WarningsAsError
PUBLIC
- apache-geode
OpenSSL::Crypto
OpenSSL::SSL
c++11
diff --git a/cryptoimpl/DHImpl.cpp b/cryptoimpl/DHImpl.cpp
index 9db49f7..1365d32 100644
--- a/cryptoimpl/DHImpl.cpp
+++ b/cryptoimpl/DHImpl.cpp
@@ -33,8 +33,6 @@
#include <cstring>
#include <memory>
-#include <geode/internal/geode_globals.hpp>
-
/*
static DH * m_dh = nullptr;
static string m_skAlgo;
diff --git a/cryptoimpl/SSLImpl.cpp b/cryptoimpl/SSLImpl.cpp
index 97d5b40..b93b766 100644
--- a/cryptoimpl/SSLImpl.cpp
+++ b/cryptoimpl/SSLImpl.cpp
@@ -18,13 +18,10 @@
#include "SSLImpl.hpp"
#include <cstdint>
+#include <stdexcept>
#include <ace/Guard_T.h>
-#include <geode/ExceptionTypes.hpp>
-
-#include "../cppcache/src/util/exception.hpp"
-
namespace apache {
namespace geode {
namespace client {
@@ -61,7 +58,7 @@
SSL_CTX_set_cipher_list(sslctx->context(), "DEFAULT");
sslctx->set_mode(ACE_SSL_Context::SSLv23_client);
if (sslctx->load_trusted_ca(pubkeyfile) != 0) {
- throw SslException("Failed to read SSL trust store.");
+ throw std::invalid_argument("Failed to read SSL trust store.");
}
if (strlen(password) > 0) {
@@ -71,14 +68,14 @@
}
if (sslctx->private_key(privkeyfile) != 0) {
- throw SslException("Invalid SSL keystore password.");
+ throw std::invalid_argument("Invalid SSL keystore password.");
}
if (sslctx->certificate(privkeyfile) != 0) {
- throw SslException("Failed to read SSL certificate.");
+ throw std::invalid_argument("Failed to read SSL certificate.");
}
if (::SSL_CTX_use_certificate_chain_file(sslctx->context(), privkeyfile) <=
0) {
- throw SslException("Failed to read SSL certificate chain.");
+ throw std::invalid_argument("Failed to read SSL certificate chain.");
}
SSLImpl::s_initialized = true;
}