summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klausmann <klausman@gentoo.org>2011-03-26 09:05:43 +0000
committerTobias Klausmann <klausman@gentoo.org>2011-03-26 09:05:43 +0000
commit932917377f831d80ae30dc0acea5f35d54bf41ab (patch)
tree129c62990482c090dc85bd655152c941f2d66e12 /net-ftp
parentDisable global survey by default in example conf file wrt #360483 by robbat2 (diff)
downloadgentoo-2-932917377f831d80ae30dc0acea5f35d54bf41ab.tar.gz
gentoo-2-932917377f831d80ae30dc0acea5f35d54bf41ab.tar.bz2
gentoo-2-932917377f831d80ae30dc0acea5f35d54bf41ab.zip
Integrate patches from bugs 321705, 322601 and 323883
(Portage version: 2.1.9.44/cvs/Linux x86_64)
Diffstat (limited to 'net-ftp')
-rw-r--r--net-ftp/atftp/ChangeLog9
-rw-r--r--net-ftp/atftp/atftp-0.7-r2.ebuild67
-rw-r--r--net-ftp/atftp/files/atftp-0.7-blockno.patch136
-rw-r--r--net-ftp/atftp/files/atftp-0.7-illreply.patch12
-rw-r--r--net-ftp/atftp/files/atftp-0.7-spaced_filename.patch96
5 files changed, 319 insertions, 1 deletions
diff --git a/net-ftp/atftp/ChangeLog b/net-ftp/atftp/ChangeLog
index 12c5d3e20495..3310eb357b7d 100644
--- a/net-ftp/atftp/ChangeLog
+++ b/net-ftp/atftp/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for net-ftp/atftp
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-ftp/atftp/ChangeLog,v 1.24 2011/03/22 20:56:27 ulm Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-ftp/atftp/ChangeLog,v 1.25 2011/03/26 09:05:43 klausman Exp $
+
+*atftp-0.7-r2 (26 Mar 2011)
+
+ 26 Mar 2011; Tobias Klausmann <klausman@gentoo.org> +atftp-0.7-r2.ebuild,
+ +files/atftp-0.7-blockno.patch, +files/atftp-0.7-illreply.patch,
+ +files/atftp-0.7-spaced_filename.patch:
+ Integrate patches from bugs 321705, 322601 and 323883
22 Mar 2011; Ulrich Mueller <ulm@gentoo.org> atftp-0.7-r1.ebuild:
Drop PROVIDE=virtual/tftp and update blocker, bug 359125.
diff --git a/net-ftp/atftp/atftp-0.7-r2.ebuild b/net-ftp/atftp/atftp-0.7-r2.ebuild
new file mode 100644
index 000000000000..c364e9d92ff4
--- /dev/null
+++ b/net-ftp/atftp/atftp-0.7-r2.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-ftp/atftp/atftp-0.7-r2.ebuild,v 1.1 2011/03/26 09:05:42 klausman Exp $
+
+inherit eutils flag-o-matic
+
+DEBIAN_PV="11"
+DEBIAN_A="${PN}_${PV}-${DEBIAN_PV}.diff.gz"
+
+DESCRIPTION="Advanced TFTP implementation client/server"
+HOMEPAGE="ftp://ftp.mamalinux.com/pub/atftp/"
+SRC_URI="ftp://ftp.mamalinux.com/pub/atftp/${P}.tar.gz
+ mirror://debian/pool/main/a/${PN}/${DEBIAN_A}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86 ~s390"
+IUSE="selinux tcpd readline pcre"
+
+DEPEND="tcpd? ( sys-apps/tcp-wrappers )
+ selinux? ( sec-policy/selinux-tftpd )
+ readline? ( sys-libs/readline )
+ pcre? ( dev-libs/libpcre )"
+RDEPEND="${DEPEND}
+ !net-ftp/netkit-tftp
+ !net-ftp/tftp-hpa"
+
+src_unpack() {
+ unpack ${P}.tar.gz
+ cd "${S}"
+ epatch "${DISTDIR}"/${DEBIAN_A}
+ epatch "${FILESDIR}"/${P}-pcre.patch
+ epatch "${FILESDIR}"/${P}-password.patch
+ epatch "${FILESDIR}"/${P}-tests.patch
+ epatch "${FILESDIR}"/${P}-glibc24.patch
+ epatch "${FILESDIR}"/${P}-blockno.patch
+ epatch "${FILESDIR}"/${P}-spaced_filename.patch
+ epatch "${FILESDIR}"/${P}-illreply.patch
+ # remove upstream's broken CFLAGS
+ sed -i.orig -e \
+ '/^CFLAGS="-g -Wall -D_REENTRANT"/s,".*","",g' \
+ "${S}"/configure
+}
+
+src_compile() {
+ append-flags -D_REENTRANT -DRATE_CONTROL
+ econf \
+ $(use_enable tcpd libwrap) \
+ $(use_enable readline libreadline) \
+ $(use_enable pcre libpcre) \
+ --enable-mtftp \
+ || die "./configure failed"
+ emake CFLAGS="${CFLAGS}" || die
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die "Installation failed"
+ newinitd "${FILESDIR}"/atftp.init atftp
+ newconfd "${FILESDIR}"/atftp.confd atftp
+
+ dodoc README* BUGS FAQ Changelog INSTALL TODO
+ dodoc "${S}"/docs/*
+
+ docinto test
+ cd "${S}"/test
+ dodoc load.sh mtftp.conf pcre_pattern.txt test.sh test_suite.txt
+}
diff --git a/net-ftp/atftp/files/atftp-0.7-blockno.patch b/net-ftp/atftp/files/atftp-0.7-blockno.patch
new file mode 100644
index 000000000000..6a3184f98bec
--- /dev/null
+++ b/net-ftp/atftp/files/atftp-0.7-blockno.patch
@@ -0,0 +1,136 @@
+--- atftp-0.7/tftp_file.c~ 2010-05-27 13:05:12.000000000 -0500
++++ atftp-0.7/tftp_file.c 2010-05-27 12:50:05.000000000 -0500
+@@ -133,19 +133,21 @@
+ int mcast_sockfd = 0;
+ struct sockaddr_in sa_mcast;
+ struct ip_mreq mreq;
+ struct hostent *host;
+ int master_client = 0;
+ unsigned int file_bitmap[NB_BLOCK];
+ int prev_bitmap_hole = -1; /* the previous hole found in the bitmap */
+ char string[MAXLEN];
++ int rx_block_number;
+
+ int prev_block_number = 0; /* needed to support netascii convertion */
+ int temp = 0;
++ size_t ignore;
+
+ data->file_size = 0;
+ tftp_cancel = 0;
+ from.sin_addr.s_addr = 0;
+
+ memset(&sa_mcast, 0, sizeof(struct sockaddr_in));
+ memset(&file_bitmap, 0, sizeof(file_bitmap));
+
+@@ -300,17 +302,17 @@
+ {
+ connect(sockfd, (struct sockaddr *)&sa, sizeof(sa));
+ connected = 1;
+ }
+ state = S_OACK_RECEIVED;
+ break;
+ case GET_ERROR:
+ fprintf(stderr, "tftp: error received from server <");
+- fwrite(tftphdr->th_msg, 1, data_size - 4 - 1, stderr);
++ ignore = fwrite(tftphdr->th_msg, 1, data_size - 4 - 1, stderr);
+ fprintf(stderr, ">\n");
+ state = S_ABORT;
+ break;
+ case GET_DATA:
+ number_of_timeout = 0;
+ /* if the socket if not connected, connect it */
+ if (!connected)
+ {
+@@ -513,21 +515,24 @@
+ state = S_WAIT_PACKET;
+ break;
+ case S_DATA_RECEIVED:
+ if ((multicast && master_client) || (!multicast))
+ timeout_state = S_SEND_ACK;
+ else
+ timeout_state = S_WAIT_PACKET;
+
+- block_number = ntohs(tftphdr->th_block);
++ rx_block_number = ntohs(tftphdr->th_block);
+ if (data->trace)
+ fprintf(stderr, "received DATA <block: %d, size: %d>\n",
+ ntohs(tftphdr->th_block), data_size - 4);
+
++ if ((uint16_t)rx_block_number == (uint16_t)(block_number+1))
++ ++block_number;
++
+ if (tftp_file_write(fp, tftphdr->th_data, data->data_buffer_size - 4, block_number,
+ data_size - 4, convert, &prev_block_number, &temp)
+ != data_size - 4)
+ {
+
+ fprintf(stderr, "tftp: error writing to file %s\n",
+ data->local_file);
+ tftp_send_error(sockfd, &sa, ENOSPACE, data->data_buffer,
+@@ -613,19 +618,21 @@
+ int connected; /* 1 when sockfd is connected */
+ struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer;
+ FILE *fp; /* the local file pointer */
+ int number_of_timeout = 0;
+ struct stat file_stat;
+ int convert = 0; /* if true, do netascii convertion */
+ char string[MAXLEN];
+
++ int ack_block_number;
+ int prev_block_number = 0; /* needed to support netascii convertion */
+ int prev_file_pos = 0;
+ int temp = 0;
++ size_t ignore;
+
+ data->file_size = 0;
+ tftp_cancel = 0;
+ from.sin_addr.s_addr = 0;
+
+ /* make sure the socket is not connected */
+ sa.sin_family = AF_UNSPEC;
+ connect(sockfd, (struct sockaddr *)&sa, sizeof(sa));
+@@ -759,20 +766,23 @@
+ case GET_ACK:
+ number_of_timeout = 0;
+ /* if the socket if not connected, connect it */
+ if (!connected)
+ {
+ //connect(sockfd, (struct sockaddr *)&sa, sizeof(sa));
+ connected = 1;
+ }
+- block_number = ntohs(tftphdr->th_block);
++ ack_block_number = ntohs(tftphdr->th_block);
++ if ((uint16_t)(block_number+1) == ack_block_number)
++ ++block_number;
+ if (data->trace)
+ fprintf(stderr, "received ACK <block: %d>\n",
+- block_number);
++ ack_block_number);
++
+ if ((last_block != -1) && (block_number > last_block))
+ {
+ state = S_END;
+ break;
+ }
+ state = S_SEND_DATA;
+ break;
+ case GET_OACK:
+@@ -782,17 +792,17 @@
+ {
+ //connect(sockfd, (struct sockaddr *)&sa, sizeof(sa));
+ connected = 1;
+ }
+ state = S_OACK_RECEIVED;
+ break;
+ case GET_ERROR:
+ fprintf(stderr, "tftp: error received from server <");
+- fwrite(tftphdr->th_msg, 1, data_size - 4 - 1, stderr);
++ ignore = fwrite(tftphdr->th_msg, 1, data_size - 4 - 1, stderr);
+ fprintf(stderr, ">\n");
+ state = S_ABORT;
+ break;
+ case GET_DISCARD:
+ /* consider discarded packet as timeout to make sure when don't lock up
+ if routing is broken */
+ number_of_timeout++;
+ fprintf(stderr, "tftp: packet discard <%s:%d>.\n",
diff --git a/net-ftp/atftp/files/atftp-0.7-illreply.patch b/net-ftp/atftp/files/atftp-0.7-illreply.patch
new file mode 100644
index 000000000000..e18bbd99c9e9
--- /dev/null
+++ b/net-ftp/atftp/files/atftp-0.7-illreply.patch
@@ -0,0 +1,12 @@
+*** tftp_def.old.c 2009-02-28 17:56:12.000000000 +0100
+--- tftp_def.c 2009-02-28 17:57:02.000000000 +0100
+***************
+*** 141,146 ****
+--- 141,147 ----
+ */
+ inline char *Strncpy(char *to, const char *from, size_t size)
+ {
++ if (size <= 0) { *to = '\000'; return to; }
+ to[size-1] = '\000';
+ return strncpy(to, from, size - 1);
+ }
diff --git a/net-ftp/atftp/files/atftp-0.7-spaced_filename.patch b/net-ftp/atftp/files/atftp-0.7-spaced_filename.patch
new file mode 100644
index 000000000000..da96d9f6b820
--- /dev/null
+++ b/net-ftp/atftp/files/atftp-0.7-spaced_filename.patch
@@ -0,0 +1,96 @@
+--- atftp-0.7/tftp.c~ 2010-06-03 08:51:14.000000000 -0500
++++ atftp-0.7/tftp.c 2010-06-03 09:40:56.000000000 -0500
+@@ -18,16 +18,17 @@
+ #include "config.h"
+
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
+ #include <getopt.h>
+ #include <string.h>
++#include <stdarg.h>
+
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <netdb.h>
+
+ #include <signal.h>
+@@ -344,16 +345,41 @@
+
+ /* If no names matched, then return NULL. */
+ return NULL;
+ }
+ # endif
+ #endif
+
+ /*
++ * set argc/argv from variadic string arguments
++*/
++void make_arg_vector(int *argc, char***argv, ...)
++{
++ char **p;
++ char *s;
++ va_list argp;
++
++ // how many args?
++ *argc = 0;
++ va_start(argp, argv);
++ while ( (s=va_arg(argp, char*)) )
++ ++*argc;
++
++ // allocate storage
++ *argv = malloc(*argc * sizeof (char*));
++
++ // store args
++ p = *argv;
++ va_start(argp, argv);
++ while ( (s=va_arg(argp, char*)) )
++ *p++ = s;
++}
++
++/*
+ * Split a string into args.
+ */
+ void make_arg(char *string, int *argc, char ***argv)
+ {
+ static char *tmp = NULL;
+ size_t argz_len;
+
+ /* split the string to an argz vector */
+@@ -1142,30 +1168,26 @@
+ argv[optind+1]);
+ make_arg(string, &ac, &av);
+ process_cmd(ac, av);
+ }
+
+ if (!interactive)
+ {
+ if (action == PUT)
+- snprintf(string, sizeof(string), "put %s %s", local_file,
+- remote_file);
++ make_arg_vector(&ac,&av,"put",local_file,remote_file,NULL);
+ else if (action == GET)
+- snprintf(string, sizeof(string), "get %s %s", remote_file,
+- local_file);
++ make_arg_vector(&ac,&av,"get",remote_file,local_file,NULL);
+ else if (action == MGET)
+- snprintf(string, sizeof(string), "mget %s %s", remote_file,
+- local_file);
++ make_arg_vector(&ac,&av,"mget",remote_file,local_file,NULL);
+ else
+ {
+ fprintf(stderr, "No action specified in batch mode!\n");
+ exit(ERR);
+ }
+- make_arg(string, &ac, &av);
+ if (process_cmd(ac, av) == ERR)
+ exit(ERR);
+ }
+ return OK;
+ }
+
+ void tftp_usage(void)
+ {