add tftp servers with filecase patch

git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/mds@886 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
geos_one 2009-03-19 18:09:00 +00:00
parent 333bc089ef
commit bba081f507
20 changed files with 1027 additions and 0 deletions

129
net-ftp/atftp/ChangeLog Normal file
View File

@ -0,0 +1,129 @@
# ChangeLog for net-ftp/atftp
# Copyright 2002-2008 Gentoo Foundation; Distributed under the GPL v2
# $Header: /var/cvsroot/gentoo-x86/net-ftp/atftp/ChangeLog,v 1.22 2008/11/26 22:11:09 flameeyes Exp $
26 Nov 2008; Diego E. Pettenò <flameeyes@gentoo.org> atftp-0.7-r1.ebuild:
Use mirror://debian/.
15 May 2007; Thilo Bangert <bangert@gentoo.org> metadata.xml:
add <herd>no-herd</herd>
08 Apr 2007; <solar@gentoo.org> atftp-0.7-r1.ebuild:
- added ~s390
08 Jan 2007; Danny van Dyk <kugelfang@gentoo.org> -atftp-0.6.2.ebuild,
-atftp-0.7.ebuild:
QA: Removed unused versions.
19 Aug 2006; Torsten Veller <tove@gentoo.org> atftp-0.7-r1.ebuild:
Stable on x86 (#144324).
19 Aug 2006; Jason Wever <weeve@gentoo.org> atftp-0.7-r1.ebuild:
Stable on SPARC.
19 Aug 2006; Tobias Scherbaum <dertobi123@gentoo.org> atftp-0.7-r1.ebuild:
ppc stable, bug #144324
18 Aug 2006; Thomas Cort <tcort@gentoo.org> atftp-0.7-r1.ebuild:
Stable on amd64 wrt Bug #144324.
18 Aug 2006; Markus Rothe <corsair@gentoo.org> atftp-0.7-r1.ebuild:
Stable on ppc64
*atftp-0.7-r1 (26 May 2006)
26 May 2006; Robin H. Johnson <robbat2@gentoo.org>
+files/atftp-0.7-glibc24.patch, +files/atftp-0.7-password.patch,
+files/atftp-0.7-pcre.patch, +files/atftp-0.7-tests.patch,
+atftp-0.7-r1.ebuild:
Major fixups, bugs: #104218 - password extension for linksys gear, #109638 -
pcre fix and more features, #109912 - 64bit fixes, #110591 - test fixes,
#126520 - glibc 2.4 support.
21 Jan 2006; Lars Weiler <pylon@gentoo.org> atftp-0.7.ebuild:
Stable on ppc.
21 Jul 2005; Markus Rothe <corsair@gentoo.org> atftp-0.7.ebuild:
Stable on ppc64
14 Jun 2005; Markus Rothe <corsair@gentoo.org> atftp-0.7.ebuild:
added ~ppc64
21 Feb 2005; Simon Stelling <blubb@gentoo.org> :
added ~amd64
07 Feb 2005; Mike Frysinger <vapier@gentoo.org>
+files/atftp-0.7-gcc.patch, atftp-0.7.ebuild:
Added patch to fix building #71090.
07 Feb 2005; Jan Brinkmann <luckyduck@gentoo.org> atftp-0.6.2.ebuild:
added ~amd64 to 0.6.2, fixes #81083
31 Jul 2004; <malc@gentoo.org> atftp-0.7.ebuild:
~amd64 - closes bug #57702
22 Apr 2004; Chuck Short <zul@gentoo.org> atftp-0.6.2.ebuild:
Fixes typo. Closes #48660.
22 Mar 2004; David Holm <dholm@gentoo.org> atftp-0.7.ebuild:
Added to ~ppc.
*atftp-0.7 (22 Mar 2004)
22 Mar 2004; Chuck Short <zul@gentoo.org> atftp-0.6.2.ebuild,
atftp-0.7.ebuild:
Version bump, closes #45210.
22 Mar 2004; Chuck Short <zul@gentoo.org> atftp-0.6.2.ebuild:
Marked stable for x86.
26 Jan 2004; Chuck Short <zul@gentoo.org> atftp-0.6-r3.ebuild,
atftp-0.6.2.ebuild:
Fix typo in ebuild. closes #38946.
30 Dec 2003; Chuck Short <zul@gentoo.org> atftp-0.6.2.ebuild,
files/atftp.confd, files/atftp.init:
Added init scripts. Closes #36051.
14 Dec 2003; Joshua Kinard <kumba@gentoo.org> atftp-0.6.2.ebuild:
forgot to mark keywords as unstable
*atftp-0.6.2 (14 Dec 2003)
14 Dec 2003; Joshua Kinard <kumba@gentoo.org> atftp-0.6.2.ebuild:
Version bump
*atftp-0.6-r3 (31 Oct 2003)
31 Oct 2003; Heinrich Wendel <lanius@gentoo.org> atftp-0.6-r2.ebuild,
atftp-0.6-r3.ebuild:
stable, it's just a virtual ;D
30 Oct 2003; Heinrich Wendel <lanius@gentoo.org> atftp-0.6-r1.ebuild,
atftp-0.6.ebuild:
added virtual/tftp
*atftp-0.6-r1 (29 Aug 2003)
29 Aug 2003; Martin Holzer <mholzer@gentoo.org> atftp-0.6-r1.ebuild,
atftp-0.6-r2.ebuild, atftp-0.6.ebuild, files/atftp-0.6-security.patch:
move net-ftp/atftp net-misc
18 Jun 2003; Daniel Ahlberg <aliz@gentoo.org> files/atftp-0.6-security.patch :
Updated patch to a more proper one.
*atftp-0.6-r2 (08 Jun 2003)
08 Jun 2003; Daniel Ahlberg <aliz@gentoo.org> :
Security update.
*atftp-0.6-r1 (29 Oct 2002)
29 Oct 2002; Daniel Ahlberg <aliz@gentoo.org> :
Updated ebuild with tcpd support. Ebuild contributed by Cory Visi <cory@visi.name> in #9797.
*atftp-0.6 (16 Aug 2002)
16 Aug 2002; Daniel Ahlberg <aliz@gentoo.org> atftp-0.6.ebuild:
Initial import. Ebuild submitted by Francisco Gimeno
<kikov@fco-gimeno.com>.

14
net-ftp/atftp/Manifest Normal file
View File

@ -0,0 +1,14 @@
AUX atftp-0.6-security.patch 1019 RMD160 a9e343455a2ea4600846aacea7f2b6a001bcb824 SHA1 621dd41ed4b92cbee404edbf6cdfbefa28a434d0 SHA256 aa7b7046728b9c94ebf56a02ff41d20e0bb85e5cdce1f74f0cbc2048cffe54dc
AUX atftp-0.7-gcc.patch 540 RMD160 f3a646f0efee4cc63887a9a39623237d33dcb226 SHA1 0b0cccc6f8f3b832ac72d4d0bd3bf4be2f97928f SHA256 c1ea9eb2f42fbd151e1c82bb2cd431c85bddbaa2413f297a4d285269d1d080d6
AUX atftp-0.7-glibc24.patch 778 RMD160 753a813c7ac9cbf7a28f4d7af98f11c986d008b4 SHA1 b34c7b216b5ec5ecdb55e42e4ac2f47b26bc09f9 SHA256 d2bec90943b330db84cd6af089a67e476f45271d9f33095ef3fc281c83eb7ed5
AUX atftp-0.7-password.patch 3906 RMD160 c637ec04fe4940fd84d27787ab6174d14daae5ff SHA1 f5fc938e0ff7762999f1d446b73ebb344c2ed71b SHA256 e56637318c9baa9e85525dc92c6be170713529af834a5bb6871238d374c0a365
AUX atftp-0.7-pcre.patch 661 RMD160 28f934bf041339487998f3d49f505f6ced10f409 SHA1 a1cd8f0387691336fe924f1b6302b95b2d6d19df SHA256 53cb989038e1c5520104c837cb086ffbb20afb6555f42782f78fd05bcea9f304
AUX atftp-0.7-tests.patch 582 RMD160 104c31709aeead26d9d7e8c1e61f316911b3c72e SHA1 d562036b5cc429437585d33b0a31a91de513c42d SHA256 00e04546214265b0e9d03a0f8182837909825fef111e53a7b23d9e6a382a9d54
AUX atftp.confd 105 RMD160 9c0b9cc23e749e95dc1b19375860e15e14d3004c SHA1 f8e2d6b120ff3302334c01d35a0ed2fc5c6dd742 SHA256 a2dc012a0ecd94f27950901b18a54ecc744630da4c7cd8939b3f11be07685645
AUX atftp.init 437 RMD160 83808c852164b4d368da5c9da95474dbbcd1e651 SHA1 8f8d7fac163aabec794acb12bd59162547aeb8ee SHA256 4970eb720ab838c1855b33b2437e0f8f44356e9b6f5a7225c99e2a29d6311b34
AUX atftpd-filecase.diff 4518 RMD160 d8b45c563eb3d229c3e80066b949e24560ba57b8 SHA1 7dade60cd9086f9529bfb5b1fa6935a7c8f496b4 SHA256 718df4f6f168ac0b5b02fe4a20c92274210fec1b96974b6ec28e5ec5bd219e59
DIST atftp-0.7.tar.gz 202234 RMD160 06bd2ba663a87fabb79e1536275ad23f60c68636 SHA1 83726e552ca10a164f1a7b344b0c51ca33423fe9 SHA256 9c548c44d3cfdf259118d9fd4e468e1fe4567456dbff8ff59838c5f70ef62ea3
DIST atftp_0.7-11.diff.gz 26055 RMD160 b078ce6715faec118b9524be67b9ed1fa6bb9fc2 SHA1 76d8cae2c0744298649c66cafa24afd977ef9643 SHA256 77accd1f5b5d4759fe9572f7a917c629e35692e484ac4dc6fd4415fe745036ff
EBUILD atftp-0.7-r2.ebuild 1806 RMD160 e15288b0224b1094a18c7e255c4a9505a3f1d351 SHA1 0b3f2b03fc726c1555f595e4913ecac102d1eb88 SHA256 d6c59e46d06a5f98c51791aec7ae94a7308bf8bb0beeb6db368dc806bd230a3f
MISC ChangeLog 4078 RMD160 98f027b1f7a4ac3f8c0ce0ca10fb7ff29387aca5 SHA1 e3369e456a71ee079b8359caf0b9728bc0919c30 SHA256 be975eb5825a1f6888e705884c7e955d5337c5be621ffeeeb61da51f9c5cef5f
MISC metadata.xml 231 RMD160 c13056229989c3d4f448a7c7abcff3f4ee7ce13c SHA1 2d63dfb700b223f8f37c078692a81b2237896bce SHA256 4595c2615fd7c9095517949b1a920d4457f92801eb9d46307b18aafe58ec2a8a

View File

@ -0,0 +1,65 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-ftp/atftp/atftp-0.7-r1.ebuild,v 1.9 2008/11/26 22:11:09 flameeyes 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"
RDEPEND="tcpd? ( sys-apps/tcp-wrappers )
selinux? ( sec-policy/selinux-tftpd )
readline? ( sys-libs/readline )
pcre? ( dev-libs/libpcre )"
DEPEND="${RDEPEND}
!virtual/tftp"
PROVIDE="virtual/tftp"
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}"/atftpd-filecase.diff
# 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
}

