summaryrefslogtreecommitdiff
path: root/net/yale-tftpd/patches
diff options
context:
space:
mode:
authornra <nra>2001-07-30 19:43:49 +0000
committernra <nra>2001-07-30 19:43:49 +0000
commit9f618e0f9a17c4ecd0f2df3a837b1f99780add9b (patch)
tree6670d3f666f96a7d841ba4eb00d48a74a3a811b2 /net/yale-tftpd/patches
parentf6856e94f041e44361bc66921484b3ca518831f4 (diff)
downloadpkgsrc-9f618e0f9a17c4ecd0f2df3a837b1f99780add9b.tar.gz
New package yale-tftpd version 3.0. PR 13177 by Stoned Elipot.
yale-tftpd is an improved (but slightly incompatible until you configure it) tftpd server. It has a powerful and configurable security setup and is well suited for people who want to boot network devices using their system as a TFTP server.
Diffstat (limited to 'net/yale-tftpd/patches')
-rw-r--r--net/yale-tftpd/patches/patch-aa19
-rw-r--r--net/yale-tftpd/patches/patch-ab12
-rw-r--r--net/yale-tftpd/patches/patch-ac32
-rw-r--r--net/yale-tftpd/patches/patch-ad198
4 files changed, 261 insertions, 0 deletions
diff --git a/net/yale-tftpd/patches/patch-aa b/net/yale-tftpd/patches/patch-aa
new file mode 100644
index 00000000000..8da1e9c8faf
--- /dev/null
+++ b/net/yale-tftpd/patches/patch-aa
@@ -0,0 +1,19 @@
+$NetBSD: patch-aa,v 1.1.1.1 2001/07/30 19:43:49 nra Exp $
+
+--- Makefile.orig Fri Oct 7 01:41:10 1994
++++ Makefile
+@@ -2,10 +2,11 @@
+
+ SRCS= tftpd.c tftpsubs.c tftpyale.c config.c
+ PROG= tftpd
+-MAN8= tftpd.8
++MAN= tftpd.8
+
+-ETCDIR?=${DESTDIR}/etc
+-BINDIR?=${DESTDIR}/usr/libexec
++ETCDIR=${PREFIX}/etc
++BINDIR=${PREFIX}/libexec
++MANDIR=${PREFIX}/man
+
+ CFLAGS+=-DCONFIGFILE='"${ETCDIR}/tftpd.conf"'
+
diff --git a/net/yale-tftpd/patches/patch-ab b/net/yale-tftpd/patches/patch-ab
new file mode 100644
index 00000000000..2b3d082fc31
--- /dev/null
+++ b/net/yale-tftpd/patches/patch-ab
@@ -0,0 +1,12 @@
+$NetBSD: patch-ab,v 1.1.1.1 2001/07/30 19:43:49 nra Exp $
+
+--- classes/Makefile.orig Mon Mar 20 21:11:53 1995
++++ classes/Makefile
+@@ -5,6 +5,7 @@
+
+ NOPIC= true
+ NOPROFILE=true
++NOLINT= true
+
+ install:
+ @echo not installing libclasses.a
diff --git a/net/yale-tftpd/patches/patch-ac b/net/yale-tftpd/patches/patch-ac
new file mode 100644
index 00000000000..a267d48e4d0
--- /dev/null
+++ b/net/yale-tftpd/patches/patch-ac
@@ -0,0 +1,32 @@
+$NetBSD: patch-ac,v 1.1.1.1 2001/07/30 19:43:49 nra Exp $
+
+--- tftpd.8.orig Wed Oct 5 06:18:21 1994
++++ tftpd.8
+@@ -9,7 +9,7 @@
+ .SH NAME
+ tftpd \- DARPA Trivial File Transfer Protocol server
+ .SH SYNOPSIS
+-.B /etc/tftpd
++.B @PREFIX@/libexec/tftpd
+ [
+ .B \-d
+ ]
+@@ -60,7 +60,7 @@
+ If the optional configuration file argument is provided on the command
+ line,
+ .B tftpd
+-will use that, otherwise the default file is ``/usr/local/etc/tftpd.conf''.
++will use that, otherwise the default file is ``@PREFIX@/etc/tftpd.conf''.
+ .sp
+ Configuration commands are:
+ .IP defaultDirectory
+@@ -266,7 +266,7 @@
+ services(5),
+ inetd(8)
+ .SH "FILES"
+-.ta \w'/usr/local/etc/tftpd.conf~~'u
+-/usr/local/etc/tftpd.conf default tftpd configuration file
++.ta \w'@PREFIX@/etc/tftpd.conf~~'u
++@PREFIX@/etc/tftpd.conf default tftpd configuration file
+ .br
+ /etc/inetd.conf inetd configuration file
diff --git a/net/yale-tftpd/patches/patch-ad b/net/yale-tftpd/patches/patch-ad
new file mode 100644
index 00000000000..4838dc5f6bf
--- /dev/null
+++ b/net/yale-tftpd/patches/patch-ad
@@ -0,0 +1,198 @@
+$NetBSD: patch-ad,v 1.1.1.1 2001/07/30 19:43:49 nra Exp $
+
+--- tftpd.c.orig Mon Mar 20 21:14:39 1995
++++ tftpd.c
+@@ -56,6 +56,8 @@
+ #include <syslog.h>
+ #include <string.h>
+
++#include <unistd.h>
++
+ #define TIMEOUT 5
+
+ extern int errno;
+@@ -105,6 +107,8 @@
+
+ if (argc > 1 && strcmp (argv[1], "-d") == 0) {
+ setUpForDebugging();
++ argc--;
++ argv++;
+ }
+ if (ioctl(0, FIONBIO, &on) < 0) {
+ syslog(LOG_ERR, "ioctl(FIONBIO): %m\n");
+@@ -202,7 +206,7 @@
+ awaitInput(chan)
+ int chan;
+ {
+- int imask;
++ fd_set imask;
+ int nready;
+ struct timeval tv;
+ extern int maxInputWait;
+@@ -212,8 +216,9 @@
+ else
+ tv.tv_sec = 5*60; /* default: wait for 5 minutes */
+ tv.tv_usec = 0;
+- imask = 1<<chan;
+- nready = select (sizeof(imask)*8, &imask, (int*)0, (int*)0, &tv);
++ FD_ZERO(&imask);
++ FD_SET(chan, &imask);
++ nready = select (chan+1 , &imask, NULL, NULL, &tv);
+ return nready;
+ }
+
+@@ -294,7 +299,10 @@
+ }
+
+ int validate_access();
+-int sendfile(), recvfile();
++
++struct formats;
++int tftpsendfile(struct formats *);
++int tftprecvfile(struct formats *);
+
+ struct formats {
+ char *f_mode;
+@@ -303,8 +311,8 @@
+ int (*f_recv)();
+ int f_convert;
+ } formats[] = {
+- { "netascii", validate_access, sendfile, recvfile, 1 },
+- { "octet", validate_access, sendfile, recvfile, 0 },
++ { "netascii", validate_access, tftpsendfile, tftprecvfile, 1 },
++ { "octet", validate_access, tftpsendfile, tftprecvfile, 0 },
+ #ifdef notdef
+ { "mail", validate_user, sendmail, recvmail, 1 },
+ #endif
+@@ -355,13 +363,13 @@
+ exit(1);
+ }
+ if (tftpDebugLevel > 0) {
+- char buf[1024];
+- buf[0] = '\0';
+- getwd(buf);
++ char* buf;
++ buf = getcwd(NULL, 0);
+ syslog(LOG_DEBUG, "request %s '%s' from %s; cwd='%s'",
+ (tp->th_opcode == RRQ ? "read" : "write"),
+ filename, inet_ntoa(from.sin_addr),
+ buf);
++ free(buf);
+ }
+ ecode = (*pf->f_validate)(filename, tp->th_opcode);
+ if (ecode) {
+@@ -459,17 +467,25 @@
+
+ /* Rule 2:
+ */
+- if (tftpRootDirectory != 0 && IS_ROOTED(filename)) {
++ if ((tftpRootDirectory != 0 && IS_ROOTED(filename)) ||
++ (tftpDefaultDirectory != 0 && IS_ROOTED(filename))) {
+ char _tmp[1024];
++ char* realRootDir;
+ int maxPath;
+ int rootLen;
+
+- rootLen = strlen (tftpRootDirectory);
++ if (tftpRootDirectory != 0 ) {
++ realRootDir = tftpRootDirectory;
++ }
++ else {
++ realRootDir = tftpDefaultDirectory;
++ }
++
++ rootLen = strlen (realRootDir);
+
+ /* make sure the pathname doesn't already contain
+ * the virtual root.
+ */
+- if (strncmp(filename,tftpRootDirectory,rootLen) != 0) {
+
+ /* Insure our temporary space is big enough */
+ maxPath = ((sizeof _tmp) - 1) - rootLen;
+@@ -481,6 +497,8 @@
+ return EACCESS;
+ }
+
++ if (strncmp(filename,realRootDir,rootLen) != 0) {
++
+ /* Squeeze out any '.' or '..' components */
+ strcpy (tmpPath, filename);
+ if (realPath (tmpPath, _tmp) < 0) {
+@@ -492,21 +510,54 @@
+ /* Create the full pathname, prefixed by the
+ * virtual root.
+ */
+- strcpy (tmpPath, tftpRootDirectory);
++ strcpy (tmpPath, realRootDir);
+ strcat (tmpPath, _tmp);
+ filename = tmpPath;
+ }
++ else {
++ /* Squeeze out any '.' or '..' components */
++ strcpy (tmpPath, filename);
++ if (realPath (tmpPath, _tmp) < 0) {
++ if (tftpDebugLevel > 1)
++ syslog (LOG_DEBUG, "realPath fails");
++ return EACCESS;
++ }
++ /* Create the full pathname */
++ strcpy (tmpPath,_tmp);
++ filename = tmpPath;
++ if (strncmp(filename,realRootDir,rootLen) != 0) {
++ if (tftpDebugLevel > 1) {
++ syslog(LOG_DEBUG, "file=%s; invalid access denied", filename);
++ return EACCESS;
++ }
++ }
++ }
+ }
+
+ /* Rule 3:
+ */
+- if (!IS_ROOTED(filename) && tftpDefaultDirectory == 0) {
+- strcpy (tmpPath, tftpRootDirectory);
+- strcat (tmpPath, "/");
++ if ((!IS_ROOTED(filename) && tftpRootDirectory != 0) ||
++ (!IS_ROOTED(filename) && tftpDefaultDirectory != 0)) {
++ char _tmp[1024];
+ strcat (tmpPath, filename);
++ /* Squeeze out any '.' or '..' components */
++ strcpy (tmpPath, filename);
++ if (realPath (tmpPath, _tmp) < 0) {
++ if (tftpDebugLevel > 1)
++ syslog (LOG_DEBUG, "realPath fails");
++ return EACCESS;
++ }
++ if ( tftpDefaultDirectory == 0 ) {
++ strcpy (tmpPath, tftpRootDirectory);
++ }
++ else {
++ strcpy (tmpPath, tftpDefaultDirectory);
++ }
++ strcat (tmpPath, _tmp);
+ filename = tmpPath;
+ }
+
++
+ /* Check access lists */
+ /* Rules 4&5:
+ */
+@@ -593,7 +644,7 @@
+ /*
+ * Send the requested file.
+ */
+-sendfile(pf)
++tftpsendfile(pf)
+ struct formats *pf;
+ {
+ struct tftphdr *dp, *r_init();
+@@ -664,7 +715,7 @@
+ /*
+ * Receive a file.
+ */
+-recvfile(pf)
++tftprecvfile(pf)
+ struct formats *pf;
+ {
+ struct tftphdr *dp, *w_init();