diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2013-08-13 12:39:03 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2013-08-13 12:39:03 +0000 |
commit | c121604a5734ac41552ab46a8ab75345be99036e (patch) | |
tree | d5d2aa78e5fb0952a86ac62767a667a13fb7febf /usr.sbin/tftpd | |
parent | d76fb2ab61697e87cf28b0c807b8b8aa8a7f6875 (diff) |
when handling puts from a client (ie, tftpd is writing a file to
disk), we maintain the client state after we've finished writing
the file in case the client loses our ack of the last write.
unfortunately we didnt close the file we'd just written when we
knew it was finished, but only after we clean up the client state
after that wait.
because we use FILE stuff to write the file out, its likely some
io flushed to disk until we finish that wait and close the file as
part of cleaning up the client state. if something is coordinating
a bunch of uploads and expects the file to be there after the client
is happy its there, this can be "not good".
this closes the file after we know its finished before proceeding
to hang to handle lost acks to the client.
found by and ok henning@
Diffstat (limited to 'usr.sbin/tftpd')
-rw-r--r-- | usr.sbin/tftpd/tftpd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/tftpd/tftpd.c b/usr.sbin/tftpd/tftpd.c index 9e41d81cd75..e210be15030 100644 --- a/usr.sbin/tftpd/tftpd.c +++ b/usr.sbin/tftpd/tftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tftpd.c,v 1.15 2013/06/01 21:06:39 deraadt Exp $ */ +/* $OpenBSD: tftpd.c,v 1.16 2013/08/13 12:39:02 dlg Exp $ */ /* * Copyright (c) 2012 David Gwynne <dlg@uq.edu.au> @@ -1274,6 +1274,8 @@ tftp_wrq(int fd, short events, void *arg) if (n < client->packet_size) { tftp_wrq_ack_packet(client); + fclose(client->file); + client->file = NULL; event_set(&client->sev, client->sock, EV_READ, tftp_wrq_end, client); event_add(&client->sev, &client->tv); |