View File

@ -0,0 +1,23 @@
--- tftp.c 2003-06-17 00:13:52.000000000 +0200
+++ tftp.patch.c 2003-06-17 00:09:50.000000000 +0200
@@ -827,17 +827,17 @@ int tftp_cmd_line_options(int argc, char
process_cmd(ac, av);
break;
case 'T':
- sprintf(string, "timeout %s", optarg);
+ snprintf(string, sizeof(string), "timeout %s", optarg);
make_arg(string, &ac, &av);
process_cmd(ac, av);
break;
case 't':
- sprintf(string, "option timeout %s", optarg);
+ snprintf(string, sizeof(string), "option timeout %s", optarg);
make_arg(string, &ac, &av);
process_cmd(ac, av);
break;
case 'b':
- sprintf(string, "option blksize %s", optarg);
+ snprintf(string, sizeof(string), "option blksize %s", optarg);
make_arg(string, &ac, &av);
process_cmd(ac, av);
break;

View File

@ -0,0 +1,20 @@
--- argz.h.orig 2005-02-07 16:04:41.000000000 -0500
+++ argz.h 2005-02-07 16:05:01.000000000 -0500
@@ -180,7 +180,7 @@
#ifdef __USE_EXTERN_INLINES
extern inline char *
__argz_next (__const char *__argz, size_t __argz_len,
- __const char *__entry) __THROW
+ __const char *__entry)
{
if (__entry)
{
@@ -194,7 +194,7 @@
}
extern inline char *
argz_next (__const char *__argz, size_t __argz_len,
- __const char *__entry) __THROW
+ __const char *__entry)
{
return __argz_next (__argz, __argz_len, __entry);
}

