summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2006-10-13 20:52:05 (UTC)
committer Michael Krelin <hacker@klever.net>2006-10-13 20:52:05 (UTC)
commitc47fbc86d50a0199fe9000a7df07609bb0a3bc77 (patch) (unidiff)
tree87da1735014b97ce01ac754adc5843ecde33cd97
parent325e7fc43721df3efaa8539190fada6e6e3aa8fa (diff)
downloadpumpkin-c47fbc86d50a0199fe9000a7df07609bb0a3bc77.zip
pumpkin-c47fbc86d50a0199fe9000a7df07609bb0a3bc77.tar.gz
pumpkin-c47fbc86d50a0199fe9000a7df07609bb0a3bc77.tar.bz2
Increased default blocksize and added reject with explicit error message for
WRQ request in case I can see the file is too big for us. git-svn-id: http://svn.klever.net/kin/pumpkin/trunk@193 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--PumpKINDlg.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/PumpKINDlg.cpp b/PumpKINDlg.cpp
index bb15211..f41b69f 100644
--- a/PumpKINDlg.cpp
+++ b/PumpKINDlg.cpp
@@ -93,13 +93,13 @@ CPumpKINDlg::CPumpKINDlg(CWnd* pParent /*=NULL*/)
93 m_RetryTimeOut = CTimeSpan(0,0,0,10); 93 m_RetryTimeOut = CTimeSpan(0,0,0,10);
94 m_LogLength = 100; 94 m_LogLength = 100;
95 m_SpeakPort = 69; 95 m_SpeakPort = 69;
96 m_PromptTimeOut=30; 96 m_PromptTimeOut=30;
97 m_bShown=TRUE; 97 m_bShown=TRUE;
98 m_bExiting=FALSE; 98 m_bExiting=FALSE;
99 m_BlockSize=1024; 99 m_BlockSize=2048;
100 m_bnw.AssignSound("(bang)",IDR_WAVE_RING,CBellsNWhistles::CBang::bangResource); 100 m_bnw.AssignSound("(bang)",IDR_WAVE_RING,CBellsNWhistles::CBang::bangResource);
101 m_bnw.AssignSound("(done)",IDR_WAVE_FINISHED,CBellsNWhistles::CBang::bangResource); 101 m_bnw.AssignSound("(done)",IDR_WAVE_FINISHED,CBellsNWhistles::CBang::bangResource);
102 m_bnw.AssignSound("(oops)",IDR_WAVE_ABORTED,CBellsNWhistles::CBang::bangResource); 102 m_bnw.AssignSound("(oops)",IDR_WAVE_ABORTED,CBellsNWhistles::CBang::bangResource);
103 m_bnw.AssignSound("(none)",(int)0,CBellsNWhistles::CBang::bangNone); 103 m_bnw.AssignSound("(none)",(int)0,CBellsNWhistles::CBang::bangNone);
104 m_bnwRequest="(bang)"; m_bnwSuccess="(done)"; 104 m_bnwRequest="(bang)"; m_bnwSuccess="(done)";
105 m_bnwAbort="(oops)"; 105 m_bnwAbort="(oops)";
@@ -1030,12 +1030,16 @@ BOOL CWRQSocket::OnTFTP(tftp* p)
1030 return TRUE; 1030 return TRUE;
1031 } 1031 }
1032 } 1032 }
1033 if(o.Lookup(tftpoTSize,v)){ 1033 if(o.Lookup(tftpoTSize,v)){
1034 m_xferSize=atoi(v); 1034 m_xferSize=atoi(v);
1035 } 1035 }
1036 if(m_xferSize>=0 && m_xferSize>=(m_blkSize<<16)) {
1037 Deny(tftp::errUndefined,IDS_TFTP_ERROR_TOOBIG);
1038 return TRUE;
1039 }
1036 } 1040 }
1037 UpdateList(); 1041 UpdateList();
1038 DoXfer(); 1042 DoXfer();
1039 } 1043 }
1040 break; 1044 break;
1041 case tftp::opDATA: 1045 case tftp::opDATA:
@@ -1406,12 +1410,17 @@ tftp::tftpOptions oack;
1406 if(m_Options.Lookup(tftpoXResume,v) && m_bResume){ 1410 if(m_Options.Lookup(tftpoXResume,v) && m_bResume){
1407 m_ACK=m_File.GetLength()/m_blkSize; 1411 m_ACK=m_File.GetLength()/m_blkSize;
1408 v.Format("%u",m_ACK); 1412 v.Format("%u",m_ACK);
1409 oack[tftpoXResume]=v; 1413 oack[tftpoXResume]=v;
1410 }else 1414 }else
1411 m_ACK=0; 1415 m_ACK=0;
1416 // XXX: see if we can negotiate the right block size somehow
1417 if(m_xferSize>=0 && m_xferSize>=(m_blkSize<<16)) {
1418 Deny(tftp::errUndefined,IDS_TFTP_ERROR_TOOBIG);
1419 return TRUE;
1420 }
1412 state=stateXfer; 1421 state=stateXfer;
1413 if(oack.GetCount()){ 1422 if(oack.GetCount()){
1414 tftp *p = tftp::Allocate(tftp::tftpOACK::tftpSize(&oack)); 1423 tftp *p = tftp::Allocate(tftp::tftpOACK::tftpSize(&oack));
1415 ASSERT(p); 1424 ASSERT(p);
1416 p->SetOpcode(tftp::opOACK); 1425 p->SetOpcode(tftp::opOACK);
1417 p->data.m_OACK.Set(&oack); 1426 p->data.m_OACK.Set(&oack);