summaryrefslogtreecommitdiff
path: root/net/yale-tftpd/patches/patch-ad
diff options
context:
space:
mode:
Diffstat (limited to 'net/yale-tftpd/patches/patch-ad')
-rw-r--r--net/yale-tftpd/patches/patch-ad40
1 files changed, 25 insertions, 15 deletions
diff --git a/net/yale-tftpd/patches/patch-ad b/net/yale-tftpd/patches/patch-ad
index 64de776271e..0e2875c3430 100644
--- a/net/yale-tftpd/patches/patch-ad
+++ b/net/yale-tftpd/patches/patch-ad
@@ -1,12 +1,13 @@
-$NetBSD: patch-ad,v 1.3 2005/12/18 18:37:16 joerg Exp $
+$NetBSD: patch-ad,v 1.4 2006/03/14 14:11:53 he Exp $
---- tftpd.c.orig 1995-03-20 20:14:39.000000000 +0000
+--- tftpd.c.orig 1995-03-20 21:14:39.000000000 +0100
+++ tftpd.c
-@@ -56,17 +56,18 @@ static char sccsid[] = "@(#)tftpd.c 5.12
+@@ -56,17 +56,19 @@ static char sccsid[] = "@(#)tftpd.c 5.12
#include <syslog.h>
#include <string.h>
+#include <unistd.h>
++#include <fcntl.h>
+
#define TIMEOUT 5
@@ -25,7 +26,7 @@ $NetBSD: patch-ad,v 1.3 2005/12/18 18:37:16 joerg Exp $
struct sockaddr_in from;
int fromlen;
-@@ -105,6 +106,8 @@ char **argv;
+@@ -105,6 +107,8 @@ char **argv;
if (argc > 1 && strcmp (argv[1], "-d") == 0) {
setUpForDebugging();
@@ -34,7 +35,7 @@ $NetBSD: patch-ad,v 1.3 2005/12/18 18:37:16 joerg Exp $
}
if (ioctl(0, FIONBIO, &on) < 0) {
syslog(LOG_ERR, "ioctl(FIONBIO): %m\n");
-@@ -202,7 +205,7 @@ setUpForDebugging()
+@@ -202,7 +206,7 @@ setUpForDebugging()
awaitInput(chan)
int chan;
{
@@ -43,7 +44,7 @@ $NetBSD: patch-ad,v 1.3 2005/12/18 18:37:16 joerg Exp $
int nready;
struct timeval tv;
extern int maxInputWait;
-@@ -212,8 +215,9 @@ int chan;
+@@ -212,8 +216,9 @@ int chan;
else
tv.tv_sec = 5*60; /* default: wait for 5 minutes */
tv.tv_usec = 0;
@@ -55,7 +56,7 @@ $NetBSD: patch-ad,v 1.3 2005/12/18 18:37:16 joerg Exp $
return nready;
}
-@@ -294,7 +298,10 @@ int n;
+@@ -294,7 +299,10 @@ int n;
}
int validate_access();
@@ -67,7 +68,7 @@ $NetBSD: patch-ad,v 1.3 2005/12/18 18:37:16 joerg Exp $
struct formats {
char *f_mode;
-@@ -303,8 +310,8 @@ struct formats {
+@@ -303,8 +311,8 @@ struct formats {
int (*f_recv)();
int f_convert;
} formats[] = {
@@ -78,7 +79,7 @@ $NetBSD: patch-ad,v 1.3 2005/12/18 18:37:16 joerg Exp $
#ifdef notdef
{ "mail", validate_user, sendmail, recvmail, 1 },
#endif
-@@ -355,13 +362,13 @@ again:
+@@ -355,13 +363,13 @@ again:
exit(1);
}
if (tftpDebugLevel > 0) {
@@ -95,7 +96,7 @@ $NetBSD: patch-ad,v 1.3 2005/12/18 18:37:16 joerg Exp $
}
ecode = (*pf->f_validate)(filename, tp->th_opcode);
if (ecode) {
-@@ -459,17 +466,25 @@ validate_access(filename, mode)
+@@ -459,17 +467,25 @@ validate_access(filename, mode)
/* Rule 2:
*/
@@ -124,7 +125,7 @@ $NetBSD: patch-ad,v 1.3 2005/12/18 18:37:16 joerg Exp $
/* Insure our temporary space is big enough */
maxPath = ((sizeof _tmp) - 1) - rootLen;
-@@ -481,6 +496,8 @@ validate_access(filename, mode)
+@@ -481,6 +497,8 @@ validate_access(filename, mode)
return EACCESS;
}
@@ -133,7 +134,7 @@ $NetBSD: patch-ad,v 1.3 2005/12/18 18:37:16 joerg Exp $
/* Squeeze out any '.' or '..' components */
strcpy (tmpPath, filename);
if (realPath (tmpPath, _tmp) < 0) {
-@@ -492,21 +509,54 @@ validate_access(filename, mode)
+@@ -492,21 +510,54 @@ validate_access(filename, mode)
/* Create the full pathname, prefixed by the
* virtual root.
*/
@@ -192,7 +193,16 @@ $NetBSD: patch-ad,v 1.3 2005/12/18 18:37:16 joerg Exp $
/* Check access lists */
/* Rules 4&5:
*/
-@@ -593,7 +643,7 @@ void timer()
+@@ -565,7 +616,7 @@ validate_access(filename, mode)
+ * This will be done with the effective permissions of the TFTPD
+ * process.
+ */
+- fd = open(filename, mode == RRQ ? 0 : 1);
++ fd = open(filename, mode == RRQ ? (O_RDONLY) : (O_WRONLY|O_TRUNC));
+ if (fd < 0) {
+ syslog (LOG_DEBUG, "open fails; errno = %d", errno);
+ return errno+100;
+@@ -593,7 +644,7 @@ void timer()
/*
* Send the requested file.
*/
@@ -201,7 +211,7 @@ $NetBSD: patch-ad,v 1.3 2005/12/18 18:37:16 joerg Exp $
struct formats *pf;
{
struct tftphdr *dp, *r_init();
-@@ -664,7 +714,7 @@ void justquit()
+@@ -664,7 +715,7 @@ void justquit()
/*
* Receive a file.
*/
@@ -210,7 +220,7 @@ $NetBSD: patch-ad,v 1.3 2005/12/18 18:37:16 joerg Exp $
struct formats *pf;
{
struct tftphdr *dp, *w_init();
-@@ -688,7 +738,7 @@ send_ack:
+@@ -688,7 +739,7 @@ send_ack:
write_behind(file, pf->f_convert);
for ( ; ; ) {
alarm(rexmtval);