summaryrefslogtreecommitdiff
path: root/net-p2p/ctorrent
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-p2p/ctorrent
reinit the tree, so we can have metadata
Diffstat (limited to 'net-p2p/ctorrent')
-rw-r--r--net-p2p/ctorrent/Manifest9
-rw-r--r--net-p2p/ctorrent/ctorrent-3.3.2-r2.ebuild27
-rw-r--r--net-p2p/ctorrent/ctorrent-3.3.2-r3.ebuild28
-rw-r--r--net-p2p/ctorrent/files/ctorrent-3.3.2-empty-path-components.patch38
-rw-r--r--net-p2p/ctorrent/files/ctorrent-3.3.2-negative-ints.patch17
-rw-r--r--net-p2p/ctorrent/files/ctorrent-CVE-2009-1759.patch364
-rw-r--r--net-p2p/ctorrent/metadata.xml8
7 files changed, 491 insertions, 0 deletions
diff --git a/net-p2p/ctorrent/Manifest b/net-p2p/ctorrent/Manifest
new file mode 100644
index 000000000000..c3d1000a5fd1
--- /dev/null
+++ b/net-p2p/ctorrent/Manifest
@@ -0,0 +1,9 @@
+AUX ctorrent-3.3.2-empty-path-components.patch 838 SHA256 234634f4a92a0a8519af5b244f10c39902237bb5ff17ec5f0551f9512942f0e7 SHA512 0465d2c12b4bcd39a247a89c3623f425b53ebf879c50f0f042237a576877cebaaa05c32047878832f2acab1e9c6566f4f1341b1bcf5fbe149744c408a402c8f1 WHIRLPOOL c1d67f35bfd1134b8f288b06ef3164271208468e0aae60c72394f468627271194ebc21ae603f6df5528bcf25e3ca8595ba88022adf0f8bfc7cf79d155efa2875
+AUX ctorrent-3.3.2-negative-ints.patch 442 SHA256 b79e6211c085a1ca676c85b30354b1afc0537e67046c953532c0e0953523a17b SHA512 edc950552e3497d91a98ba320d4fbc49284f07f9a130230a765427b91e1dcde099610d5be16c4b9c9969a446d8908c18dd3884eb207901ae46e4b696d1215150 WHIRLPOOL a2e0ea6ef02e38b30793bbe73f62912f7f90d749c169648d7279e5e7dcc7183d79aa6d2a346458fdcd9ffa1edaf8fa3166a321e18b3927d6c1726da46f333a1a
+AUX ctorrent-CVE-2009-1759.patch 10931 SHA256 4d2735ca6bf8704097eae5ee79936d2be6a55074bce86bf74b79dd428a405293 SHA512 ecfe47034e5f54ebc1c7b94b846f7a5f619496928a8dadd7624ae9f51d05ef13b4b6c030373fb5c4817d6e5aee659b072c5b31eb32ff306e4514e4fcb6e5c4ea WHIRLPOOL 8a2e465f962582eb3210d5dfb8e75e115fa5db08567079743fd649ab265c686b6acec97213e8510836d2d3e33a34fb9053db87b36177a1cec09defd126f2ab52
+DIST ctorrent-dnh3.3.2.tar.gz 219053 SHA256 c87366c91475931f75b924119580abd06a7b3cb3f00fef47346552cab1e24863 SHA512 e59b2b899b8603e42a5754d5ce65f661b135b8e107140e0472af379b2b06ee2985239ed0ebf19dcaef788e617b99eac35ad32ad2d10352e2fcf5a6dc084d27dd WHIRLPOOL e89518e8fccd27e91027b954e0a25367536ebab1d91a959d51229a6779cdd0649154536df61316b88c4d9f236af90e0638d81df5c56d8230a4081a35604dc910
+EBUILD ctorrent-3.3.2-r2.ebuild 621 SHA256 79fa50e6b00b75402cfd148c699db15dbc5cf9cfefd0b4eb3ada715da1b885de SHA512 e7bf0ab4e23771852cbba7d7bd17b9c6695fa84a797b5ef200e68f02606bbedbd26277648856b036a2f025ad2122720340aadd81de7a831336910aaec36cac1c WHIRLPOOL 86106d98b5e7381790b1afe0bbe3ab576e5aa683aee0019bf3fdd0f3c55de7aa4bb7157c3dd528c5715cf73032322e2b02440710bc46606f71d6257f193271fe
+EBUILD ctorrent-3.3.2-r3.ebuild 680 SHA256 4a022f7b2055a29b08855b9f4f4b812e5f278bd1efe1ee20574ec72c6db334ed SHA512 6c8022bfd0f631159d44af684fb5c2a57dbb21f9694787dc720374d17f0b7d7474517ac54d06c164fdc1422570036cf67ef07c4483b81789af335fe3bb582be5 WHIRLPOOL c7804df15eecd5451a854e3b88749724619a779862688c21af0d4f392e887aa221dc98bcb895219967e4db75578e87edcc38662eadb991e2fad7ff22772fd28d
+MISC ChangeLog 2963 SHA256 40044a46b2b78674105b875a0f30063c49fba2cf8749cb1db1a33843513135fe SHA512 d40c2106d707e8d4996ce8257e568bdb0a3842b245cecafa62bfb17a01bc5636c8636b41260dad84cb8dfe156eed1227dee1e0836d24c39a5e6e62f7ce844671 WHIRLPOOL 58b7a6f45edd4fb100b26e91a23d177f2f3f2e4e8e44452c51d2f1a306c89c391e565ec7e8a6df951dfbbd6dbe94e4da31095a9e60a4bc64c2f482b69138b1b9
+MISC ChangeLog-2015 7594 SHA256 9a4f4b1725b0bd44a197d6d04ee6f0c1de2043899cb22dfa9a5d105141739f92 SHA512 f1788f41bc58aea7749b07af5b5b87e48d00b0098557b8376f3ed611a7ec3ab5f217c97cf7a6592ed333fe417c41e2c9e1f99ca62ecbe143bbc905a77e45be51 WHIRLPOOL 3a57a3c638c3ac1addbaf330532b34c04cc7a4d1ac8c937c2918c6845c6a89616af65ce1282f5a75c5d9f12248ed0d7095793879fb8600e429f8f49a6a1ea7ec
+MISC metadata.xml 245 SHA256 d230c330a2d4bdab56cbd46c4c4427589c556738054c8be4750208bf44140d46 SHA512 2614273ab49d7d71d4a7c39fde414a2337c4f62fa92f9b803d900dcae5c79299c894a1161ff14269d20f436376c5388b3e3f0cd3ad9d2b6ae766366c7029d6bb WHIRLPOOL 85c99ae1cb2884bb2f8e0003ebfc5279c834f1ef98143d5546bde523e66e0e474f1e49157d9e943eb4904836e45f16602c0e4a24bd9aae71aab5bff7615a934f
diff --git a/net-p2p/ctorrent/ctorrent-3.3.2-r2.ebuild b/net-p2p/ctorrent/ctorrent-3.3.2-r2.ebuild
new file mode 100644
index 000000000000..a93b57767ba5
--- /dev/null
+++ b/net-p2p/ctorrent/ctorrent-3.3.2-r2.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit eutils
+
+MY_P="${PN}-dnh${PV}"
+
+DESCRIPTION="Enhanced CTorrent is a BitTorrent console client written in C and C++"
+HOMEPAGE="http://www.rahul.net/dholmes/ctorrent/"
+SRC_URI="mirror://sourceforge/dtorrent/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm ppc ~s390 ~sh ~sparc x86 ~x86-fbsd"
+IUSE=""
+
+S=${WORKDIR}/${MY_P}
+
+DEPEND="dev-libs/openssl:="
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-CVE-2009-1759.patch
+ epatch "${FILESDIR}"/${P}-negative-ints.patch
+}
diff --git a/net-p2p/ctorrent/ctorrent-3.3.2-r3.ebuild b/net-p2p/ctorrent/ctorrent-3.3.2-r3.ebuild
new file mode 100644
index 000000000000..ba96a9a0cf3b
--- /dev/null
+++ b/net-p2p/ctorrent/ctorrent-3.3.2-r3.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit eutils
+
+MY_P="${PN}-dnh${PV}"
+
+DESCRIPTION="Enhanced CTorrent is a BitTorrent console client written in C and C++"
+HOMEPAGE="http://www.rahul.net/dholmes/ctorrent/"
+SRC_URI="mirror://sourceforge/dtorrent/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE=""
+
+S=${WORKDIR}/${MY_P}
+
+DEPEND="dev-libs/openssl:="
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-CVE-2009-1759.patch
+ epatch "${FILESDIR}"/${P}-negative-ints.patch
+ epatch "${FILESDIR}"/${P}-empty-path-components.patch
+}
diff --git a/net-p2p/ctorrent/files/ctorrent-3.3.2-empty-path-components.patch b/net-p2p/ctorrent/files/ctorrent-3.3.2-empty-path-components.patch
new file mode 100644
index 000000000000..fce41d4feff5
--- /dev/null
+++ b/net-p2p/ctorrent/files/ctorrent-3.3.2-empty-path-components.patch
@@ -0,0 +1,38 @@
+rTorrent sometimes creates invalid torrents which has empty path components.
+the bitorrent spec allows for "" strings, but they make no sense in paths.
+so instead of always adding a / in between, skip them. ugh.
+
+for example:
+dict {
+ 'info' => dict {
+ 'name' => str = "some dir" (len = 8)
+ 'files' => list [
+ dict {
+ 'length' => int = 12345567
+ 'path' => list [
+ str = "" (len = 0)
+ str = "foo.bin" (len = 7)
+ ]
+ }
+ ...
+ ]
+ ...
+ }
+ ...
+}
+
+ctorrent will then try to fetch the file "/some dir/foo.bin" instead of
+"some dir/foo.bin" (relative to $PWD).
+
+--- a/bencode.cpp
++++ b/bencode.cpp
+@@ -258,7 +258,8 @@
+ n -= r;
+ if( 'e' == *pb ) break;
+ if( pathname >= endmax ) return 0;
+- *pathname++ = PATH_SP;
++ if (q)
++ *pathname++ = PATH_SP;
+ }
+ *pathname = '\0';
+ return (pb - b + 1);
diff --git a/net-p2p/ctorrent/files/ctorrent-3.3.2-negative-ints.patch b/net-p2p/ctorrent/files/ctorrent-3.3.2-negative-ints.patch
new file mode 100644
index 000000000000..c3f98c713d01
--- /dev/null
+++ b/net-p2p/ctorrent/files/ctorrent-3.3.2-negative-ints.patch
@@ -0,0 +1,17 @@
+allow negative integers ... should fix random "error, initial meta info failed"
+
+https://sourceforge.net/tracker/?func=detail&aid=3159066&group_id=202532&atid=981959
+
+--- ctorrent-dnh3.3.2/bencode.cpp
++++ ctorrent-dnh3.3.2/bencode.cpp
+@@ -44,6 +44,10 @@
+ p++; len--;
+ }
+
++ if( *p == '-'){
++ p++; len--;
++ }
++
+ for(psave = p; len && isdigit(*p); p++,len--) ;
+
+ if(!len || MAX_INT_SIZ < (p - psave) || *p != endchar) return 0;
diff --git a/net-p2p/ctorrent/files/ctorrent-CVE-2009-1759.patch b/net-p2p/ctorrent/files/ctorrent-CVE-2009-1759.patch
new file mode 100644
index 000000000000..196703099f60
--- /dev/null
+++ b/net-p2p/ctorrent/files/ctorrent-CVE-2009-1759.patch
@@ -0,0 +1,364 @@
+Patch for CVE-2009-1759.
+Source: Upstream SVN, rev 302 from the drorrent-3 branch.
+
+Index: bencode.h
+===================================================================
+--- bencode.h (revision 300)
++++ bencode.h (revision 302)
+@@ -25,7 +25,7 @@
+ size_t decode_list(const char *b,size_t len,const char *keylist);
+ size_t decode_rev(const char *b,size_t len,const char *keylist);
+ size_t decode_query(const char *b,size_t len,const char *keylist,const char **ps,size_t *pi,int64_t *pl,int method);
+-size_t decode_list2path(const char *b, size_t n, char *pathname);
++size_t decode_list2path(const char *b, size_t n, char *pathname, size_t maxlen);
+ size_t bencode_buf(const char *str,size_t len,FILE *fp);
+ size_t bencode_str(const char *str, FILE *fp);
+ size_t bencode_int(const uint64_t integer, FILE *fp);
+Index: bencode.cpp
+===================================================================
+--- bencode.cpp (revision 300)
++++ bencode.cpp (revision 302)
+@@ -233,22 +233,28 @@
+ return bencode_end_dict_list(fp);
+ }
+
+-size_t decode_list2path(const char *b, size_t n, char *pathname)
++size_t decode_list2path(const char *b, size_t n, char *pathname, size_t maxlen)
+ {
+ const char *pb = b;
+ const char *s = (char *) 0;
++ const char *endmax = pathname + maxlen - 1;
+ size_t r,q;
+
+ if( 'l' != *pb ) return 0;
+ pb++;
+ n--;
+ if( !n ) return 0;
+- for(; n;){
++ while( n && pathname < endmax ){
+ if(!(r = buf_str(pb, n, &s, &q)) ) return 0;
++ if( q >= maxlen ) return 0;
+ memcpy(pathname, s, q);
+ pathname += q;
+- pb += r; n -= r;
+- if( 'e' != *pb ){*pathname = PATH_SP, pathname++;} else break;
++ maxlen -= q;
++ pb += r;
++ n -= r;
++ if( 'e' == *pb ) break;
++ if( pathname >= endmax ) return 0;
++ *pathname++ = PATH_SP;
+ }
+ *pathname = '\0';
+ return (pb - b + 1);
+Index: btfiles.cpp
+===================================================================
+--- btfiles.cpp (revision 300)
++++ btfiles.cpp (revision 302)
+@@ -449,7 +449,8 @@
+ return 0;
+ }
+
+-int btFiles::BuildFromMI(const char *metabuf, const size_t metabuf_len, const char *saveas)
++int btFiles::BuildFromMI(const char *metabuf, const size_t metabuf_len,
++ const char *saveas, unsigned char exam_only)
+ {
+ char path[MAXPATHLEN];
+ const char *s, *p;
+@@ -458,11 +459,19 @@
+ int f_warned = 0;
+
+ if( !decode_query(metabuf, metabuf_len, "info|name", &s, &q, (int64_t*)0,
+- QUERY_STR) || MAXPATHLEN <= q )
++ QUERY_STR) || MAXPATHLEN <= q ){
++ errno = EINVAL;
+ return -1;
++ }
+
+ memcpy(path, s, q);
+ path[q] = '\0';
++ if( !exam_only &&
++ (PATH_SP == path[0] || '/' == path[0] || 0==strncmp("..", path, 2)) ){
++ CONSOLE.Warning(1, "error, unsafe path \"%s\" in torrent data", path);
++ errno = EINVAL;
++ return -1;
++ }
+
+ r = decode_query(metabuf, metabuf_len, "info|files", (const char**)0, &q,
+ (int64_t*)0, QUERY_POS);
+@@ -471,21 +480,31 @@
+ BTFILE *pbf_last = (BTFILE*) 0;
+ BTFILE *pbf = (BTFILE*) 0;
+ size_t dl;
++ unsigned long nfiles = 0;
++
+ if( decode_query(metabuf,metabuf_len,"info|length",
+- (const char**) 0,(size_t*) 0,(int64_t*) 0,QUERY_LONG) )
++ (const char**) 0,(size_t*) 0,(int64_t*) 0,QUERY_LONG) ){
++ errno = EINVAL;
+ return -1;
++ }
+
+ if( saveas ){
+ m_directory = new char[strlen(saveas) + 1];
+ #ifndef WINDOWS
+- if(!m_directory) return -1;
++ if( !m_directory ){
++ errno = ENOMEM;
++ return -1;
++ }
+ #endif
+ strcpy(m_directory,saveas);
+ }else{
+ int f_conv;
+ char *tmpfn = new char[strlen(path)*2+5];
+ #ifndef WINDOWS
+- if( !tmpfn ) return -1;
++ if( !tmpfn ){
++ errno = ENOMEM;
++ return -1;
++ }
+ #endif
+ if( f_conv = ConvertFilename(tmpfn, path, strlen(path)*2+5) ){
+ if( arg_flg_convert_filenames ){
+@@ -493,6 +512,7 @@
+ #ifndef WINDOWS
+ if( !m_directory ){
+ delete []tmpfn;
++ errno = ENOMEM;
+ return -1;
+ }
+ #endif
+@@ -507,7 +527,10 @@
+ if( !f_conv || !arg_flg_convert_filenames ){
+ m_directory = new char[strlen(path) + 1];
+ #ifndef WINDOWS
+- if( !m_directory ) return -1;
++ if( !m_directory ){
++ errno = ENOMEM;
++ return -1;
++ }
+ #endif
+ strcpy(m_directory,path);
+ }
+@@ -517,24 +540,50 @@
+ p = metabuf + r + 1;
+ q--;
+ for(; q && 'e' != *p; p += dl, q -= dl){
+- if(!(dl = decode_dict(p, q, (const char*) 0)) ) return -1;
+- if( !decode_query(p, dl, "length", (const char**) 0,
+- (size_t*) 0,&t,QUERY_LONG) ) return -1;
++ if( !(dl = decode_dict(p, q, (const char*) 0)) ||
++ !decode_query(p, dl, "length", (const char**) 0, (size_t*) 0, &t,
++ QUERY_LONG) ){
++ errno = EINVAL;
++ return -1;
++ }
+ pbf = _new_bfnode();
+ #ifndef WINDOWS
+- if( !pbf ) return -1;
++ if( !pbf ){
++ errno = ENOMEM;
++ return -1;
++ }
+ #endif
++ nfiles++;
+ pbf->bf_length = t;
+ m_total_files_length += t;
+ r = decode_query(p, dl, "path", (const char **)0, &n, (int64_t*)0,
+ QUERY_POS);
+- if( !r ) return -1;
+- if(!decode_list2path(p + r, n, path)) return -1;
++ if( !r || !decode_list2path(p + r, n, path, sizeof(path)) ){
++ CONSOLE.Warning(1,
++ "error, invalid path in torrent data for file %lu at offset %llu",
++ nfiles, m_total_files_length - t);
++ delete pbf;
++ errno = EINVAL;
++ return -1;
++ }
++ if( !exam_only &&
++ (PATH_SP == path[0] || '/' == path[0] || 0==strncmp("..", path, 2)) ){
++ CONSOLE.Warning(1,
++ "error, unsafe path \"%s\" in torrent data for file %lu",
++ path, nfiles);
++ delete pbf;
++ errno = EINVAL;
++ return -1;
++ }
+
++
+ int f_conv;
+ char *tmpfn = new char[strlen(path)*2+5];
+ #ifndef WINDOWS
+- if( !tmpfn ) return -1;
++ if( !tmpfn ){
++ errno = ENOMEM;
++ return -1;
++ }
+ #endif
+ if( f_conv = ConvertFilename(tmpfn, path, strlen(path)*2+5) ){
+ if( arg_flg_convert_filenames ){
+@@ -542,6 +591,7 @@
+ #ifndef WINDOWS
+ if( !pbf->bf_filename ){
+ delete []tmpfn;
++ errno = ENOMEM;
+ return -1;
+ }
+ #endif
+@@ -556,7 +606,10 @@
+ if( !f_conv || !arg_flg_convert_filenames ){
+ pbf->bf_filename = new char[strlen(path) + 1];
+ #ifndef WINDOWS
+- if( !pbf->bf_filename ) return -1;
++ if( !pbf->bf_filename ){
++ errno = ENOMEM;
++ return -1;
++ }
+ #endif
+ strcpy(pbf->bf_filename, path);
+ }
+@@ -564,30 +617,42 @@
+ pbf_last = pbf;
+ }
+ }else{
+- if( !decode_query(metabuf,metabuf_len,"info|length",
+- (const char**) 0,(size_t*) 0,&t,QUERY_LONG) )
++ if( !decode_query(metabuf,metabuf_len, "info|length",
++ (const char**)0, (size_t*) 0, &t, QUERY_LONG) ){
++ errno = EINVAL;
+ return -1;
++ }
+ m_btfhead = _new_bfnode();
+ #ifndef WINDOWS
+- if( !m_btfhead) return -1;
++ if( !m_btfhead ){
++ errno = ENOMEM;
++ return -1;
++ }
+ #endif
+ m_btfhead->bf_length = m_total_files_length = t;
+ if( saveas ){
+ m_btfhead->bf_filename = new char[strlen(saveas) + 1];
+ #ifndef WINDOWS
+- if(!m_btfhead->bf_filename ) return -1;
++ if( !m_btfhead->bf_filename ){
++ errno = ENOMEM;
++ return -1;
++ }
+ #endif
+ strcpy(m_btfhead->bf_filename, saveas);
+ }else if( arg_flg_convert_filenames ){
+ char *tmpfn = new char[strlen(path)*2+5];
+ #ifndef WINDOWS
+- if( !tmpfn ) return -1;
++ if( !tmpfn ){
++ errno = ENOMEM;
++ return -1;
++ }
+ #endif
+ ConvertFilename(tmpfn, path, strlen(path)*2+5);
+ m_btfhead->bf_filename = new char[strlen(tmpfn) + 1];
+ #ifndef WINDOWS
+ if( !m_btfhead->bf_filename ){
+ delete []tmpfn;
++ errno = ENOMEM;
+ return -1;
+ }
+ #endif
+@@ -596,7 +661,10 @@
+ }else{
+ m_btfhead->bf_filename = new char[strlen(path) + 1];
+ #ifndef WINDOWS
+- if(!m_btfhead->bf_filename ) return -1;
++ if( !m_btfhead->bf_filename ){
++ errno = ENOMEM;
++ return -1;
++ }
+ #endif
+ strcpy(m_btfhead->bf_filename, path);
+ }
+@@ -694,6 +762,32 @@
+ size_t btFiles::FillMetaInfo(FILE* fp)
+ {
+ BTFILE *p;
++ const char *refname, *s;
++ char path[MAXPATHLEN];
++
++ refname = m_directory ? m_directory : m_btfhead->bf_filename;
++ while( (s = strchr(refname, PATH_SP)) && *(s + 1) ){
++ refname = s + 1;
++ }
++ if( m_directory && '.' == *refname ){
++ char dir[MAXPATHLEN];
++ if( getcwd(dir, sizeof(dir)) && 0==chdir(m_directory) ){
++ if( getcwd(path, sizeof(path)) ){
++ refname = path;
++ while( (s = strchr(refname, PATH_SP)) && *(s + 1) ){
++ refname = s + 1;
++ }
++ }
++ chdir(dir);
++ }
++ }
++ if( '/' == *refname || '\0' == *refname || '.' == *refname ){
++ CONSOLE.Warning(1, "error, inappropriate file or directory name \"%s\"",
++ m_directory ? m_directory : m_btfhead->bf_filename);
++ errno = EINVAL;
++ return 0;
++ }
++
+ if( m_directory ){
+ // multi files
+ if( bencode_str("files", fp) != 1 ) return 0;
+@@ -715,16 +809,15 @@
+ if(bencode_end_dict_list(fp) != 1 ) return 0;
+
+ if(bencode_str("name", fp) != 1) return 0;
+- return bencode_str(m_directory, fp);
+-
++ return bencode_str(refname, fp);
+ }else{
+ if( bencode_str("length", fp) != 1 ) return 0;
+ if( bencode_int(m_btfhead->bf_length, fp) != 1) return 0;
+
+ if( bencode_str("name", fp) != 1 ) return 0;
+- return bencode_str(m_btfhead->bf_filename, fp);
++ return bencode_str(refname, fp);
+ }
+- return 1;
++ return 0;
+ }
+
+
+Index: btcontent.cpp
+===================================================================
+--- btcontent.cpp (revision 300)
++++ btcontent.cpp (revision 302)
+@@ -357,7 +357,11 @@
+
+ cfg_req_queue_length = (m_piece_length / cfg_req_slice_size) * 2 - 1;
+
+- if( m_btfiles.BuildFromMI(b, flen, saveas) < 0 ) ERR_RETURN();
++ if( m_btfiles.BuildFromMI(b, flen, saveas, arg_flg_exam_only) < 0 ){
++ if( EINVAL == errno )
++ CONSOLE.Warning(1, "Torrent metainfo file data is invalid or unusable.");
++ ERR_RETURN();
++ }
+
+ delete []b;
+ b = (char *)0;
+Index: btfiles.h
+===================================================================
+--- btfiles.h (revision 300)
++++ btfiles.h (revision 302)
+@@ -61,7 +61,7 @@
+
+ int BuildFromFS(const char *pathname);
+ int BuildFromMI(const char *metabuf, const size_t metabuf_len,
+- const char *saveas);
++ const char *saveas, unsigned char exam_only);
+
+ char *GetDataName() const;
+ uint64_t GetTotalLength() const { return m_total_files_length; }
diff --git a/net-p2p/ctorrent/metadata.xml b/net-p2p/ctorrent/metadata.xml
new file mode 100644
index 000000000000..b5ed8a246999
--- /dev/null
+++ b/net-p2p/ctorrent/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <!-- maintainer-needed -->
+ <upstream>
+ <remote-id type="sourceforge">dtorrent</remote-id>
+ </upstream>
+</pkgmetadata>