initial import

This commit is contained in:
2025-06-22 20:39:04 -05:00
commit f8a70886f0
3428 changed files with 302546 additions and 0 deletions

57
tftp-hpa/PKGBUILD Normal file
View File

@@ -0,0 +1,57 @@
# Maintainer: Jesus E. <heckyel@riseup.net>
pkgname=tftp-hpa
pkgver=5.2
_debver=$pkgver
_debrel=1.4
pkgrel=4
pkgdesc="Official tftp server"
arch=(i686 x86_64)
url='https://www.kernel.org/pub/software/network/tftp/tftp-hpa/'
license=('Original-BSD')
backup=('etc/conf.d/tftpd')
depends=('readline')
source=(https://www.kernel.org/pub/software/network/tftp/tftp-hpa/$pkgname-$pkgver.tar.gz
LICENSE::https://metadata.ftp-master.debian.org/changelogs//main/t/tftp-hpa/tftp-hpa_${_debver}+20150808-${_debrel}_copyright
tftpd.confd
tftpd.initd
tftpd.run
fix-common.patch
tftp-hpa-0.49-fortify-strcpy-crash.patch)
sha512sums=('d79c9bd41ccf573d44ae5c4d72726c27ed2f84c8fc4f7bb12e26c3deb9bee0ececcef8b4a49cca9c59da1673f1181e5187fd4ac0cbdc5285ca18f02c4788b89e'
'3f26f4fa1067fd4f62c85256ff989cfb0c55af5373d7e9a4eed2d61e45f2467a67a2824701a210326c8906a558b7b01d67e59ef9c7abc53afac676f568254262'
'd6a28715c97133794a2c4bd955a0dbe830767e0e3fa3ae0ad1f08bdebf348225633b6e49cd1785906e1ac0d2e016f34222c4724bae9933670a4bd16b128f9eee'
'cf1fe93a7618968365e473f3286d5fffceaaa75a30ce68e9268163fb00d2aef21afd08b4b293b1bd95b07200016d8cdaf9511fad43cf9aba5cd1610cd45b44af'
'7161e39e269ebf250b162f768ef904b14abbb292cb61ed2fab7c080caa6d3642e3586d88d56f7ed20f64bb4395bc15df1cdc682cd86cc44135d362fe2e840770'
'40127e7ce276a2bc015255dbeef2665bfe8ff006b1e1d8fb79797e946d6030fd74606cffe0bea11eaad276a693f223faaaf1c1ccb5f276b40fdad40b366172b7'
'ef2cecfb1509381b6c730fb4e2a1790d180f37a9f009ee89dbd04f4deabd92ca87158d3fa4eae11824a1235113f288627c4c00058c64cda7d83dd624c6b0469a')
prepare() {
cd ${pkgname}-${pkgver}
patch -Np1 -i ${srcdir}/tftp-hpa-0.49-fortify-strcpy-crash.patch
patch -Np1 -i ${srcdir}/fix-common.patch
}
build() {
cd ${pkgname}-${pkgver}
CFLAGS+=' -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--without-tcpwrappers
make
}
package() {
cd ${pkgname}-${pkgver}
make INSTALLROOT="${pkgdir}" install
install -d "$pkgdir"/var/tftpboot
# openrc and runit
install -Dm0644 "$srcdir/tftpd.confd" "${pkgdir}/etc/conf.d/tftpd"
install -Dm0755 "$srcdir/tftpd.initd" "${pkgdir}/etc/init.d/tftpd"
install -Dm0755 "$srcdir/tftpd.run" "${pkgdir}/etc/sv/tftpd/run"
# license
install -Dm0644 "${srcdir}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

24
tftp-hpa/fix-common.patch Normal file
View File

@@ -0,0 +1,24 @@
diff -urN tftp-hpa-5.2.orig/tftp/main.c tftp-hpa-5.2/tftp/main.c
--- tftp-hpa-5.2.orig/tftp/main.c 2020-11-14 22:21:15.851650899 -0700
+++ tftp-hpa-5.2/tftp/main.c 2020-11-14 22:21:41.878327755 -0700
@@ -95,7 +95,7 @@
int margc;
char *margv[20];
const char *prompt = "tftp> ";
-sigjmp_buf toplevel;
+static sigjmp_buf toplevel;
void intr(int);
struct servent *sp;
int portrange = 0;
diff -urN tftp-hpa-5.2.orig/tftp/tftp.c tftp-hpa-5.2/tftp/tftp.c
--- tftp-hpa-5.2.orig/tftp/tftp.c 2020-11-14 22:21:15.851650899 -0700
+++ tftp-hpa-5.2/tftp/tftp.c 2020-11-14 22:21:51.304998113 -0700
@@ -48,7 +48,7 @@
#define PKTSIZE SEGSIZE+4
char ackbuf[PKTSIZE];
int timeout;
-sigjmp_buf toplevel;
+static sigjmp_buf toplevel;
sigjmp_buf timeoutbuf;
static void nak(int, const char *);

View File

@@ -0,0 +1,26 @@
diff -urN tftp-hpa-0.49.orig/tftp/tftp.c tftp-hpa-0.49/tftp/tftp.c
--- tftp-hpa-0.49.orig/tftp/tftp.c 2008-10-20 18:08:31.000000000 -0400
+++ tftp-hpa-0.49/tftp/tftp.c 2009-08-05 09:47:18.072585848 -0400
@@ -279,15 +279,16 @@
struct tftphdr *tp, const char *mode)
{
char *cp;
+ size_t len;
tp->th_opcode = htons((u_short) request);
cp = (char *)&(tp->th_stuff);
- strcpy(cp, name);
- cp += strlen(name);
- *cp++ = '\0';
- strcpy(cp, mode);
- cp += strlen(mode);
- *cp++ = '\0';
+ len = strlen(name) + 1;
+ memcpy(cp, name, len);
+ cp += len;
+ len = strlen(mode) + 1;
+ memcpy(cp, mode, len);
+ cp += len;
return (cp - (char *)tp);
}

15
tftp-hpa/tftpd.confd Normal file
View File

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

21
tftp-hpa/tftpd.initd Normal file
View File

@@ -0,0 +1,21 @@
#!/sbin/openrc-run
# 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
after firewall
}
start() {
ebegin "Starting tftpd"
/usr/sbin/tftpd -l ${INTFTPD_OPTS}
eend $?
}
stop() {
ebegin "Stopping tftpd"
start-stop-daemon --stop --exec /usr/sbin/tftpd
eend $?
}

3
tftp-hpa/tftpd.run Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
: "${OPTS:= -s -v}"
exec /usr/sbin/in.tftpd -L $OPTS /var/lib/tftp