aboutsummaryrefslogtreecommitdiff
path: root/net-p2p
diff options
context:
space:
mode:
authorDirk Meyer <dinoex@FreeBSD.org>2020-06-25 11:33:34 +0000
committerDirk Meyer <dinoex@FreeBSD.org>2020-06-25 11:33:34 +0000
commit0856284444ef61a8c2e0fdc5afe56643312bc8ec (patch)
tree5319df3817a899efe397861d8e3542768bf869f7 /net-p2p
parent8ea6dfc0c321dd8a2d2abd462c229d6af3f3997c (diff)
downloadports-0856284444ef61a8c2e0fdc5afe56643312bc8ec.tar.gz
ports-0856284444ef61a8c2e0fdc5afe56643312bc8ec.zip
- fix empty announce list
- fix empty path PR: 247376 Submitted by: Alexey Dokuchaev Obtained from: Gentoo - fix mutiple peers behind same IP Obtained from: Timothy Palpant
Notes
Notes: svn path=/head/; revision=540385
Diffstat (limited to 'net-p2p')
-rw-r--r--net-p2p/ctorrent/Makefile2
-rw-r--r--net-p2p/ctorrent/files/patch-btcontent.cpp25
-rw-r--r--net-p2p/ctorrent/files/patch-empty-path12
-rw-r--r--net-p2p/ctorrent/files/patch-peer.cpp12
4 files changed, 50 insertions, 1 deletions
diff --git a/net-p2p/ctorrent/Makefile b/net-p2p/ctorrent/Makefile
index 107d038f0c29..e7ccc7cf2798 100644
--- a/net-p2p/ctorrent/Makefile
+++ b/net-p2p/ctorrent/Makefile
@@ -3,7 +3,7 @@
PORTNAME= ctorrent
PORTVERSION= 3.3.2
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= net-p2p
MASTER_SITES= SF/dtorrent/dtorrent/${PORTVERSION} \
http://www.rahul.net/dholmes/ctorrent/
diff --git a/net-p2p/ctorrent/files/patch-btcontent.cpp b/net-p2p/ctorrent/files/patch-btcontent.cpp
new file mode 100644
index 000000000000..e3b5f067a359
--- /dev/null
+++ b/net-p2p/ctorrent/files/patch-btcontent.cpp
@@ -0,0 +1,25 @@
+--- btcontent.cpp.orig 2008-06-15 00:00:19 UTC
++++ btcontent.cpp
+@@ -283,11 +283,12 @@ int btContent::InitialFromMI(const char *metainfo_fnam
+ if ( !b ) return -1;
+
+ // announce
+- if( !meta_str("announce",&s,&r) ) ERR_RETURN();
++ if( meta_str("announce",&s,&r) ) {
+ if( r > MAXPATHLEN ) ERR_RETURN();
+ m_announce = new char [r + 1];
+ memcpy(m_announce, s, r);
+ m_announce[r] = '\0';
++ }
+
+ // announce-list
+ if( r = meta_pos("announce-list") ){
+@@ -303,7 +304,7 @@ int btContent::InitialFromMI(const char *metainfo_fnam
+ if( !(q = buf_str(b+r, alend-r, &sptr, &slen)) )
+ break; // next list
+ r += q;
+- if( strncasecmp(m_announce, sptr, slen) ){
++ if( !m_announce || strncasecmp(m_announce, sptr, slen) ){
+ m_announcelist[n] = new char[slen+1];
+ memcpy(m_announcelist[n], sptr, slen);
+ (m_announcelist[n])[slen] = '\0';
diff --git a/net-p2p/ctorrent/files/patch-empty-path b/net-p2p/ctorrent/files/patch-empty-path
new file mode 100644
index 000000000000..102d5d6f9ab0
--- /dev/null
+++ b/net-p2p/ctorrent/files/patch-empty-path
@@ -0,0 +1,12 @@
+--- bencode.cpp.orig
++++ 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/patch-peer.cpp b/net-p2p/ctorrent/files/patch-peer.cpp
new file mode 100644
index 000000000000..a5d079fc28b5
--- /dev/null
+++ b/net-p2p/ctorrent/files/patch-peer.cpp
@@ -0,0 +1,12 @@
+--- peer.cpp.orig 2008-06-15 00:00:19 UTC
++++ peer.cpp
+@@ -66,7 +66,8 @@ int btBasic::IpEquiv(struct sockaddr_in addr)
+ // CONSOLE.Debug_n("IpEquiv: %s <=> ", inet_ntoa(m_sin.sin_addr));
+ // CONSOLE.Debug_n("%s", inet_ntoa(addr.sin_addr));
+ // CONSOLE.Debug_n("");
+- return (memcmp(&m_sin.sin_addr,&addr.sin_addr,sizeof(struct in_addr)) == 0) ?
++ return ((memcmp(&m_sin.sin_addr,&addr.sin_addr,sizeof(struct in_addr)) == 0)
++ && m_sin.sin_port == addr.sin_port) ?
+ 1 : 0;
+ }
+