aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee
diff options
context:
space:
mode:
authorLee *!* Clagett <code@leeclagett.com>2023-06-09 11:09:39 -0400
committerLee *!* Clagett <code@leeclagett.com>2023-06-09 11:16:03 -0400
commit0961c2abe4fd78f0bd8c8bfac2fd5cdf6544b094 (patch)
tree44b8180bf58882007de8d26701ffc6afcbba1df5 /contrib/epee
parentMerge pull request #8842 (diff)
downloadmonero-0961c2abe4fd78f0bd8c8bfac2fd5cdf6544b094.tar.xz
Set SSL SNI even when server verification is disabled
Diffstat (limited to 'contrib/epee')
-rw-r--r--contrib/epee/src/net_ssl.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/contrib/epee/src/net_ssl.cpp b/contrib/epee/src/net_ssl.cpp
index ff9c48c34..f42ef073b 100644
--- a/contrib/epee/src/net_ssl.cpp
+++ b/contrib/epee/src/net_ssl.cpp
@@ -497,6 +497,13 @@ void ssl_options_t::configure(
const std::string& host) const
{
socket.next_layer().set_option(boost::asio::ip::tcp::no_delay(true));
+ {
+ // in case server is doing "virtual" domains, set hostname
+ SSL* const ssl_ctx = socket.native_handle();
+ if (type == boost::asio::ssl::stream_base::client && !host.empty() && ssl_ctx)
+ SSL_set_tlsext_host_name(ssl_ctx, host.c_str());
+ }
+
/* Using system-wide CA store for client verification is funky - there is
no expected hostname for server to verify against. If server doesn't have
@@ -514,11 +521,7 @@ void ssl_options_t::configure(
{
socket.set_verify_mode(boost::asio::ssl::verify_peer | boost::asio::ssl::verify_fail_if_no_peer_cert);
- // in case server is doing "virtual" domains, set hostname
- SSL* const ssl_ctx = socket.native_handle();
- if (type == boost::asio::ssl::stream_base::client && !host.empty() && ssl_ctx)
- SSL_set_tlsext_host_name(ssl_ctx, host.c_str());
-
+
socket.set_verify_callback([&](const bool preverified, boost::asio::ssl::verify_context &ctx)
{
// preverified means it passed system or user CA check. System CA is never loaded