Netascii mode of this tftp server
Issue #24
new
As RFC1350 and RFC764 have specified, when a byte stream is sent under tftp netascii mode, a single LF without preceding CR should be converted to CR/LF and a single CR without following LF should be replaced with CR NUL. Of course, the recieving side is responsible to restore the byte stream to its original format.
But look at this code snippet from the TftpSendFile
function of the source file tftp_thread.c
:
Rc = ReadFile (pTftp->r.hFile, tp->th_data, pTftp->s.dwPacketSize, & pTftp->c.dwBytes, NULL) ;
if (! Rc)
return TftpSysError (pTftp, EUNDEF, "ReadFile");
if (pTftp->m.bInit && pTftp->c.nRetries==0) MD5Update (& pTftp->m.ctx, tp->th_data, pTftp->c.dwBytes);
tp->th_opcode = htons (TFTP_DATA);
tp->th_block = htons ( (unsigned short) pTftp->c.nLastToSend );
DoDebugSendBlock (pTftp); // empty ifndef DEBUG
#ifdef TEST_DROPP
if (pTftp->c.nRetries<3 && pTftp->c.nCount==4)
{ LOG (1, "dropping 4th packet"), Rc=pTftp->c.dwBytes + TFTP_DATA_HEADERSIZE; }
else
#endif
Rc = send (pTftp->r.skt, pTftp->b.buf, pTftp->c.dwBytes + TFTP_DATA_HEADERSIZE, 0);
Nothing have been done to the data before it's sent out.