fix openssl build with boost-1.46

This commit is contained in:
Arvid Norberg 2012-02-25 08:31:25 +00:00
parent 3ef9190b01
commit b5bf19c07b
5 changed files with 23 additions and 7 deletions

View File

@ -73,7 +73,7 @@ rule linking ( properties * )
}
# gcrypt libraries, if enabled
if <encryption>gcrypt in $(properties) || <encryption>openssl in $(properties)
if <encryption>gcrypt in $(properties)
{
# on mac os x, adding the /opt/local/include path
# would include openssl headers incompatible with

View File

@ -69,7 +69,9 @@ public:
void set_verify_callback(T const& fun, error_code& ec)
{ m_sock.set_verify_callback(fun, ec); }
#if BOOST_VERSION > 104600
SSL* native_handle() { return m_sock.native_handle(); }
#endif
typedef boost::function<void(error_code const&)> handler_type;

View File

@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/debug.hpp"
#endif
#ifdef TORRENT_USE_OPENSSL
#if defined TORRENT_USE_OPENSSL && BOOST_VERSION > 104600
#include <boost/asio/ssl/rfc2818_verification.hpp>
#endif
@ -340,7 +340,7 @@ void http_connection::start(std::string const& hostname, std::string const& port
}
}
#ifdef TORRENT_USE_OPENSSL
#if defined TORRENT_USE_OPENSSL && BOOST_VERSION > 104600
// for SSL connections, make sure to authenticate the hostname
// of the certificate
#define CASE(t) case socket_type_int_impl<ssl_stream<t> >::value: \
@ -361,6 +361,8 @@ void http_connection::start(std::string const& hostname, std::string const& port
, me, ec, (char*)0, 0));
return;
}
#undef CASE
#endif
#if TORRENT_USE_I2P

View File

@ -537,7 +537,7 @@ namespace aux {
int session_impl::logging_allocator::allocated_bytes = 0;
#endif
#ifdef TORRENT_USE_OPENSSL
#if defined TORRENT_USE_OPENSSL && BOOST_VERSION > 104600
// when running bittorrent over SSL, the SNI (server name indication)
// extension is used to know which torrent the incoming connection is
// trying to connect to. The 40 first bytes in the name is expected to
@ -684,8 +684,10 @@ namespace aux {
error_code ec;
#ifdef TORRENT_USE_OPENSSL
m_ssl_ctx.set_verify_mode(asio::ssl::context::verify_none, ec);
#if BOOST_VERSION > 104600
SSL_CTX_set_tlsext_servername_callback(m_ssl_ctx.native_handle(), servername_callback);
SSL_CTX_set_tlsext_servername_arg(m_ssl_ctx.native_handle(), this);
#endif // BOOST_VERSION
#endif
#ifndef TORRENT_DISABLE_DHT

View File

@ -1477,7 +1477,7 @@ namespace libtorrent
// tell the client we need a cert for this torrent
alerts().post_alert(torrent_need_cert_alert(get_handle()));
#else
set_error(asio::error::not_supported, "x.509 certificate");
set_error(asio::error::operation_not_supported, "x.509 certificate");
pause();
#endif
}
@ -4606,7 +4606,7 @@ namespace libtorrent
str->set_dst_name(hostname);
}
#ifdef TORRENT_USE_OPENSSL
#if defined TORRENT_USE_OPENSSL && BOOST_VERSION > 104600
// for SSL connections, make sure to authenticate the hostname
// of the certificate
#define CASE(t) case socket_type_int_impl<ssl_stream<t> >::value: \
@ -4626,6 +4626,7 @@ namespace libtorrent
m_ses.m_alerts.post_alert(url_seed_alert(get_handle(), web->url, ec));
return;
}
#undef CASE
#endif
boost::intrusive_ptr<peer_connection> c;
@ -5494,7 +5495,7 @@ namespace libtorrent
(void)ret;
TORRENT_ASSERT(ret);
#ifdef TORRENT_USE_OPENSSL
#if defined TORRENT_USE_OPENSSL && BOOST_VERSION > 104600
if (is_ssl_torrent())
{
// for ssl sockets, set the hostname
@ -5512,6 +5513,7 @@ namespace libtorrent
default: break;
};
}
#undef CASE
#endif
}
@ -5644,6 +5646,7 @@ namespace libtorrent
// INVARIANT_CHECK;
#ifdef TORRENT_USE_OPENSSL
#if BOOST_VERSION > 104600
if (is_ssl_torrent())
{
// if this is an SSL torrent, don't allow non SSL peers on it
@ -5684,6 +5687,13 @@ namespace libtorrent
return false;
}
}
#else // BOOST_VERSION
if (is_ssl_torrent())
{
p->disconnect(asio::error::operation_not_supported);
return false;
}
#endif
#endif // TORRENT_USE_OPENSSL
TORRENT_ASSERT(p != 0);