View File

@ -0,0 +1,22 @@
--- atftp-0.7/stats.c.org
+++ atftp-0.7/stats.c
@@ -18,6 +18,7 @@
#include <limits.h>
#include <string.h>
+#include <unistd.h>
#include "tftp_def.h"
#include "stats.h"
#include "logger.h"
@@ -157,8 +158,9 @@
logger(LOG_INFO, " Load measurements:");
+ long sc_clk_tck = sysconf(_SC_CLK_TCK);
logger(LOG_INFO, " User: %8.3fs Sys:%8.3fs",
- (double)(s_stats.tms.tms_utime) / CLK_TCK,
- (double)(s_stats.tms.tms_stime) / CLK_TCK);
+ (double)(s_stats.tms.tms_utime) / sc_clk_tck,
+ (double)(s_stats.tms.tms_stime) / sc_clk_tck);
logger(LOG_INFO, " Total:%8.3fs CPU:%8.3f%%",
(double)(tmp.tv_sec + tmp.tv_usec * 1e-6),
(double)(s_stats.tms.tms_utime + s_stats.tms.tms_stime) /

View File

@ -0,0 +1,94 @@
diff -Naur atftp-0.7.orig/tftp.c atftp-0.7/tftp.c
--- atftp-0.7.orig/tftp.c 2004-03-15 18:55:56.000000000 -0500
+++ atftp-0.7/tftp.c 2005-08-29 21:40:06.000000000 -0400
@@ -525,6 +525,10 @@
fprintf(stderr, " multicast: enabled\n");
else
fprintf(stderr, " multicast: disabled\n");
+ if (data.tftp_options[OPT_PASSWORD].specified)
+ fprintf(stderr, " password: enabled\n");
+ else
+ fprintf(stderr, " password: disabled\n");
return ERR;
}
/* if disabling an option */
@@ -971,6 +975,7 @@
{ "put", 0, NULL, 'p'},
{ "local-file", 1, NULL, 'l'},
{ "remote-file", 1, NULL, 'r'},
+ { "password", 1, NULL, 'P'},
{ "tftp-timeout", 1, NULL, 'T'},
{ "mode", 1, NULL, 'M'},
{ "option", 1, NULL, 'O'},
@@ -993,7 +998,7 @@
};
/* Support old argument until 0.8 */
- while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:sm",
+ while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:smP:",
options, &option_index)) != EOF)
{
switch (c)
@@ -1028,6 +1033,11 @@
else
action = PUT;
break;
+ case 'P':
+ snprintf(string, sizeof(string), "option password %s", optarg);
+ make_arg(string, &ac, &av);
+ process_cmd(ac, av);
+ break;
case 'l':
interactive = 0;
Strncpy(local_file, optarg, MAXLEN);
@@ -1169,6 +1179,7 @@
" -p, --put : put file\n"
" -l, --local-file <file> : local file name\n"
" -r, --remote-file <file> : remote file name\n"
+ " -P, --password <password>: specify password (Linksys ext.)\n"
" --tftp-timeout <value> : delay before retransmission, client side\n"
#if 0
" t, --timeout <value> : delay before retransmission, "
diff -Naur atftp-0.7.orig/tftp_def.c atftp-0.7/tftp_def.c
--- atftp-0.7.orig/tftp_def.c 2004-02-12 22:16:09.000000000 -0500
+++ atftp-0.7/tftp_def.c 2005-08-29 21:36:57.000000000 -0400
@@ -37,6 +37,7 @@
{ "timeout", "5", 0, 1 }, /* 2348, 2349, 2090. */
{ "blksize", "512", 0, 1 }, /* This is the default option */
{ "multicast", "", 0, 1 }, /* structure */
+ { "password", "", 0, 1}, /* password */
{ "", "", 0, 0}
};
diff -Naur atftp-0.7.orig/tftp_def.h atftp-0.7/tftp_def.h
--- atftp-0.7.orig/tftp_def.h 2004-02-12 22:16:09.000000000 -0500
+++ atftp-0.7/tftp_def.h 2005-08-29 20:16:27.000000000 -0400
@@ -40,6 +40,7 @@
#define OPT_TIMEOUT 3
#define OPT_BLKSIZE 4
#define OPT_MULTICAST 5
+#define OPT_PASSWORD 6
#define OPT_NUMBER 7
#define OPT_SIZE 12
diff -Naur atftp-0.7.orig/tftp_io.c atftp-0.7/tftp_io.c
--- atftp-0.7.orig/tftp_io.c 2004-02-18 20:30:00.000000000 -0500
+++ atftp-0.7/tftp_io.c 2005-08-29 22:05:11.000000000 -0400
@@ -70,10 +70,13 @@
break;
if (tftp_options[i].enabled && tftp_options[i].specified)
{
- Strncpy(data_buffer + buf_index, tftp_options[i].option,
- data_buffer_size - buf_index);
- buf_index += strlen(tftp_options[i].option);
- buf_index++;
+ if (i != OPT_PASSWORD)
+ {
+ Strncpy(data_buffer + buf_index, tftp_options[i].option,
+ data_buffer_size - buf_index);
+ buf_index += strlen(tftp_options[i].option);
+ buf_index++;
+ }
Strncpy(data_buffer + buf_index, tftp_options[i].value,
data_buffer_size - buf_index);
buf_index += strlen(tftp_options[i].value);

View File

@ -0,0 +1,14 @@
--- atftp-0.7/tftpd_pcre.c~ 2005-10-17 23:14:52.000000000 +0200
+++ atftp-0.7/tftpd_pcre.c 2005-10-17 23:14:52.000000000 +0200
@@ -211,9 +211,9 @@
chp++; /* point to value indicating substring */
rc = pcre_get_substring(str, ovector, matches, *chp - 0x30, &tmpstr);
/* found string */
- if (rc > 0)
+ if (rc > 0 && outchp - outstr + rc+1 < outsize)
{
- Strncpy(outchp, tmpstr, rc);
+ Strncpy(outchp, tmpstr, rc+1);
outchp += rc;
pcre_free_substring(tmpstr);
continue;

View File

@ -0,0 +1,23 @@
diff -Naur atftp-0.7.orig/test/test.sh atftp-0.7/test/test.sh
--- atftp-0.7.orig/test/test.sh 2003-04-28 21:59:51.000000000 -0400
+++ atftp-0.7/test/test.sh 2005-10-26 22:42:15.000000000 -0400
@@ -151,7 +151,7 @@
test_blocksize 1428
test_blocksize 16000
test_blocksize 64000
-test_blocksize 65465
+test_blocksize 65464
#
# testing fot tsize
@@ -162,9 +162,9 @@
TSIZE=`grep "OACK <tsize:" out | sed -e "s/[^0-9]//g"`
if [ "$TSIZE" != "2048" ]; then
echo "ERROR (server report $TSIZE bytes but it should be 2048)"
+ ERROR=1
else
echo "OK"
- ERROR=1
fi
#

View File

@ -0,0 +1,4 @@
# Config file for tftp server
TFTPD_ROOT="/tftproot"
TFTPD_OPTS="--daemon --user nobody --group nobody"

28
net-ftp/atftp/files/atftp.init Executable file
View File

@ -0,0 +1,28 @@
#!/sbin/runscript
depend() {
use logger
need net
}
checkconfig() {
if [ ! -d ${TFTPD_ROOT} ]
then
eerror "You need a tftp root directory"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting tftpd"
start-stop-daemon --start --quiet --exec /usr/sbin/in.tftpd \
-- ${TFTPD_OPTS} ${TFTPD_ROOT}
eend $?
}
stop() {
ebegin "Stopping tftpd"
start-stop-daemon --stop --quiet --exec /usr/sbin/in.tftpd
eend $?
}

View File

@ -0,0 +1,141 @@
* Case insensitive lookup patch for atftpd
*
* Copyright (c) 2006-2007 Gianluigi Tiesi <sherpya@netfarm.it>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this software; if not, write to the
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
diff -Nur atftp-0.7.dfsg.orig/tftpd.c atftp-0.7.dfsg/tftpd.c
--- atftp-0.7.dfsg.orig/tftpd.c 2007-12-09 06:06:20.000000000 +0100
+++ atftp-0.7.dfsg/tftpd.c 2007-12-09 06:08:51.229707272 +0100
@@ -667,6 +667,15 @@
switch (retval)
{
case GET_RRQ:
+ if (data->tftp_options[OPT_FILENAME].value[0] == '\\')
+ if (!tftpd_lookup_file(directory, data->tftp_options[OPT_FILENAME].value))
+ {
+ /* Short circuit */
+ tftp_send_error(data->sockfd, &data->client_info->client,
+ ENOTFOUND, data->data_buffer, data->data_buffer_size);
+ stats_err_locked();
+ break;
+ }
logger(LOG_NOTICE, "Serving %s to %s:%d",
data->tftp_options[OPT_FILENAME].value,
inet_ntoa(data->client_info->client.sin_addr),
diff -Nur atftp-0.7.dfsg.orig/tftpd.h atftp-0.7.dfsg/tftpd.h
--- atftp-0.7.dfsg.orig/tftpd.h 2004-02-27 03:05:26.000000000 +0100
+++ atftp-0.7.dfsg/tftpd.h 2007-12-09 06:06:35.319368784 +0100
@@ -77,6 +77,7 @@
/*
* Functions defined in tftpd_file.c
*/
+int tftpd_lookup_file(const char *directory, char *filename);
int tftpd_rules_check(char *filename);
int tftpd_receive_file(struct thread_data *data);
int tftpd_send_file(struct thread_data *data);
diff -Nur atftp-0.7.dfsg.orig/tftpd_file.c atftp-0.7.dfsg/tftpd_file.c
--- atftp-0.7.dfsg.orig/tftpd_file.c 2004-02-18 03:21:47.000000000 +0100
+++ atftp-0.7.dfsg/tftpd_file.c 2007-12-09 06:09:23.683773504 +0100
@@ -27,6 +27,7 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
+#include <dirent.h>
#include <sys/stat.h>
#include "tftpd.h"
#include "tftp_io.h"
@@ -60,6 +61,81 @@
extern tftpd_pcre_self_t *pcre_top;
#endif
+/*
+ * Case insensitive file lookup, for windows clients
+ */
+
+int tftpd_lookup_entry(const char *comp, char *dest)
+{
+ DIR *dirp;
+ struct dirent *dptr;
+ dirp = opendir(dest);
+ if (!dirp) return 0;
+ while ((dptr = readdir(dirp)))
+ {
+ if (!strcasecmp(dptr->d_name, comp))
+ {
+ strcat(dest, "/");
+ strcat(dest, dptr->d_name);
+ closedir(dirp);
+ return 1;
+ }
+ }
+ closedir(dirp);
+ return 0;
+}
+
+int tftpd_lookup_file(const char *directory, char *filename)
+{
+ int found = 0;
+ int len = 0;
+ char dest[MAXLEN];
+ char comp[MAXLEN];
+ char *check = filename;
+ char *seek = NULL;
+
+ dest[0] = 0;
+ strcat(dest, directory);
+ len = strlen(dest);
+ if (dest[len-1] == '/')
+ dest[len-1] = 0;
+ check++;
+ while (*check)
+ {
+ seek = strchr(check, '\\');
+ if (!seek)
+ {
+ if ((*check) && (tftpd_lookup_entry(check, dest)))
+ found = 1;
+ break;
+ }
+ len = seek - check;
+ memcpy(comp, check, len);
+ comp[len]=0;
+ if (!tftpd_lookup_entry(comp, dest))
+ break;
+ check += len + 1;
+ }
+
+ if (found)
+ {
+ filename[0] = 0;
+ strcat(filename, dest + strlen(directory));
+ }
+ else
+ {
+ seek = filename;
+ while (*seek)
+ {
+ if (*seek == '\\') *seek = '/';
+ seek++;
+ }
+ filename++;
+ }
+
+ logger(LOG_DEBUG, "Filecase lookup file: %s (found %s)", filename, (found ? "yes" : "no"));
+ return found;
+}
/*
* Rules for filenames. This is common to both tftpd_recieve_file

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>no-herd</herd>
<maintainer>
<email>maintainer-needed@gentoo.org</email>
</maintainer>
</pkgmetadata>

242
net-ftp/tftp-hpa/ChangeLog Normal file
View File

@ -0,0 +1,242 @@
# ChangeLog for net-ftp/tftp-hpa
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
# $Header: /var/cvsroot/gentoo-x86/net-ftp/tftp-hpa/ChangeLog,v 1.43 2009/03/18 18:06:20 ranger Exp $
18 Mar 2009; Brent Baude <ranger@gentoo.org> tftp-hpa-0.49-r1.ebuild:
stable ppc, bug 260516
14 Mar 2009; Raúl Porcel <armin76@gentoo.org> tftp-hpa-0.49-r1.ebuild:
arm/ia64/s390/sh stable wrt #260516
11 Mar 2009; Brent Baude <ranger@gentoo.org> tftp-hpa-0.49-r1.ebuild:
stable ppc64, bug 260516
09 Mar 2009; Friedrich Oslage <bluebird@gentoo.org>
tftp-hpa-0.49-r1.ebuild:
Stable on sparc, bug #260516
08 Mar 2009; Tobias Klausmann <klausman@gentoo.org>
tftp-hpa-0.49-r1.ebuild:
Stable on alpha, bug #260516
08 Mar 2009; Markus Meier <maekke@gentoo.org> tftp-hpa-0.49-r1.ebuild:
amd64/x86 stable, bug #260516
06 Mar 2009; Jeroen Roovers <jer@gentoo.org> tftp-hpa-0.49-r1.ebuild:
Stable for HPPA (bug #260516).
*tftp-hpa-0.49-r1 (27 Feb 2009)
27 Feb 2009; Raúl Porcel <armin76@gentoo.org> -tftp-hpa-0.49.ebuild,
+tftp-hpa-0.49-r1.ebuild:
Revbump to add ipv6 USE-flag, bug #253422
*tftp-hpa-0.49 (01 Nov 2008)
01 Nov 2008; Robin H. Johnson <robbat2@gentoo.org> +tftp-hpa-0.49.ebuild:
Version bump.
09 May 2008; Jeroen Roovers <jer@gentoo.org> tftp-hpa-0.48.ebuild:
Stable for HPPA too.
13 Aug 2007; Tobias Scherbaum <dertobi123@gentoo.org>
tftp-hpa-0.48.ebuild:
ppc. stable
26 Jul 2007; Raúl Porcel <armin76@gentoo.org> tftp-hpa-0.48.ebuild:
alpha stable
13 May 2007; Steve Dibb <beandog@gentoo.org> tftp-hpa-0.48.ebuild:
amd64 stable
10 May 2007; Doug Goldstein <cardoe@gentoo.org> metadata.xml:
Fix metadata
22 Apr 2007; Raúl Porcel <armin76@gentoo.org> tftp-hpa-0.48.ebuild:
ia64 stable
17 Apr 2007; Gustavo Zacarias <gustavoz@gentoo.org> tftp-hpa-0.48.ebuild:
Stable on sparc
16 Apr 2007; Markus Rothe <corsair@gentoo.org> tftp-hpa-0.48.ebuild:
Stable on ppc64
12 Mar 2007; Raúl Porcel <armin76@gentoo.org> tftp-hpa-0.48.ebuild:
x86 stable
*tftp-hpa-0.48 (01 Feb 2007)
01 Feb 2007; Mike Frysinger <vapier@gentoo.org> metadata.xml,
+tftp-hpa-0.48.ebuild:
Version bump.
*tftp-hpa-0.45-r1 (18 Jan 2007)
18 Jan 2007; Robin H. Johnson <robbat2@gentoo.org>
+tftp-hpa-0.45-r1.ebuild:
0.45 broke the conf.d file, need a new revision for this.
08 Jan 2007; Danny van Dyk <kugelfang@gentoo.org> -tftp-hpa-0.44.ebuild:
QA: Removed unused versions.
*tftp-hpa-0.45 (25 Dec 2006)
25 Dec 2006; Mike Frysinger <vapier@gentoo.org>
+files/tftp-hpa-0.45-parallel.patch, +tftp-hpa-0.45.ebuild:
Version bump and fix building in parallel.
*tftp-hpa-0.44 (13 Dec 2006)
13 Dec 2006; Charlie Shepherd <masterdriverz@gentoo.org>
-files/in.tftpd.confd-0.42, +files/in.tftpd.confd-0.44,
-tftp-hpa-0.42.ebuild, -tftp-hpa-0.42-r1.ebuild, +tftp-hpa-0.44.ebuild:
Bump to version 0.44; bug 156322; thanks to Axel Dyks
19 Nov 2006; Diego Pettenò <flameeyes@gentoo.org> +metadata.xml,
tftp-hpa-0.42-r1.ebuild:
Add ~x86-fsd keyword and maintainer-needed metadata.
21 Oct 2006; Tobias Scherbaum <dertobi123@gentoo.org>
tftp-hpa-0.40.1.ebuild:
ppc stable
*tftp-hpa-0.42-r1 (20 May 2006)
20 May 2006; Robin H. Johnson <robbat2@gentoo.org>
files/in.tftpd.confd-0.42, +tftp-hpa-0.42-r1.ebuild:
Bug #132889, argument over default service location leads to a safer default.
*tftp-hpa-0.42 (02 Apr 2006)
02 Apr 2006; Robin H. Johnson <robbat2@gentoo.org>
+files/in.tftpd.confd-0.42, +tftp-hpa-0.42.ebuild:
Bug #111006, version bump. Note that the /proc hackery for disable PMTU
discovery and local port numbers are now not needed.
10 Mar 2006; Aron Griffis <agriffis@gentoo.org> tftp-hpa-0.40.1.ebuild:
Mark 0.40.1 stable on ia64
07 Feb 2006; Aron Griffis <agriffis@gentoo.org> tftp-hpa-0.40.1.ebuild:
Mark 0.40.1 stable on alpha
04 Dec 2005; Tom Gall <tgall@gentoo.org> tftp-hpa-0.40.1.ebuild:
stable on ppc64
10 Nov 2005; Brent Baude <ranger@gentoo.org> tftp-hpa-0.40.1.ebuild:
Marking tftp-hpa-0.40.1 ~ppc64 for bug 112068
*tftp-hpa-0.40.1 (01 Oct 2005)
01 Oct 2005; Daniel Black <dragonheart@gentoo.org>
+tftp-hpa-0.40.1.ebuild:
version bump
18 Sep 2005; Mike Frysinger <vapier@gentoo.org> tftp-hpa-0.40-r1.ebuild:
Add support for USE=selinux #106354 by petre rodan and USE=tcpd/readline
#102867 by Francisco Javier.
15 Sep 2005; Aron Griffis <agriffis@gentoo.org> tftp-hpa-0.40-r1.ebuild:
Mark 0.40-r1 stable on alpha
13 Aug 2005; Michael Hanselmann <hansmi@gentoo.org>
tftp-hpa-0.40-r1.ebuild:
Stable on ppc.
02 Aug 2005; Gustavo Zacarias <gustavoz@gentoo.org>
tftp-hpa-0.40-r1.ebuild:
Stable on sparc
30 Jul 2005; Mike Frysinger <vapier@gentoo.org> files/in.tftpd.confd,
files/in.tftpd.rc6, tftp-hpa-0.40-r1.ebuild:
Clean up init scripts and stabilize for #90784 by Daniel Webert.
29 Jul 2005; Marcelo Goes <vanquirius@gentoo.org> -tftp-hpa-0.33.ebuild,
-tftp-hpa-0.40.ebuild, tftp-hpa-0.40-r1.ebuild:
Really fix bug 83325. Thanks to Dan Eisenhut <daniel.eisenhut@med.ge.com>.
*tftp-hpa-0.40-r1 (27 Feb 2005)
27 Feb 2005; Jon Hood <squinky86@gentoo.org> +metadata.xml,
+tftp-hpa-0.40-r1.ebuild:
Add sys-apps/tcp-wrappers to RDEPEND, #83325. Thanks Dan Eisenhut
<daniel.eisenhut@med.ge.com>.
29 Dec 2004; Ciaran McCreesh <ciaranm@gentoo.org> :
Change encoding to UTF-8 for GLEP 31 compliance
*tftp-hpa-0.40 (09 Dec 2004)
09 Dec 2004; Jon Hood <squinky86@gentoo.org> +files/in.tftpd.confd,
+files/in.tftpd.rc6, +tftp-hpa-0.33.ebuild, +tftp-hpa-0.34-r1.ebuild,
+tftp-hpa-0.40.ebuild:
Moved from net-misc/tftp-hpa to net-ftp/tftp-hpa.
*tftp-hpa-0.40 (09 Dec 2004)
09 Dec 2004; Jon Hood <squinky86@gentoo.org> +tftp-hpa-0.40.ebuild:
Version bump, #69600; thanks lison <bugzilla.gentoo@lison.com>.
01 Jul 2004; Jon Hood <squinky86@gentoo.org> tftp-hpa-0.33.ebuild,
tftp-hpa-0.34-r1.ebuild:
change virtual/glibc to virtual/libc, add IUSE
15 Jun 2004; Danny van Dyk <kugelfang@gentoo.org> tftp-hpa-0.34-r1.ebuild:
Marked stable on amd64.
08 Jun 2004; Bryan Østergaard <kloeri@gentoo.org> tftp-hpa-0.34-r1.ebuild:
Stable on alpha.
15 Apr 2004; Michael McCabe <randy@gentoo.org> tftp-hpa-0.34-r1.ebuild:
adding s390 keywords
21 Mar 2004; Jason Wever <weeve@gentoo.org> tftp-hpa-0.34-r1.ebuild:
Marked stable on sparc.
31 Oct 2003; Heinrich Wendel <lanius@gentoo.org> tftp-hpa-0.34-r1.ebuild,
tftp-hpa-0.34.ebuild:
stable, it's just a virtual ;D
*tftp-hpa-0.34-r1 (30 Oct 2003)
30 Oct 2003; Heinrich Wendel <lanius@gentoo.org> tftp-hpa-0.34-r1.ebuild:
virtual/tftp
*tftp-hpa-0.34 (29 Aug 2003)
29 Aug 2003; Martin Holzer <mholzer@gentoo.org> tftp-hpa-0.33.ebuild,
tftp-hpa-0.34.ebuild, files/in.tftpd.confd, files/in.tftpd.rc6:
Move app-admin/tftp-hpa net-misc/tftp-hpa
*tftp-hpa-0.34 (25 May 2003)
25 May 2003; Martin Holzer <mholzer@gentoo.org> tftp-hpa-0.16.ebuild,
tftp-hpa-0.29.ebuild, tftp-hpa-0.33.ebuild, tftp-hpa-0.34.ebuild:
Version bumped & SRC_URI now uses mirror://kernel
*tftp-hpa-0.33 (28 Mar 2003)
28 Mar 2003; Michael Imhof <tantive@gentoo.org>
Version bumped, thanks to Terje Kvernes <terjekv@math.uio.no>
for the hint. Should close #18327.
06 Dec 2002; Rodney Rees <manson@gentoo.org> : changed sparc ~sparc keywords
*tftp-hpa-0.29 (19 Apr 2002)
19 Apr 2002; J.Ritchie <jasonr@myrealbox.com> ChangeLog :
Updated to work with newest tftp-hpa version.
Added /etc/conf.d and /etc/init.d scripts for use with rc-update.
*tftp-hpa-0.16 (1 Feb 2002)
18 Sept 2002; Mike Frysinger <vapier@gentoo.org> :
Fixed HOMEPAGE variable
1 Feb 2002; G.Bevin <gbevin@gentoo.org> ChangeLog :
Added initial ChangeLog which should be updated whenever the package is
updated in any way. This changelog is targetted to users. This means that the
comments should well explained and written in clean English. The details about
writing correct changelogs are explained in the skel.ChangeLog file which you
can find in the root directory of the portage repository.

View File

@ -0,0 +1,7 @@
AUX in.tftpd.confd-0.44 576 RMD160 718a437e2d44c1594ef359784fde89d0367c2a47 SHA1 e4a051f435f56007b9efb4173e2d272b12442436 SHA256 55e67f871f070db2b7fa1428dabf55777ca87fecdbba7fa3b03e63c63734f977
AUX in.tftpd.rc6 443 RMD160 e4a8d822b24cb9cf73b6e9601fcc58d40a203cb9 SHA1 7929ceb89811558576c7a9a4a4bb6d11bbd3c833 SHA256 3bceb3446bbebfae60d5276a2481c4311270d2e33c46e73a8bea66e330244ae0
AUX tftp-hpa-filecase.diff 2297 RMD160 8456ea7f755474dfe3ce41cf61c393d59925c172 SHA1 424cc545fdd561ac77e8a483ef8311eb46e77bea SHA256 fbe50acb8ea5377e4a96879e26cde163f42b254cacbb8efdcefe0e2b1e5c8dc5
DIST tftp-hpa-0.49.tar.bz2 91829 RMD160 d3a9a18f4b41dfd006c90b94b64a6473f577a7ed SHA1 28349027d7b672855414d5b8a6d45c8936e7c54d SHA256 9055064ea0aea223e82e99cbdead970dc46fa9456c91a7b3d6c0b37b62b6dd8c
EBUILD tftp-hpa-0.49-r2.ebuild 1363 RMD160 1c72f28d314bd086f482339b5f48a4b64c770e02 SHA1 4350c8fcf2ea0de8f101581403c4104ae8902dcd SHA256 1e9c4bff646ecb8ca8b140d9900cd61339538c36d33e0aeb02ab77cb91acca1a
MISC ChangeLog 8092 RMD160 4ff12a1cba5cad43208702585cba6092a06da6c4 SHA1 aebed90254c9793b7622e2684d9c28a510ecbe13 SHA256 49d9d5813965bc2558ea4ebc72a3696baae1532bdd5d127bc88ee08afbf50e4f
MISC metadata.xml 164 RMD160 f43cbec30b7074319087c9acffdb9354b17b0db3 SHA1 9c213f5803676c56439df3716be07d6692588856 SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92

View File

@ -0,0 +1,15 @@
# /etc/init.d/in.tftpd
# Path to server files from
# Depending on your application you may have to change this.
# This is commented out to force you to look at the file!
#INTFTPD_PATH="/var/tftp/"
#INTFTPD_PATH="/tftpboot/"
#INTFTPD_PATH="/tftproot/"
# For more options, see in.tftpd(8)
# -R 4096:32767 solves problems with ARC firmware, and obsoletes
# the /proc/sys/net/ipv4/ip_local_port_range hack.
# -s causes $INTFTPD_PATH to be the root of the TFTP tree.
# -l is passed by the init script in addition to these options.
INTFTPD_OPTS="-R 4096:32767 -s ${INTFTPD_PATH}"

View File

@ -0,0 +1,20 @@
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-ftp/tftp-hpa/files/in.tftpd.rc6,v 1.2 2005/07/30 06:29:14 vapier Exp $
depend() {
need net
}
start() {
ebegin "Starting tftpd"
/usr/sbin/in.tftpd -l ${INTFTPD_OPTS}
eend $?
}
stop() {
ebegin "Stopping tftpd"
start-stop-daemon --stop --exec /usr/sbin/in.tftpd
eend $?
}

View File

@ -0,0 +1,100 @@
Submitted By: Mario Fetka (mario dot fetka at gmail dot com)
Date: 2009-03-19
Initial Package Version: 0.49
Origin: http://oss.netfarm.it/guides/ris-linux.php
Upstream Status: unknown
Description: A patch for hpa-tftp to permit case insensitive file lookups
diff -Naur tftp-hpa-0.49.orig/tftpd/tftpd.c tftp-hpa-0.49/tftpd/tftpd.c
--- tftp-hpa-0.49.orig/tftpd/tftpd.c 2009-03-19 17:50:47.883141096 +0000
+++ tftp-hpa-0.49/tftpd/tftpd.c 2009-03-19 18:00:20.991735706 +0000
@@ -46,6 +46,7 @@
#include <pwd.h>
#include <limits.h>
#include <syslog.h>
+#include <dirent.h>
#include "common/tftpsubs.h"
#include "recvfrom.h"
@@ -972,6 +973,9 @@
static void tftp_sendfile(struct formats *, struct tftphdr *, int);
static void tftp_recvfile(struct formats *, struct tftphdr *, int);
+int lookup_entry(const char *comp, char *dest);
+void lookup_file(char *filename);
+
struct formats {
const char *f_mode;
char *(*f_rewrite) (char *, int, const char **);
@@ -1332,6 +1336,63 @@
}
#endif
+int lookup_entry(const char *comp, char *dest)
+{
+ DIR *dirp;
+ struct dirent *dptr;
+ dirp = opendir(dest[0] ? dest : ".");
+ if (!dirp) return 0;
+ while ((dptr = readdir(dirp)))
+ {
+ if (!strcasecmp(dptr->d_name, comp))
+ {
+ if (dest[0]) strcat(dest, "/");
+ strcat(dest, dptr->d_name);
+ closedir(dirp);
+ return 1;
+ }
+ }
+ closedir(dirp);
+ return 0;
+}
+
+
+void lookup_file(char *filename)
+{
+ int found = 0;
+ int len = 0;
+ char dest[1024];
+ char comp[1024];
+ char *check = filename;
+ char *seek = NULL;
+
+ dest[0] = 0;
+ check++;
+ while (*check)
+ {
+ seek = strchr(check, '\\');
+ if (!seek)
+ {
+ if ((*check) && (lookup_entry(check, dest)))
+ found = 1;
+ break;
+ }
+ len = seek - check;
+ memcpy(comp, check, len);
+ comp[len]=0;
+ if (!lookup_entry(comp, dest))
+ break;
+ check += len + 1;
+ }
+
+ if (found)
+ {
+ filename[0] = 0;
+ strcat(filename, dest);
+ }
+}
+
+
static FILE *file;
/*
* Validate file access. Since we
@@ -1357,6 +1418,7 @@
tsize_ok = 0;
*errmsg = NULL;
+ if (*filename == '\\') lookup_file(filename);
if (!secure) {
if (*filename != '/') {
*errmsg = "Only absolute filenames allowed";

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>base-system</herd>
</pkgmetadata>

View File

@ -0,0 +1,53 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-ftp/tftp-hpa/tftp-hpa-0.49-r1.ebuild,v 1.8 2009/03/18 18:06:20 ranger Exp $
inherit eutils
DESCRIPTION="port of the OpenBSD TFTP server"
HOMEPAGE="http://www.kernel.org/pub/software/network/tftp/"
SRC_URI="mirror://kernel/software/network/tftp/${P}.tar.bz2"
LICENSE="BSD"
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
IUSE="ipv6 readline selinux tcpd"
DEPEND="readline? ( sys-libs/readline )
tcpd? ( sys-apps/tcp-wrappers )
selinux? ( sec-policy/selinux-tftpd )
!virtual/tftp"
PROVIDE="virtual/tftp"
src_unpack() {
unpack ${A}
cd "${S}"
epatch "${FILESDIR}"/${PN}-filecase.diff
}
src_compile() {
econf \
$(use_with ipv6) \
$(use_with tcpd tcpwrappers) \
$(use_with readline) \
|| die
emake || die
}
src_install() {
emake INSTALLROOT="${D}" install || die
dodoc README* CHANGES tftpd/sample.rules
# iputils installs this
rm -f "${D}"/usr/share/man/man8/tftpd.8
newconfd "${FILESDIR}"/in.tftpd.confd-0.44 in.tftpd
newinitd "${FILESDIR}"/in.tftpd.rc6 in.tftpd
}
pkg_postinst() {
ewarn "After installation, please ensure you look at"
ewarn "/etc/conf.d/in.tftpd and set the correct path"
ewarn "for your application."
}