From e7cc28e9df0563b816e806cbad775d7a418f3a31 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 1 Aug 2012 15:01:13 +0000 Subject: [PATCH] fix SSL error messages --- ChangeLog | 1 + docs/make_torrent.rst | 3 +++ src/torrent.cpp | 12 +++++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7f588dc2..ff5704e7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ * fix uTP edge case where udp socket buffer fills up * fix nagle implementation in uTP + * fix incorrect SSL error messages * fix windows build of shared library with openssl * fix race condition causing shutdown hang diff --git a/docs/make_torrent.rst b/docs/make_torrent.rst index 9a3778bc4..575ac9010 100644 --- a/docs/make_torrent.rst +++ b/docs/make_torrent.rst @@ -490,6 +490,9 @@ torrent an *SSL torrent*. An SSL torrent requires that each peer has a valid cer signed by this root certificate. For SSL torrents, all peers are connecting over SSL connections. For more information on SSL torrents, see the manual_. +The string is not the path to the cert, it's the actual content of the certificate, +loaded into a std::string. + .. _manual: manual.html#ssl-torrents set_priv() priv() diff --git a/src/torrent.cpp b/src/torrent.cpp index f90a10240..fb265d6c0 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -1468,7 +1468,9 @@ namespace libtorrent if (!ctx) { - set_error(asio::error::no_memory, "SSL context"); + error_code ec(::ERR_get_error(), + asio::error::get_ssl_category()); + set_error(ec, "SSL context"); pause(); return; } @@ -1504,7 +1506,9 @@ namespace libtorrent X509_STORE* cert_store = X509_STORE_new(); if (!cert_store) { - set_error(asio::error::no_memory, "x.509 certificate store"); + error_code ec(::ERR_get_error(), + asio::error::get_ssl_category()); + set_error(ec, "x.509 certificate store"); pause(); return; } @@ -1520,8 +1524,10 @@ namespace libtorrent if (!certificate) { + error_code ec(::ERR_get_error(), + asio::error::get_ssl_category()); X509_STORE_free(cert_store); - set_error(asio::error::no_memory, "x.509 certificate"); + set_error(ec, "x.509 certificate"); pause(); return; }