-rw-r--r-- | PumpKINDlg.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/PumpKINDlg.cpp b/PumpKINDlg.cpp index 2a01918..bb15211 100644 --- a/PumpKINDlg.cpp +++ b/PumpKINDlg.cpp | |||
@@ -769,24 +769,29 @@ CFileException e; | |||
769 | if(m_Options.Lookup(tftpoTSize,v)){ | 769 | if(m_Options.Lookup(tftpoTSize,v)){ |
770 | v.Format("%lu",m_xferSize); | 770 | v.Format("%lu",m_xferSize); |
771 | o[tftpoTSize]=v; | 771 | o[tftpoTSize]=v; |
772 | } | 772 | } |
773 | if(m_Options.Lookup(tftpoTOut,v)){ | 773 | if(m_Options.Lookup(tftpoTOut,v)){ |
774 | m__timeOut=atoi(v); | 774 | m__timeOut=atoi(v); |
775 | if(m__timeOut){ | 775 | if(m__timeOut){ |
776 | m_timeOut=m__timeOut; | 776 | m_timeOut=m__timeOut; |
777 | v.Format("%u",m_timeOut); | 777 | v.Format("%u",m_timeOut); |
778 | o[tftpoTOut]=v; | 778 | o[tftpoTOut]=v; |
779 | } | 779 | } |
780 | } | 780 | } |
781 | // XXX: see if we can enforce our preference regarding block size here. | ||
782 | if(m_xferSize >= (m_blkSize<<16)) { | ||
783 | Deny(tftp::errUndefined,IDS_TFTP_ERROR_TOOBIG); | ||
784 | return TRUE; | ||
785 | } | ||
781 | state = stateXfer; | 786 | state = stateXfer; |
782 | m_ACK=0; | 787 | m_ACK=0; |
783 | if(o.GetCount()){ | 788 | if(o.GetCount()){ |
784 | tftp *p = tftp::Allocate(tftp::tftpOACK::tftpSize(&o)); | 789 | tftp *p = tftp::Allocate(tftp::tftpOACK::tftpSize(&o)); |
785 | ASSERT(p); | 790 | ASSERT(p); |
786 | p->SetOpcode(tftp::opOACK); | 791 | p->SetOpcode(tftp::opOACK); |
787 | p->data.m_OACK.Set(&o); | 792 | p->data.m_OACK.Set(&o); |
788 | PostTFTP(p,TRUE); | 793 | PostTFTP(p,TRUE); |
789 | }else | 794 | }else |
790 | DoXfer(); | 795 | DoXfer(); |
791 | } | 796 | } |
792 | return TRUE; | 797 | return TRUE; |
@@ -869,29 +874,27 @@ UINT tftp::tftpDATA::tftpSize(UINT blkSize) | |||
869 | 874 | ||
870 | void CXferSocket::Deny(CFileException* e) | 875 | void CXferSocket::Deny(CFileException* e) |
871 | { | 876 | { |
872 | PostError(e); | 877 | PostError(e); |
873 | state=stateDeny; | 878 | state=stateDeny; |
874 | } | 879 | } |
875 | 880 | ||
876 | void CXferSocket::PostError(UINT errCode,UINT errID) | 881 | void CXferSocket::PostError(UINT errCode,UINT errID) |
877 | { | 882 | { |
878 | CString msg; | 883 | CString msg; |
879 | msg.LoadString(errID); | 884 | msg.LoadString(errID); |
880 | ASSERT(m_Daddy); | 885 | ASSERT(m_Daddy); |
881 | /*// *** | ||
882 | CString tmp; | 886 | CString tmp; |
883 | tmp.Format(IDS_LOG_SENTTFTPERROR,errCode,(LPCTSTR)msg); | 887 | tmp.Format(IDS_LOG_SENTTFTPERROR,errCode,(LPCTSTR)msg); |
884 | m_Daddy->LogLine(tmp); | 888 | m_Daddy->LogLine(tmp); |
885 | */ | ||
886 | tftp* err = tftp::Allocate(tftp::tftpERROR::tftpSize(msg)); | 889 | tftp* err = tftp::Allocate(tftp::tftpERROR::tftpSize(msg)); |
887 | err->SetOpcode(tftp::opERROR); | 890 | err->SetOpcode(tftp::opERROR); |
888 | err->errSet(errCode,msg); | 891 | err->errSet(errCode,msg); |
889 | PostTFTP(err); | 892 | PostTFTP(err); |
890 | } | 893 | } |
891 | 894 | ||
892 | void CXferSocket::PostError(CFileException* e) | 895 | void CXferSocket::PostError(CFileException* e) |
893 | { | 896 | { |
894 | UINT eCode; | 897 | UINT eCode; |
895 | UINT eMsgID; | 898 | UINT eMsgID; |
896 | switch(e->m_cause){ | 899 | switch(e->m_cause){ |
897 | case CFileException::fileNotFound: | 900 | case CFileException::fileNotFound: |