Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159461320
D38958.id118488.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D38958.id118488.diff
View Options
diff --git a/usr.bin/tftp/tftp.c b/usr.bin/tftp/tftp.c
--- a/usr.bin/tftp/tftp.c
+++ b/usr.bin/tftp/tftp.c
@@ -102,6 +102,7 @@
n = send_wrq(peer, name, mode);
if (n > 0) {
printf("Cannot send WRQ packet\n");
+ txrx_error = 1;
return;
}
@@ -131,10 +132,12 @@
}
if (i == 12) {
printf("Transfer timed out.\n");
+ txrx_error = 1;
return;
}
if (rp->th_opcode == ERROR) {
printf("Got ERROR, aborted\n");
+ txrx_error = 1;
return;
}
@@ -146,6 +149,7 @@
if (!options_rfc_enabled) {
printf("Got OACK while options are not enabled!\n");
send_error(peer, EBADOP);
+ txrx_error = 1;
return;
}
@@ -154,17 +158,17 @@
if (read_init(fd, NULL, mode) < 0) {
warn("read_init()");
+ txrx_error = 1;
return;
}
block = 1;
- tftp_send(peer, &block, &tftp_stats);
+ if (tftp_send(peer, &block, &tftp_stats) != 0)
+ txrx_error = 1;
read_close();
if (tftp_stats.amount > 0)
printstats("Sent", verbose, &tftp_stats);
-
- txrx_error = 1;
}
/*
@@ -202,6 +206,7 @@
n = send_rrq(peer, name, mode);
if (n > 0) {
printf("Cannot send RRQ packet\n");
+ txrx_error = 1;
return;
}
@@ -231,15 +236,18 @@
}
if (i == 12) {
printf("Transfer timed out.\n");
+ txrx_error = 1;
return;
}
if (rp->th_opcode == ERROR) {
tftp_log(LOG_ERR, "Error code %d: %s", rp->th_code, rp->th_msg);
+ txrx_error = 1;
return;
}
if (write_init(fd, NULL, mode) < 0) {
warn("write_init");
+ txrx_error = 1;
return;
}
@@ -251,6 +259,7 @@
if (!options_rfc_enabled) {
printf("Got OACK while options are not enabled!\n");
send_error(peer, EBADOP);
+ txrx_error = 1;
return;
}
@@ -259,13 +268,16 @@
n = send_ack(peer, 0);
if (n > 0) {
printf("Cannot send ACK on OACK.\n");
+ txrx_error = 1;
return;
}
block = 0;
- tftp_receive(peer, &block, &tftp_stats, NULL, 0);
+ if (tftp_receive(peer, &block, &tftp_stats, NULL, 0) != 0)
+ txrx_error = 1;
} else {
block = 1;
- tftp_receive(peer, &block, &tftp_stats, rp, n);
+ if (tftp_receive(peer, &block, &tftp_stats, rp, n) != 0)
+ txrx_error = 1;
}
if (tftp_stats.amount > 0)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jun 15, 11:04 AM (9 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33967701
Default Alt Text
D38958.id118488.diff (2 KB)
Attached To
Mode
D38958: tftp: Correctly propagate transfer errors.
Attached
Detach File
Event Timeline
Log In to Comment