When opening a file for write, truncate it as well.

Bump package revision to 4.
This commit is contained in:
he 2006-03-14 14:11:53 +00:00
parent 27b1dd9a85
commit fdc80d6c22
3 changed files with 29 additions and 19 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.13 2006/03/04 21:30:26 jlam Exp $
# $NetBSD: Makefile,v 1.14 2006/03/14 14:11:53 he Exp $
DISTNAME= yale-tftpd-3.0
PKGREVISION= 3
PKGREVISION= 4
CATEGORIES= net
MASTER_SITES= ftp://ftp.cert.dfn.de/pub/tools/net/yale-tftpd/

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.7 2005/12/18 18:37:16 joerg Exp $
$NetBSD: distinfo,v 1.8 2006/03/14 14:11:53 he Exp $
SHA1 (yale-tftpd-3.0.tar.gz) = 5f87e3d37feb5c5c8b7f2db34a0c87ee537727af
RMD160 (yale-tftpd-3.0.tar.gz) = 207b88c4383b283e3c0d81a50061a65513031854
@ -6,7 +6,7 @@ Size (yale-tftpd-3.0.tar.gz) = 33469 bytes
SHA1 (patch-aa) = e6e9b368db8f70bdb4fbb2a1b032bd4ce66206f2
SHA1 (patch-ab) = e6eb66ed95139b47ee1df07014a636803e89ad47
SHA1 (patch-ac) = bd44bf8d19079e1a74850dbcc8cfea3d82f36c3e
SHA1 (patch-ad) = 50f41566a0f985719a54c9f3d96d48b69ab1fa2d
SHA1 (patch-ad) = 04a3a46c795618a996207dcf64af5e1bdf41042e
SHA1 (patch-ae) = 61ae35f5e8d5d8f3cd60ba515a925a4098628fb1
SHA1 (patch-af) = 028ffa7fb05d3961d4cedd979e5ea130f19f7489
SHA1 (patch-ag) = 7e14bea74c2d94222cc5f13b03b7735fbe442487

View file

@ -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);