summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhpa <hpa>2001-11-13 03:39:32 +0000
committerhpa <hpa>2001-11-13 03:39:32 +0000
commita58b9604c52694b252c73fffe5de951b0f821ea9 (patch)
tree25fdeb4fe44510e7fa38dd9986e2066baffc7459
parent480bee14e9fd94024d7977b0f0835eaf7d718f55 (diff)
downloadtftp-hpa-0.24.tar.gz
Even more changes to handle block number wrap correctly.tftp-hpa-0.24
Make the client officially supported. It's better than most things that are already out there.
-rw-r--r--CHANGES2
-rw-r--r--README5
-rw-r--r--tftp/tftp.c11
3 files changed, 9 insertions, 9 deletions
diff --git a/CHANGES b/CHANGES
index 3478559..2ae9114 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,8 @@ Changes in 0.24:
wraparound, usually manifesting themselves as failure to
handle files over 32 MB in size.
+ Officially make the client a part of the tftp-hpa project.
+
Changes in 0.23:
Correct memory overwrite bug in the tftp client when compiled
diff --git a/README b/README
index f57efe1..fc25395 100644
--- a/README
+++ b/README
@@ -23,8 +23,3 @@ installation instructions.
This software can be discussed on the SYSLINUX mailing list. To
subscribe, send a message containing the word "subscribe" in the body
to <syslinux-request@linux.kernel.org>.
-
-Please note that my main focus in this work is the tftpd
-server. Although a tftp client is included, it is by and large the
-stock OpenBSD version, with a small handful of portability
-improvements.
diff --git a/tftp/tftp.c b/tftp/tftp.c
index 279527b..fe8a88d 100644
--- a/tftp/tftp.c
+++ b/tftp/tftp.c
@@ -104,9 +104,10 @@ tftp_sendfile(int fd, char *name, char *mode)
struct tftphdr *ap; /* data and ack packets */
struct tftphdr *dp;
int n;
+ volatile int is_request;
volatile u_short block;
volatile int size, convert;
- volatile unsigned long amount;
+ volatile off_t amount;
struct sockaddr_in from;
int fromlen;
FILE *file;
@@ -117,13 +118,14 @@ tftp_sendfile(int fd, char *name, char *mode)
file = fdopen(fd, "r");
convert = !strcmp(mode, "netascii");
block = 0;
+ is_request = 1; /* First packet is the actual WRQ */
amount = 0;
bsd_signal(SIGALRM, timer);
do {
- if (block == 0)
+ if (is_request) {
size = makerequest(WRQ, name, dp, mode) - 4;
- else {
+ } else {
/* size = read(fd, dp->th_data, SEGSIZE); */
size = readit(file, &dp, convert);
if (size < 0) {
@@ -187,8 +189,9 @@ send_data:
}
}
}
- if (block > 0)
+ if ( !is_request )
amount += size;
+ is_request = 0;
block++;
} while (size == SEGSIZE || block == 1);
abort: