[syslinux] truncated files on write with tftpd-hpa
H. Peter Anvin
hpa at zytor.com
Thu May 1 23:31:35 PDT 2003
Alan Sundell wrote:
> On Thu, 1 May 2003, H. Peter Anvin wrote:
>
>>The "connection refused" is probably the best bet for solving this,
>>since the natural mutex is the kernel lock on the port number. This
>>would mean we shouldn't open the file until we have connect()ed, which
>>is probably correct anyway; if nothing else we still need to send back
>>the error code, so we need to connect() no matter what.
>
>
> Yeah, one face of the problem, as I see it, is that tftpd is writing to
> the file (with the O_TRUNC) before the data transfer is really started.
>
> However, if I'm reading the code right, the open() happens well after
> the connect(). tftp() is called after connect() in main(), and it's
> tftp() that calls validate_access(), which does the truncating.
>
> The way I read it, we're getting the "connection refused" from
> recv_time() all the way down in tftp_recvfile() on line 1288 of tftpd.c,
> in response to the ACK sent with the send() on line 1282.
>
This is bizarre. Do you have an strace -f -tt ?
-hpa
More information about the Syslinux
mailing list