diff options
author | 2016-08-18 22:24:15 +0200 | |
---|---|---|
committer | 2016-08-18 22:30:13 +0200 | |
commit | 9a7268d86d008c69d0f0ccbb3cda4ed455febdba (patch) | |
tree | 8e16e758ccbc93e31ee1f87f8ca4c6fce71c346e /net-libs | |
parent | net-libs/rb_libtorrent: remove a few old versions (diff) | |
download | gentoo-9a7268d86d008c69d0f0ccbb3cda4ed455febdba.tar.gz gentoo-9a7268d86d008c69d0f0ccbb3cda4ed455febdba.tar.bz2 gentoo-9a7268d86d008c69d0f0ccbb3cda4ed455febdba.zip |
net-libs/rb_libtorrent: revbump with several fixes and improvements
* add libressl support (bug 574004)
* use official "prepared" tarball, saves eautoreconf call (bug 577288)
* link python bindings against the just-built library (bug 578026)
* backport patch for CVE-2016-5301 (bug 585278)
* add subslot
* use system copy of geoip library and allow disabling it via USE flag
* drop some obsolete/redundant options from econf invocation
* revise which logging options are turned on by USE=debug
* fix and unrestrict tests
* don't install .la file when not needed
Package-Manager: portage-2.3.0
Diffstat (limited to 'net-libs')
5 files changed, 446 insertions, 2 deletions
diff --git a/net-libs/rb_libtorrent/Manifest b/net-libs/rb_libtorrent/Manifest index e13d166f28b3..dcccf6518639 100644 --- a/net-libs/rb_libtorrent/Manifest +++ b/net-libs/rb_libtorrent/Manifest @@ -1,4 +1,5 @@ DIST libtorrent-rasterbar-0.16.17.tar.gz 3018881 SHA256 67a1d29c626d991d6e39c2f9828ca70c4053d057070ce01fff9b4ad37e64aff0 SHA512 532b2438e24c3ecad239480a1bd6241a0d73d40f8d5bdcf61ddfcee1a41f1644c9004d4f234968efd50158224219b78852ec936a05b75b15f3442b594460cdd6 WHIRLPOOL 755e201741ed77cf91cb0976cbaa83c645647341d2cfe40564552599f2792ba76bd02e82a94669d80b199f1a1d6290824686d2bb52d6b0da8663d2274176f3eb DIST libtorrent-rasterbar-0.16.19.tar.gz 3030253 SHA256 9ebd3fa8accfa27d0c81cdbbe15d7b411ea1deec34ac6325dec7197f05d82982 SHA512 8e605802cb1ae80228d253adba44da6f5af39e7d65c59f65e15444ed1122500529ee068f6d3608b1c2a249f18b4de695073f7b67772fa445618757697d779340 WHIRLPOOL 4429d07bd95f398a09f283a7cbcf6611aeb8ac5d2b8ed76d98f89d601aa6ed66e6eb8f044b351fad6cca3606351ccc67081dba7c8dd8d9c3c433eae84aedeb2c DIST libtorrent-rasterbar-1.0.7.tar.gz 3298005 SHA256 3e16e024b175fefada17471c659fdbcfab235f9619d4f0913faa13cb02ca8d83 SHA512 d60736af4b7c38317821810995dd9bec21688a9506e9b908394c2a1a87acd2abf23000856dedcad487b9ecc7b5680f83cfc09ff9db79af00fe21e94337daeacf WHIRLPOOL aff289e3ca85eedf688e8a898f0164a4d692e8c813b04dbae6323bc56003f5c3af862167a1d00a8bfe193dfda15d20a18a48bcbeac9313e29d6f2de35d20e621 +DIST libtorrent-rasterbar-1.0.9.tar.gz 3292886 SHA256 11a93125ed49f796fca83da925ab7dc29e91d88b915f078caaddaaf559d63db6 SHA512 68558d440c8220711a410e54a28316b7b98f6dd4d0dae2d56cee3a3f0bd031f8b0623a8eb3fde312c4d1b61b4be8fc21396cb3e9fd7f6d86e3a9a693ee036b66 WHIRLPOOL 2c2f695458fe1069d4159d308def7591bc318eed30e649bc5ad4579fef1c67d3ccabc6acfb7570ae09a9b78fe8c00f975c88d48231b9db71e714672e1043d1f5 DIST rb_libtorrent-1.0.9.tar.gz 2977503 SHA256 f4eadcbc779edc590d0162b0188c1b179d2cc72519c3756989ef925e376ddecd SHA512 0980ebb5567310ad6f235899770cfc7a23ef754f5a8513e1baa8bbec139ff26006a6b47a1cca62e45da496b901c6646eee3dd76ab4bb5410ce3fc119e717c072 WHIRLPOOL 7c6862d9d4fbc27d6de04cba8ac605dbffafcf1b26a3519bc94964727416655450b74cb62928f27fa568dcc163c8a599ca78f080a86171b6e1283d9b794924b8 diff --git a/net-libs/rb_libtorrent/files/rb_libtorrent-1.0.9-CVE-2016-5301.patch b/net-libs/rb_libtorrent/files/rb_libtorrent-1.0.9-CVE-2016-5301.patch new file mode 100644 index 000000000000..19ebeeb2fd98 --- /dev/null +++ b/net-libs/rb_libtorrent/files/rb_libtorrent-1.0.9-CVE-2016-5301.patch @@ -0,0 +1,289 @@ +From 22099cec46741417a6fb6df560468eb64655db33 Mon Sep 17 00:00:00 2001 +From: arvidn <arvid@cs.umu.se> +Date: Sat, 4 Jun 2016 12:49:38 -0400 +Subject: [PATCH] back-port http_parser bugfix + +--- + src/http_parser.cpp | 32 +++++++ + test/test_http_parser.cpp | 142 ++++++++++++++++++++++++------ + +diff --git a/src/http_parser.cpp b/src/http_parser.cpp +index 7664cad..89de739 100644 +--- a/src/http_parser.cpp ++++ b/src/http_parser.cpp +@@ -151,6 +151,7 @@ namespace libtorrent + if (m_state == read_status) + { + TORRENT_ASSERT(!m_finished); ++ TORRENT_ASSERT(pos <= recv_buffer.end); + char const* newline = std::find(pos, recv_buffer.end, '\n'); + // if we don't have a full line yet, wait. + if (newline == recv_buffer.end) +@@ -171,6 +172,7 @@ namespace libtorrent + + char const* line = pos; + ++newline; ++ TORRENT_ASSERT(newline >= pos); + int incoming = int(newline - pos); + m_recv_pos += incoming; + boost::get<1>(ret) += newline - (m_recv_buffer.begin + start_pos); +@@ -204,6 +206,7 @@ namespace libtorrent + if (m_state == read_header) + { + TORRENT_ASSERT(!m_finished); ++ TORRENT_ASSERT(pos <= recv_buffer.end); + char const* newline = std::find(pos, recv_buffer.end, '\n'); + std::string line; + +@@ -254,6 +257,12 @@ namespace libtorrent + if (name == "content-length") + { + m_content_length = strtoll(value.c_str(), 0, 10); ++ if (m_content_length < 0) ++ { ++ m_state = error_state; ++ error = true; ++ return ret; ++ } + } + else if (name == "connection") + { +@@ -271,12 +280,24 @@ namespace libtorrent + if (string_begins_no_case("bytes ", ptr)) ptr += 6; + char* end; + m_range_start = strtoll(ptr, &end, 10); ++ if (m_range_start < 0) ++ { ++ m_state = error_state; ++ error = true; ++ return ret; ++ } + if (end == ptr) success = false; + else if (*end != '-') success = false; + else + { + ptr = end + 1; + m_range_end = strtoll(ptr, &end, 10); ++ if (m_range_end < 0) ++ { ++ m_state = error_state; ++ error = true; ++ return ret; ++ } + if (end == ptr) success = false; + } + +@@ -295,6 +316,7 @@ namespace libtorrent + } + + TORRENT_ASSERT(m_recv_pos <= recv_buffer.left()); ++ TORRENT_ASSERT(pos <= recv_buffer.end); + newline = std::find(pos, recv_buffer.end, '\n'); + } + boost::get<1>(ret) += newline - (m_recv_buffer.begin + start_pos); +@@ -324,6 +346,12 @@ namespace libtorrent + int header_size; + if (parse_chunk_header(buf, &chunk_size, &header_size)) + { ++ if (chunk_size < 0) ++ { ++ m_state = error_state; ++ error = true; ++ return ret; ++ } + if (chunk_size > 0) + { + std::pair<size_type, size_type> chunk_range(m_cur_chunk_end + header_size +@@ -396,6 +424,7 @@ namespace libtorrent + bool http_parser::parse_chunk_header(buffer::const_interval buf + , size_type* chunk_size, int* header_size) + { ++ TORRENT_ASSERT(buf.begin <= buf.end); + char const* pos = buf.begin; + + // ignore one optional new-line. This is since each chunk +@@ -406,6 +435,7 @@ namespace libtorrent + if (pos < buf.end && pos[0] == '\n') ++pos; + if (pos == buf.end) return false; + ++ TORRENT_ASSERT(pos <= buf.end); + char const* newline = std::find(pos, buf.end, '\n'); + if (newline == buf.end) return false; + ++newline; +@@ -418,6 +448,8 @@ namespace libtorrent + + // first, read the chunk length + *chunk_size = strtoll(pos, 0, 16); ++ if (*chunk_size < 0) return true; ++ + if (*chunk_size != 0) + { + *header_size = newline - buf.begin; +diff --git a/test/test_http_parser.cpp b/test/test_http_parser.cpp +index 1385e94..0bbb038 100644 +--- a/test/test_http_parser.cpp ++++ b/test/test_http_parser.cpp +@@ -64,10 +64,13 @@ tuple<int, int, bool> feed_bytes(http_parser& parser, char const* str) + ret.get<1>() += protocol; + ret.get<2>() |= error; + // std::cerr << payload << ", " << protocol << ", " << chunk_size << std::endl; +- TORRENT_ASSERT(payload + protocol == chunk_size); ++ TORRENT_ASSERT(payload + protocol == chunk_size || error); ++ } ++ if (!ret.get<2>()) ++ { ++ TEST_CHECK(prev == make_tuple(0, 0, false) || ret == prev); ++ TEST_EQUAL(ret.get<0>() + ret.get<1>(), strlen(str)); + } +- TEST_CHECK(prev == make_tuple(0, 0, false) || ret == prev); +- TEST_EQUAL(ret.get<0>() + ret.get<1>(), strlen(str)); + prev = ret; + } + return ret; +@@ -316,29 +319,6 @@ int test_main() + TEST_EQUAL(parser.headers().find("test2")->second, "bar"); + } + +- // test chunked encoding +- +- parser.reset(); +- +- char const* chunked_input = +- "HTTP/1.1 200 OK\r\n" +- "Transfer-Encoding: chunked\r\n" +- "Content-Type: text/plain\r\n" +- "\r\n" +- "4\r\ntest\r\n4\r\n1234\r\n10\r\n0123456789abcdef\r\n" +- "0\r\n\r\n"; +- received = feed_bytes(parser, chunked_input); +- +- TEST_EQUAL(strlen(chunked_input), 24 + 94) +- TEST_CHECK(received == make_tuple(24, 94, false)); +- TEST_CHECK(parser.finished()); +- +- char mutable_buffer[100]; +- memcpy(mutable_buffer, parser.get_body().begin, parser.get_body().left()); +- int len = parser.collapse_chunk_headers(mutable_buffer, parser.get_body().left()); +- +- TEST_CHECK(std::equal(mutable_buffer, mutable_buffer + len, "test12340123456789abcdef")); +- + // test url parsing + + error_code ec; +@@ -392,6 +372,116 @@ int test_main() + TEST_EQUAL(resolve_redirect_location("http://example.com/a/b", "http://test.com/d") + , "http://test.com/d"); + ++ char const* chunked_input = ++ "HTTP/1.1 200 OK\r\n" ++ "Transfer-Encoding: chunked\r\n" ++ "Content-Type: text/plain\r\n" ++ "\r\n" ++ "4\r\ntest\r\n4\r\n1234\r\n10\r\n0123456789abcdef\r\n" ++ "0\r\n\r\n"; ++ ++{ ++ http_parser parser; ++ boost::tuple<int, int, bool> const received ++ = feed_bytes(parser, chunked_input); ++ ++ TEST_EQUAL(strlen(chunked_input), 24 + 94) ++ TEST_CHECK(received == make_tuple(24, 94, false)); ++ TEST_CHECK(parser.finished()); ++ ++ char mutable_buffer[100]; ++ memcpy(mutable_buffer, parser.get_body().begin, parser.get_body().left()); ++ int len = parser.collapse_chunk_headers(mutable_buffer, parser.get_body().left()); ++ ++ TEST_CHECK(std::equal(mutable_buffer, mutable_buffer + len, "test12340123456789abcdef")); ++} ++ ++{ ++ char const* chunked_input = ++ "HTTP/1.1 200 OK\r\n" ++ "Transfer-Encoding: chunked\r\n" ++ "Content-Length: -45345\r\n" ++ "\r\n"; ++ ++ http_parser parser; ++ boost::tuple<int, int, bool> const received ++ = feed_bytes(parser, chunked_input); ++ ++ TEST_CHECK(boost::get<2>(received) == true); ++} ++ ++{ ++ char const* chunked_input = ++ "HTTP/1.1 200 OK\r\n" ++ "Transfer-Encoding: chunked\r\n" ++ "\r\n" ++ "-53465234545\r\n" ++ "foobar"; ++ ++ http_parser parser; ++ boost::tuple<int, int, bool> const received ++ = feed_bytes(parser, chunked_input); ++ ++ TEST_CHECK(boost::get<2>(received) == true); ++} ++ ++{ ++ char const* chunked_input = ++ "HTTP/1.1 206 OK\n" ++ "Content-Range: bYTes -3-4\n" ++ "\n"; ++ ++ http_parser parser; ++ boost::tuple<int, int, bool> const received ++ = feed_bytes(parser, chunked_input); ++ ++ TEST_CHECK(boost::get<2>(received) == true); ++} ++ ++{ ++ char const* chunked_input = ++ "HTTP/1.1 206 OK\n" ++ "Content-Range: bYTes 3--434\n" ++ "\n"; ++ ++ http_parser parser; ++ boost::tuple<int, int, bool> const received ++ = feed_bytes(parser, chunked_input); ++ ++ TEST_CHECK(boost::get<2>(received) == true); ++} ++ ++{ ++ boost::uint8_t const invalid_chunked_input[] = { ++ 0x48, 0x6f, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, // HoTP/1.1 200 OK ++ 0x20, 0x32, 0x30, 0x30, 0x20, 0x4f, 0x4b, 0x0d, // Cont-Length: 20 ++ 0x0a, 0x43, 0x6f, 0x6e, 0x74, 0x2d, 0x4c, 0x65, // Contente: tn ++ 0x6e, 0x67, 0x74, 0x68, 0x3a, 0x20, 0x32, 0x30, // Transfer-Encoding: chunked ++ 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, // ++ 0x74, 0x65, 0x3a, 0x20, 0x74, 0x6e, 0x0d, 0x0a, // ++ 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, // ++ 0x2d, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, // -89abc9abcdef ++ 0x67, 0x3a, 0x20, 0x63, 0x68, 0x75, 0x6e, 0x6b, // � ++ 0x65, 0x64, 0x0d, 0x0a, 0x0d, 0x0d, 0x0a, 0x0d, // T����������def ++ 0x0a, 0x0a, 0x2d, 0x38, 0x39, 0x61, 0x62, 0x63, // � ++ 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x0d, // T�����������est-headyr: foobar ++ 0x0a, 0xd6, 0x0d, 0x0a, 0x54, 0xbd, 0xbd, 0xbd, ++ 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0x64, ++ 0x65, 0x66, 0x0d, 0x0a, 0xd6, 0x0d, 0x0a, 0x54, ++ 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, ++ 0xbd, 0xbd, 0xbd, 0x65, 0x73, 0x74, 0x2d, 0x68, ++ 0x65, 0x61, 0x64, 0x79, 0x72, 0x3a, 0x20, 0x66, ++ 0x6f, 0x6f, 0x62, 0x61, 0x72, 0x0d, 0x0a, 0x0d, ++ 0x0a, 0x00 ++ }; ++ ++ http_parser parser; ++ boost::tuple<int, int, bool> const received ++ = feed_bytes(parser, reinterpret_cast<char const*>(invalid_chunked_input)); ++ ++ TEST_CHECK(boost::get<2>(received) == true); ++} ++ + return 0; + } + diff --git a/net-libs/rb_libtorrent/files/rb_libtorrent-1.0.9-test_torrent_parse.patch b/net-libs/rb_libtorrent/files/rb_libtorrent-1.0.9-test_torrent_parse.patch new file mode 100644 index 000000000000..658c0aa57156 --- /dev/null +++ b/net-libs/rb_libtorrent/files/rb_libtorrent-1.0.9-test_torrent_parse.patch @@ -0,0 +1,41 @@ +From bdd91e29225b44a1a13e670dc4cecfb58f241d28 Mon Sep 17 00:00:00 2001 +From: Davide Pesavento <pesa@gentoo.org> +Date: Sun, 7 Aug 2016 12:14:57 +0200 +Subject: [PATCH] Disable failing torrent_parse tests + +For unknown reasons, some test torrents are missing from the tarball. +Skip the corresponding test cases to avoid spurious failures. +--- + test/test_torrent_parse.cpp | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/test/test_torrent_parse.cpp b/test/test_torrent_parse.cpp +index 663f341..2de6fb5 100644 +--- a/test/test_torrent_parse.cpp ++++ b/test/test_torrent_parse.cpp +@@ -49,13 +49,10 @@ using namespace libtorrent; + test_torrent_t test_torrents[] = + { + { "base.torrent" }, +- { "empty_path.torrent" }, + { "parent_path.torrent" }, + { "hidden_parent_path.torrent" }, + { "single_multi_file.torrent" }, + { "slash_path.torrent" }, +- { "slash_path2.torrent" }, +- { "slash_path3.torrent" }, + { "backslash_path.torrent" }, + { "url_list.torrent" }, + { "url_list2.torrent" }, +@@ -75,8 +72,6 @@ test_torrent_t test_torrents[] = + { "root_hash.torrent" }, + { "empty_path_multi.torrent" }, + { "duplicate_web_seeds.torrent" }, +- { "invalid_name3.torrent" }, +- { "symlink1.torrent" }, + }; + + struct test_failing_torrent_t +-- +2.9.2 + diff --git a/net-libs/rb_libtorrent/metadata.xml b/net-libs/rb_libtorrent/metadata.xml index 36ca5cca72a4..4133516fb4f6 100644 --- a/net-libs/rb_libtorrent/metadata.xml +++ b/net-libs/rb_libtorrent/metadata.xml @@ -11,7 +11,6 @@ <remote-id type="github">arvidn/libtorrent</remote-id> </upstream> <use> - <flag name="dht">Enable DHT (distributed hash table) support for - libtorrent</flag> + <flag name="dht">Enable DHT (distributed hash table) support</flag> </use> </pkgmetadata> diff --git a/net-libs/rb_libtorrent/rb_libtorrent-1.0.9-r2.ebuild b/net-libs/rb_libtorrent/rb_libtorrent-1.0.9-r2.ebuild new file mode 100644 index 000000000000..0fc1b7bb7049 --- /dev/null +++ b/net-libs/rb_libtorrent/rb_libtorrent-1.0.9-r2.ebuild @@ -0,0 +1,114 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=6 + +PYTHON_COMPAT=( python2_7 python3_{4,5} ) +PYTHON_REQ_USE="threads" +DISTUTILS_OPTIONAL=true +DISTUTILS_IN_SOURCE_BUILD=true + +inherit distutils-r1 eutils versionator + +MY_P=libtorrent-rasterbar-${PV} # TODO: rename, bug 576126 +MY_PV=$(replace_all_version_separators _) + +DESCRIPTION="C++ BitTorrent implementation focusing on efficiency and scalability" +HOMEPAGE="http://libtorrent.org" +SRC_URI="https://github.com/arvidn/libtorrent/releases/download/libtorrent-${MY_PV}/${MY_P}.tar.gz" + +LICENSE="BSD" +SLOT="0/8" +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd" +IUSE="debug +dht doc examples +geoip libressl python +ssl static-libs test" + +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +RDEPEND=" + dev-libs/boost:=[threads] + virtual/libiconv + examples? ( !net-p2p/mldonkey ) + geoip? ( dev-libs/geoip ) + python? ( + ${PYTHON_DEPS} + dev-libs/boost:=[python,${PYTHON_USEDEP}] + ) + ssl? ( + !libressl? ( dev-libs/openssl:0= ) + libressl? ( dev-libs/libressl:= ) + ) +" +DEPEND="${RDEPEND} + sys-devel/libtool +" + +S=${WORKDIR}/${MY_P} + +PATCHES=( + "${FILESDIR}/${PN}-1.0.9-CVE-2016-5301.patch" + "${FILESDIR}/${PN}-1.0.9-test_torrent_parse.patch" +) + +src_prepare() { + default + + # bug 578026 + # prepend -L${S}/... to ensure bindings link against the lib we just built + sed -i -e "s|^|-L${S}/src/.libs |" bindings/python/compile_flags.in || die + + use python && distutils-r1_src_prepare +} + +src_configure() { + local myeconfargs=( + $(use_enable debug) + $(use_enable debug logging) + $(use_enable debug statistics) + $(use_enable debug disk-stats) + $(use_enable dht dht $(usex debug logging yes)) + $(use_enable examples) + $(use_enable geoip) + $(use_with geoip libgeoip) + $(use_enable ssl encryption) + $(use_enable static-libs static) + $(use_enable test tests) + --with-libiconv + ) + econf "${myeconfargs[@]}" + + if use python; then + myeconfargs+=( + --enable-python-binding + --with-boost-python + ) + python_configure() { + econf "${myeconfargs[@]}" + } + distutils-r1_src_configure + fi +} + +src_compile() { + default + + python_compile() { + cd "${BUILD_DIR}/../bindings/python" || die + distutils-r1_python_compile + } + use python && distutils-r1_src_compile +} + +src_install() { + use doc && HTML_DOCS+=( "${S}"/docs ) + + default + + python_install() { + cd "${BUILD_DIR}/../bindings/python" || die + distutils-r1_python_install + } + use python && distutils-r1_src_install + + prune_libtool_files +} |