summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Volkov <pva@gentoo.org>2008-05-16 11:30:30 +0000
committerPeter Volkov <pva@gentoo.org>2008-05-16 11:30:30 +0000
commit076a1b4370e908adc953c80435141716e3656062 (patch)
treed86353108a3afd7d7e3e1b42d42a53735a40fcb7 /net-ftp/netkit-tftp
parentStable on ppc64; bug #222151 (diff)
downloadgentoo-2-076a1b4370e908adc953c80435141716e3656062.tar.gz
gentoo-2-076a1b4370e908adc953c80435141716e3656062.tar.bz2
gentoo-2-076a1b4370e908adc953c80435141716e3656062.zip
Fixed WRQ handling in tftpd, backported changes from debian and now we reopen socket on all errors. Removed old.
(Portage version: 2.1.4.4)
Diffstat (limited to 'net-ftp/netkit-tftp')
-rw-r--r--net-ftp/netkit-tftp/ChangeLog11
-rw-r--r--net-ftp/netkit-tftp/files/netkit-tftp-0.17-socket-reopen-on-errors.patch86
-rw-r--r--net-ftp/netkit-tftp/files/netkit-tftp-0.17-tftpd-put-fixes.patch35
-rw-r--r--net-ftp/netkit-tftp/netkit-tftp-0.17-r7.ebuild (renamed from net-ftp/netkit-tftp/netkit-tftp-0.17-r5.ebuild)42
4 files changed, 155 insertions, 19 deletions
diff --git a/net-ftp/netkit-tftp/ChangeLog b/net-ftp/netkit-tftp/ChangeLog
index 99e9d844ded4..b392c8e0a4b9 100644
--- a/net-ftp/netkit-tftp/ChangeLog
+++ b/net-ftp/netkit-tftp/ChangeLog
@@ -1,6 +1,15 @@
# ChangeLog for net-ftp/netkit-tftp
# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-ftp/netkit-tftp/ChangeLog,v 1.14 2008/03/29 02:33:27 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-ftp/netkit-tftp/ChangeLog,v 1.15 2008/05/16 11:30:29 pva Exp $
+
+*netkit-tftp-0.17-r7 (16 May 2008)
+
+ 16 May 2008; Peter Volkov <pva@gentoo.org>
+ +files/netkit-tftp-0.17-socket-reopen-on-errors.patch,
+ +files/netkit-tftp-0.17-tftpd-put-fixes.patch,
+ -netkit-tftp-0.17-r5.ebuild, +netkit-tftp-0.17-r7.ebuild:
+ Fixed WRQ handling in tftpd, backported changes from debian and now we
+ reopen socket on all errors. Removed old.
*netkit-tftp-0.17-r6 (29 Mar 2008)
diff --git a/net-ftp/netkit-tftp/files/netkit-tftp-0.17-socket-reopen-on-errors.patch b/net-ftp/netkit-tftp/files/netkit-tftp-0.17-socket-reopen-on-errors.patch
new file mode 100644
index 000000000000..58b6c710b97e
--- /dev/null
+++ b/net-ftp/netkit-tftp/files/netkit-tftp-0.17-socket-reopen-on-errors.patch
@@ -0,0 +1,86 @@
+Always reopen socket after a get/put in tftp.
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=130292
+
+--- tftp/main.c 2008-05-16 09:56:18 +0000
++++ tftp/main.c 2008-05-16 10:48:23 +0000
+@@ -69,7 +69,7 @@
+ #define TIMEOUT 5 /* secs between rexmt's */
+
+ struct sockaddr_in s_inn;
+-int f;
++int f = -1;
+ int trace;
+ int verbose;
+ int rexmtval = TIMEOUT;
+@@ -151,17 +151,11 @@
+ static struct cmd *getcmd(const char *name);
+ static char *tail(char *filename);
+
+-int
+-main(int argc, char *argv[])
+-{
++void initsock() {
+ struct sockaddr_in s_in;
+- int top;
+
+- sp = getservbyname("tftp", "udp");
+- if (sp == 0) {
+- fprintf(stderr, "tftp: udp/tftp: unknown service\n");
+- exit(1);
+- }
++ if (f >= 0)
++ close(f);
+ f = socket(AF_INET, SOCK_DGRAM, 0);
+ if (f < 0) {
+ perror("tftp: socket");
+@@ -173,6 +167,19 @@
+ perror("tftp: bind");
+ exit(1);
+ }
++}
++
++int
++main(int argc, char *argv[])
++{
++ int top;
++
++ sp = getservbyname("tftp", "udp");
++ if (sp == 0) {
++ fprintf(stderr, "tftp: udp/tftp: unknown service\n");
++ exit(1);
++ }
++ initsock();
+ strcpy(mode, "netascii");
+ mysignal(SIGINT, intr);
+ if (argc > 1) {
+
+--- tftp/tftp.c 2008-05-16 09:56:18 +0000
++++ tftp/tftp.c 2008-05-16 10:41:30 +0000
+@@ -204,6 +204,7 @@
+ block++;
+ } while (1);
+ abort:
++ initsock();
+ fclose(file);
+ stopclock();
+ if (amount > 0)
+@@ -307,6 +308,7 @@
+ amount += size;
+ } while (size == SEGSIZE);
+ abort: /* ok to ack, since user */
++ initsock();
+ ap->th_opcode = htons((u_short)ACK); /* has seen err msg */
+ ap->th_block = htons((u_short)block);
+ (void) sendto(f, ackbuf, 4, 0, (struct sockaddr *)&s_inn, sizeof(s_inn));
+
+--- tftp/tftpsubs.h 2008-05-16 09:56:18 +0000
++++ tftp/tftpsubs.h 2008-05-16 10:50:03 +0000
+@@ -1,6 +1,7 @@
+ #define PKTSIZE SEGSIZE+4 /* should be moved to tftp.h */
+
+ int synchnet(int);
++void initsock(void);
+ struct tftphdr *r_init(void);
+ struct tftphdr *w_init(void);
+ int readit(FILE *file, struct tftphdr **dpp, int convert);
+
diff --git a/net-ftp/netkit-tftp/files/netkit-tftp-0.17-tftpd-put-fixes.patch b/net-ftp/netkit-tftp/files/netkit-tftp-0.17-tftpd-put-fixes.patch
new file mode 100644
index 000000000000..c548a1611c85
--- /dev/null
+++ b/net-ftp/netkit-tftp/files/netkit-tftp-0.17-tftpd-put-fixes.patch
@@ -0,0 +1,35 @@
+=== modified file 'tftpd/tftpd.c'
+--- tftpd/tftpd.c 2008-05-16 09:56:18 +0000
++++ tftpd/tftpd.c 2008-05-16 10:09:38 +0000
+@@ -340,7 +340,8 @@
+ return(EACCESS);
+ }
+ }
+- if (stat(filename, &stbuf) < 0)
++ /* stat doesn't work with mode == WRQ as file don't exist */
++ if (stat(filename, &stbuf) < 0 && mode == RRQ)
+ return (errno == ENOENT ? ENOTFOUND : EACCESS);
+ #if 0
+ /*
+@@ -359,14 +360,18 @@
+ return (EACCESS);
+ }
+ #endif
++ /* Actually this checks are useless as we use filesystem permisions.
++ * Thus if we can't read (RRQ) or write (WRQ) to the file, open() will
++ * fail and set errno appropriately (ideas from debian patch).
+ if (mode == RRQ) {
+ if ((stbuf.st_mode & S_IROTH) == 0)
+ return (EACCESS);
+ } else {
+ if ((stbuf.st_mode & S_IWOTH) == 0)
+ return (EACCESS);
+- }
+- fd = open(filename, mode == RRQ ? O_RDONLY : O_WRONLY|O_TRUNC);
++ } */
++
++ fd = open(filename, mode == RRQ ? O_RDONLY : O_WRONLY|O_TRUNC|O_CREAT|O_EXCL, 0600);
+ if (fd < 0)
+ return (errno + 100);
+ file = fdopen(fd, (mode == RRQ)? "r":"w");
+
diff --git a/net-ftp/netkit-tftp/netkit-tftp-0.17-r5.ebuild b/net-ftp/netkit-tftp/netkit-tftp-0.17-r7.ebuild
index 09e329daca80..522684c772c0 100644
--- a/net-ftp/netkit-tftp/netkit-tftp-0.17-r5.ebuild
+++ b/net-ftp/netkit-tftp/netkit-tftp-0.17-r7.ebuild
@@ -1,52 +1,58 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-ftp/netkit-tftp/netkit-tftp-0.17-r5.ebuild,v 1.5 2008/03/23 22:51:54 ranger Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-ftp/netkit-tftp/netkit-tftp-0.17-r7.ebuild,v 1.1 2008/05/16 11:30:29 pva Exp $
inherit eutils toolchain-funcs
DESCRIPTION="the tftp server included in netkit"
-SRC_URI="ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/netkit-tftp-0.17.tar.gz"
HOMEPAGE="ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/"
+SRC_URI="ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/netkit-tftp-0.17.tar.gz"
-KEYWORDS="amd64 ~mips ppc ppc64 sparc x86"
-IUSE=""
LICENSE="BSD"
SLOT="0"
+KEYWORDS="~amd64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE=""
DEPEND="!virtual/tftp
- virtual/inetd"
+ virtual/inetd"
PROVIDE="virtual/tftp"
src_unpack() {
- unpack $A
+ unpack ${A}
cd "${S}"
# Change default man directory
- sed -i -e 's:MANDIR="$PREFIX/man":MANDIR="$PREFIX/share/man":' \
- -e 's:^LDFLAGS=::' configure
+ sed -i \
+ -e 's:MANDIR="$PREFIX/man":MANDIR="$PREFIX/share/man":' \
+ -e 's:^LDFLAGS=::' \
+ configure
# don't prestrip binaries
- find -name Makefile -exec sed -i -e 's,install -s,install,' \{\} \;
+ find . -name Makefile -print0 | xargs -0 sed -i -e 's:install -s:install:'
# Solve QA warning by including string.h
epatch "${FILESDIR}"/memset.patch
epatch "${FILESDIR}"/${P}-tftp-connect-segfault.patch
epatch "${FILESDIR}"/${P}-tftp-manpage-typo.patch
epatch "${FILESDIR}"/${P}-tftp-fix-put-zero-size.diff
+ epatch "${FILESDIR}"/${P}-tftpd-put-fixes.patch
+ epatch "${FILESDIR}"/${P}-socket-reopen-on-errors.patch
}
src_compile() {
- ./configure --prefix=/usr --installroot="${D}" \
- --with-c-compiler="$(tc-getCC)" || die
+ ./configure \
+ --prefix=/usr \
+ --installroot="${D}" \
+ --with-c-compiler="$(tc-getCC)" \
+ || die
emake || die
}
src_install() {
- dodir /usr/bin /usr/sbin
- doman tftp/tftp.1 tftpd/tftpd.8
- make install || die
-
- dodoc "${FILESDIR}"/{tftp-dgram,tftp-stream} BUGS ChangeLog README
- einfo "Take a look at /usr/share/doc/${PF}/tftp-* files"
- einfo "for sample xinetd configuration files."
+ dodir /usr/bin /usr/sbin /usr/share/man/man{1,8}
+ emake install || die
+ rm -f "${D}"/usr/share/man/man8/tftpd.8 #214734, collision with iputils
+ insinto /etc/xinetd.d
+ doins "${FILESDIR}"/{tftp-dgram,tftp-stream}
+ dodoc BUGS ChangeLog README
}