diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-10-14 05:44:14 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-10-14 05:44:14 +0000 |
commit | 664a3633c58cc4b92db5e016193cbe7c75a74b7e (patch) | |
tree | 60c44576fda5bf271f1766398c26338719ae6b34 /net-ftp | |
parent | add docs (diff) | |
download | historical-664a3633c58cc4b92db5e016193cbe7c75a74b7e.tar.gz historical-664a3633c58cc4b92db5e016193cbe7c75a74b7e.tar.bz2 historical-664a3633c58cc4b92db5e016193cbe7c75a74b7e.zip |
Grab segv patch from Fedora, make sure we fixup the ssl port code since ipv6 changes it, and fix a segfault when using strcpy() on the same areas of memory #104311.
Package-Manager: portage-2.0.53_rc5
Diffstat (limited to 'net-ftp')
-rw-r--r-- | net-ftp/ftp/ChangeLog | 12 | ||||
-rw-r--r-- | net-ftp/ftp/Manifest | 10 | ||||
-rw-r--r-- | net-ftp/ftp/files/digest-ftp-0.17-r6 | 1 | ||||
-rw-r--r-- | net-ftp/ftp/files/netkit-ftp-0.17-dont-strcpy-overlapping.patch | 53 | ||||
-rw-r--r-- | net-ftp/ftp/files/netkit-ftp-0.17-ipv6.patch | 20 | ||||
-rw-r--r-- | net-ftp/ftp/files/netkit-ftp-0.17-segv.patch | 90 | ||||
-rw-r--r-- | net-ftp/ftp/ftp-0.17-r6.ebuild | 52 |
7 files changed, 237 insertions, 1 deletions
diff --git a/net-ftp/ftp/ChangeLog b/net-ftp/ftp/ChangeLog index c6ed42ced23a..67ba5921a4f1 100644 --- a/net-ftp/ftp/ChangeLog +++ b/net-ftp/ftp/ChangeLog @@ -1,6 +1,16 @@ # ChangeLog for net-ftp/ftp # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-ftp/ftp/ChangeLog,v 1.20 2005/08/03 23:30:21 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-ftp/ftp/ChangeLog,v 1.21 2005/10/14 05:44:14 vapier Exp $ + +*ftp-0.17-r6 (14 Oct 2005) + + 14 Oct 2005; Mike Frysinger <vapier@gentoo.org> + +files/netkit-ftp-0.17-dont-strcpy-overlapping.patch, + files/netkit-ftp-0.17-ipv6.patch, +files/netkit-ftp-0.17-segv.patch, + +ftp-0.17-r6.ebuild: + Grab segv patch from Fedora, make sure we fixup the ssl port code since ipv6 + changes it, and fix a segfault when using strcpy() on the same areas of + memory #104311. 03 Aug 2005; Mike Frysinger <vapier@gentoo.org> ftp-0.17-r5.ebuild: Make sure we build with LFS #101038 by Maik Musall. diff --git a/net-ftp/ftp/Manifest b/net-ftp/ftp/Manifest index 383b8a4161a1..f1d7a23df368 100644 --- a/net-ftp/ftp/Manifest +++ b/net-ftp/ftp/Manifest @@ -1,3 +1,6 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + MD5 bfa2f8566ce2a75364c9aea8087b0270 ChangeLog 3642 MD5 036b2200a177f3266c5cbb3f4d5e4ed5 files/digest-ftp-0.17-r3 66 MD5 036b2200a177f3266c5cbb3f4d5e4ed5 files/digest-ftp-0.17-r5 66 @@ -17,3 +20,10 @@ MD5 80ca646c7ebf7d86e937294242836ea6 ftp-0.17-r3.ebuild 1034 MD5 45fd632e8f4c81f73a7ab97dac005132 ftp-0.17-r5.ebuild 1413 MD5 5de7cf5340f5972785e20645fe56ab32 ftp-0.17-r6.ebuild 1556 MD5 9a09f8d531c582e78977dbfd96edc1f2 metadata.xml 164 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.2 (GNU/Linux) + +iD8DBQFDT0YxgIKl8Uu19MoRArd2AJ4g9rbZ4mz0zzoec3G4EAoI3qMljgCeLKBu +I0tUl8k+OngUrLh320oYE5o= +=KB4s +-----END PGP SIGNATURE----- diff --git a/net-ftp/ftp/files/digest-ftp-0.17-r6 b/net-ftp/ftp/files/digest-ftp-0.17-r6 new file mode 100644 index 000000000000..d98bdd29a960 --- /dev/null +++ b/net-ftp/ftp/files/digest-ftp-0.17-r6 @@ -0,0 +1 @@ +MD5 94441610c9b86ef45c4c6ec609444060 netkit-ftp-0.17.tar.gz 53934 diff --git a/net-ftp/ftp/files/netkit-ftp-0.17-dont-strcpy-overlapping.patch b/net-ftp/ftp/files/netkit-ftp-0.17-dont-strcpy-overlapping.patch new file mode 100644 index 000000000000..dc08c8710a5e --- /dev/null +++ b/net-ftp/ftp/files/netkit-ftp-0.17-dont-strcpy-overlapping.patch @@ -0,0 +1,53 @@ +http://bugs.gentoo.org/104311 + +From the strncpy(3) manpage: +The strings may not overlap, and the destination string dest must be large +enough to receive the copy. + +ftp.c:1812:Bounds error: in strncpy with 0x4 for 63 and 0x4 for 1, source and destination objects overlap. +ftp.c:1812: Pointer value: 0x4 +ftp.c:1812: Object `*proxstruct.3': +ftp.c:1812: Address in memory: 0x0 .. 0x7 +ftp.c:1812: Size: 8408 bytes +ftp.c:1812: Element size: 1 bytes +ftp.c:1812: Number of elements: 8408 +ftp.c:1812: Storage class: static +Aborted + +The bug is hit when ftp.c's pswitch() is called multiple times: + +static struct comvars { char name[]; } proxstruct, tmpstruct; +struct comvars *ip, *op; +... +if (flag) { + ip = &tmpstruct; + op = &proxstruct; +} else { + ip = &proxstruct; + op = &tmpstruct; +} +... +if (hostname) + strncpy(ip->name, hostname, sizeof(ip->name) - 1); +... +hostname = op->name; + +so if the code path is: + hostname = NULL + pswitch(0) + hostname = op->name (tmpstruct.name) + pswitch(1) + strncpy(ip->name (tmpstruct.name), hostname, ...) +bad things happen + +--- ftp/ftp.c ++++ ftp/ftp.c +@@ -1808,7 +1808,7 @@ + } + ip->connect = connected; + connected = op->connect; +- if (hostname) { ++ if (hostname && ip->name != hostname) { + (void) strncpy(ip->name, hostname, sizeof(ip->name) - 1); + ip->name[sizeof(ip->name) - 1] = '\0'; + } diff --git a/net-ftp/ftp/files/netkit-ftp-0.17-ipv6.patch b/net-ftp/ftp/files/netkit-ftp-0.17-ipv6.patch index defc6d1db049..8d6279d1fbbe 100644 --- a/net-ftp/ftp/files/netkit-ftp-0.17-ipv6.patch +++ b/net-ftp/ftp/files/netkit-ftp-0.17-ipv6.patch @@ -105,6 +105,26 @@ http://bugs.gentoo.org/show_bug.cgi?id=47507 if (argc > 2) { #ifdef USE_SSL /* not really an SSL enhancement but something that +@@ -222,7 +222,7 @@ + * the default (unofficial) port number + */ + if ((strcmp(argv[2],"ssl-ftp")==0) && (destsp==NULL)) +- port = 150; ++ port = "150"; + else { + if (destsp == NULL ) { + printf("%s: bad port name-- %s\n",argv[1],argv[2]); +@@ -230,7 +230,9 @@ + code = -1; + return; + } else { +- port = ntohs(destsp->s_port); ++ static char portbuf[10]; ++ snprintf(portbuf, sizeof(portbuf), "%i", ntohs(destsp->s_port)); ++ port = portbuf; + } + } + } else @@ -233,20 +235,15 @@ } } else diff --git a/net-ftp/ftp/files/netkit-ftp-0.17-segv.patch b/net-ftp/ftp/files/netkit-ftp-0.17-segv.patch new file mode 100644 index 000000000000..53f01379bde1 --- /dev/null +++ b/net-ftp/ftp/files/netkit-ftp-0.17-segv.patch @@ -0,0 +1,90 @@ +Ripped from Fedora + +* Mon Jun 14 2004 Alan Cox <alan@redhat.com> +- Re-arranged some totally bogus old bezerkly code that could + segfault ftp on connection loss. (BZ #122295) + +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=122295 + +--- netkit-ftp-0.17/ftp/ftp.c.segv 2004-06-14 11:04:38.000000000 -0400 ++++ netkit-ftp-0.17/ftp/ftp.c 2004-06-14 11:06:46.000000000 -0400 +@@ -472,6 +472,8 @@ + return (0); + } + lostpeer(0); ++ fclose(cout); ++ cout = NULL; + if (verbose) { + printf("421 Service not available, remote server has closed connection\n"); + (void) fflush(stdout); +@@ -529,7 +531,14 @@ + cpend = 0; + (void) signal(SIGINT,oldintr); + if (code == 421 || originalcode == 421) ++ { + lostpeer(0); ++ if(cout) ++ { ++ fclose(cout); ++ cout = NULL; ++ } ++ } + if (abrtflag && oldintr != cmdabort && oldintr != SIG_IGN) + (*oldintr)(SIGINT); + return (n - '0'); +@@ -1790,6 +1799,11 @@ + if (ptabflg) + code = -1; + lostpeer(0); ++ if(cout != NULL) ++ { ++ fclose(cout); ++ cout = NULL; ++ } + } + (void) getreply(0); + (void) getreply(0); +@@ -1815,6 +1829,11 @@ + perror("reset"); + code = -1; + lostpeer(0); ++ if(cout != NULL) ++ { ++ fclose(cout); ++ cout = NULL; ++ } + } + else if (nfnd) { + (void) getreply(0); +@@ -1897,6 +1916,11 @@ + if (ptabflg) + code = -1; + lostpeer(0); ++ if(cout != NULL) ++ { ++ fclose(cout); ++ cout = NULL; ++ } + } + if (din && FD_ISSET(fileno(din), &mask)) { + while (read(fileno(din), buf, BUFSIZ) > 0) +--- netkit-ftp-0.17/ftp/main.c.segv 2004-06-14 11:03:18.000000000 -0400 ++++ netkit-ftp-0.17/ftp/main.c 2004-06-14 11:03:42.000000000 -0400 +@@ -235,8 +235,6 @@ + if (connected) { + if (cout != NULL) { + shutdown(fileno(cout), 1+1); +- fclose(cout); +- cout = NULL; + } + if (data >= 0) { + shutdown(data, 1+1); +@@ -249,8 +247,6 @@ + if (connected) { + if (cout != NULL) { + shutdown(fileno(cout), 1+1); +- fclose(cout); +- cout = NULL; + } + connected = 0; + } diff --git a/net-ftp/ftp/ftp-0.17-r6.ebuild b/net-ftp/ftp/ftp-0.17-r6.ebuild new file mode 100644 index 000000000000..dda4bbbbf80a --- /dev/null +++ b/net-ftp/ftp/ftp-0.17-r6.ebuild @@ -0,0 +1,52 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-ftp/ftp/ftp-0.17-r6.ebuild,v 1.1 2005/10/14 05:44:14 vapier Exp $ + +inherit eutils toolchain-funcs flag-o-matic + +MY_P=netkit-${P} +S=${WORKDIR}/${MY_P} +DESCRIPTION="Standard Linux FTP client" +HOMEPAGE="http://www.hcs.harvard.edu/~dholland/computers/netkit.html" +SRC_URI="ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/${MY_P}.tar.gz" + +LICENSE="as-is" +SLOT="0" +KEYWORDS="-*" #~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="ssl ipv6" + +RDEPEND=">=sys-libs/ncurses-5.2 + ssl? ( dev-libs/openssl )" +DEPEND="${RDEPEND} + >=sys-apps/sed-4" + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}"/${MY_P}-ssl-0.2.patch + epatch "${FILESDIR}"/${MY_P}-ipv6.patch #47507 + epatch "${FILESDIR}"/${MY_P}-dont-strcpy-overlapping.patch #104311 + epatch "${FILESDIR}"/${MY_P}-acct.patch #fedora + epatch "${FILESDIR}"/${MY_P}-locale.patch #fedora + epatch "${FILESDIR}"/${MY_P}-runique_mget.patch #fedora + epatch "${FILESDIR}"/${MY_P}-security.patch #fedora + epatch "${FILESDIR}"/${MY_P}-segv.patch #fedora + epatch "${FILESDIR}"/${MY_P}-custom-cflags.patch + append-lfs-flags #101038 +} + +src_compile() { + ./configure \ + --prefix=/usr \ + $(use_enable ssl) \ + $(use_enable ipv6) \ + ${EXTRA_ECONF} \ + || die "configure failed" + emake CC="$(tc-getCC)" LDFLAGS="${LDFLAGS}" || die "make failed" +} + +src_install() { + dobin ftp/ftp || die + doman ftp/ftp.1 ftp/netrc.5 + dodoc ChangeLog README BUGS +} |