1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
Index: src/torrent.cpp
===================================================================
--- src/torrent.cpp (revision 6508)
+++ src/torrent.cpp (working copy)
@@ -85,9 +85,11 @@
#ifdef TORRENT_USE_OPENSSL
#include "libtorrent/ssl_stream.hpp"
#include <boost/asio/ssl/context.hpp>
+#if BOOST_VERSION > 104700
#include <boost/asio/ssl/rfc2818_verification.hpp>
#include <boost/asio/ssl/verify_context.hpp>
-#endif
+#endif // BOOST_VERSION
+#endif // TORRENT_USE_OPENSSL
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
#include "libtorrent/struct_debug.hpp"
@@ -1287,6 +1289,7 @@
#ifdef TORRENT_USE_OPENSSL
+#if BOOST_VERSION > 104600
bool torrent::verify_peer_cert(bool preverified, boost::asio::ssl::verify_context& ctx)
{
// if the cert wasn't signed by the correct CA, fail the verification
@@ -1372,6 +1375,7 @@
return false;
}
+#endif // BOOST_VERSION
void torrent::init_ssl(std::string const& cert)
{
@@ -1388,6 +1392,7 @@
TORRENT_ASSERT(RAND_status() == 1);
+#if BOOST_VERSION > 104600
// create the SSL context for this torrent. We need to
// inject the root certificate, and no other, to
// verify other peers against
@@ -1469,9 +1474,12 @@
#endif
// if all went well, set the torrent ssl context to this one
m_ssl_ctx = ctx;
-
// 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");
+ pause();
+#endif
}
#endif // TORRENT_OPENSSL
Index: include/libtorrent/torrent.hpp
===================================================================
--- include/libtorrent/torrent.hpp (revision 6508)
+++ include/libtorrent/torrent.hpp (working copy)
@@ -47,6 +47,7 @@
#include <boost/enable_shared_from_this.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/intrusive_ptr.hpp>
+#include <boost/version.hpp>
#ifdef _MSC_VER
#pragma warning(pop)
@@ -954,7 +955,10 @@
#ifdef TORRENT_USE_OPENSSL
boost::shared_ptr<asio::ssl::context> m_ssl_ctx;
+#if BOOST_VERSION > 104600
bool verify_peer_cert(bool preverified, boost::asio::ssl::verify_context& ctx);
+#endif
+
void init_ssl(std::string const& cert);
#endif
|