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 | 2460bafb9152f5e6d17669a6876c44ec3b771e98 (patch) | |
tree | a324013cb23f308f06d3ebfe2d0e3a0d2c8af2c6 /net-ftp/ftp | |
parent | add docs (diff) | |
download | gentoo-2-2460bafb9152f5e6d17669a6876c44ec3b771e98.tar.gz gentoo-2-2460bafb9152f5e6d17669a6876c44ec3b771e98.tar.bz2 gentoo-2-2460bafb9152f5e6d17669a6876c44ec3b771e98.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.
(Portage version: 2.0.53_rc5)
Diffstat (limited to 'net-ftp/ftp')
-rw-r--r-- | net-ftp/ftp/ChangeLog | 12 | ||||
-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 |
6 files changed, 227 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/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 +} |