summaryrefslogtreecommitdiffabout
path: root/PumpKINDlg.cpp
Unidiff
Diffstat (limited to 'PumpKINDlg.cpp') (more/less context) (show whitespace changes)
-rw-r--r--PumpKINDlg.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/PumpKINDlg.cpp b/PumpKINDlg.cpp
index 1e6d03f..0b3bf41 100644
--- a/PumpKINDlg.cpp
+++ b/PumpKINDlg.cpp
@@ -1197,51 +1197,55 @@ CConfirmRRQDlg cd(NULL);
1197 cd.m_Daddy=this; 1197 cd.m_Daddy=this;
1198 cd.m_File=m_FileName; 1198 cd.m_File=m_FileName;
1199 cd.m_Host=inet_ntoa(m_Peer.sin_addr); 1199 cd.m_Host=inet_ntoa(m_Peer.sin_addr);
1200 if(cd.DoModal()==IDOK) 1200 if(cd.DoModal()==IDOK)
1201 return TRUE; 1201 return TRUE;
1202 return FALSE; 1202 return FALSE;
1203} 1203}
1204 1204
1205CWRQSocket::CWRQSocket(CPumpKINDlg* daddy,LPCTSTR fileName,LPCTSTR type,SOCKADDR_IN *sin) 1205CWRQSocket::CWRQSocket(CPumpKINDlg* daddy,LPCTSTR fileName,LPCTSTR type,SOCKADDR_IN *sin)
1206 : CXferSocket(daddy,fileName,type,sin) 1206 : CXferSocket(daddy,fileName,type,sin)
1207{ 1207{
1208 state=stateNone; 1208 state=stateNone;
1209 m_ACK=0; 1209 m_ACK=0;
1210 m_LastSlack=0; 1210 m_LastSlack=0;
1211 m_bResume=FALSE; 1211 m_bResume=FALSE;
1212} 1212}
1213 1213
1214BOOL CWRQSocket::Create(LPCTSTR localFile,LPCTSTR hostName) 1214BOOL CWRQSocket::Create(LPCTSTR localFile,LPCTSTR hostName)
1215{ 1215{
1216 if(!CAsyncSocket::Create(0,SOCK_DGRAM)) 1216 if(!CAsyncSocket::Create(0,SOCK_DGRAM))
1217 return FALSE; 1217 return FALSE;
1218 ASSERT(m_Daddy); 1218 ASSERT(m_Daddy);
1219 ASSERT(m_Peer.sin_addr.s_addr!=INADDR_NONE || hostName); 1219 ASSERT(m_Peer.sin_addr.s_addr!=INADDR_NONE || hostName);
1220 m_Daddy->m_Xfers[m_hSocket]=this; 1220 m_Daddy->m_Xfers[m_hSocket]=this;
1221 TurnSlashes(m_FileName,TRUE);
1222 UpdateList(); 1221 UpdateList();
1223CString fn = localFile?ApplyRootGently(localFile):ApplyRoot(m_FileName); 1222CString lf;
1223 if(!localFile) {
1224 lf = m_FileName;
1225 TurnSlashes(lf,TRUE);
1226 }
1227CString fn = localFile?ApplyRootGently(localFile):ApplyRoot(lf);
1224 if(!localFile){// This is an incoming request.. 1228 if(!localFile){// This is an incoming request..
1225 if(CheckBadRelativeness(m_FileName)){ 1229 if(CheckBadRelativeness(m_FileName)){
1226 Deny(tftp::errAccessViolation,IDS_TFTP_ERROR_ACCESS); 1230 Deny(tftp::errAccessViolation,IDS_TFTP_ERROR_ACCESS);
1227 return TRUE; 1231 return TRUE;
1228 } 1232 }
1229 BOOL exists; 1233 BOOL exists;
1230 if(!_access((LPCTSTR)fn,0)) 1234 if(!_access((LPCTSTR)fn,0))
1231 m_Rename=exists=TRUE; 1235 m_Rename=exists=TRUE;
1232 else 1236 else
1233 m_Rename=exists=FALSE; 1237 m_Rename=exists=FALSE;
1234 // *** m_WRQMode only if server transfer 1238 // *** m_WRQMode only if server transfer
1235 switch(m_Daddy->m_WRQMode){ 1239 switch(m_Daddy->m_WRQMode){
1236 case CPumpKINDlg::wrqTakeAll: 1240 case CPumpKINDlg::wrqTakeAll:
1237 if(exists){ 1241 if(exists){
1238 if(!RenameFile(fn)){ 1242 if(!RenameFile(fn)){
1239 Deny(tftp::errDiskFull,IDS_TFTP_ERROR_FAILEDTORENAME); 1243 Deny(tftp::errDiskFull,IDS_TFTP_ERROR_FAILEDTORENAME);
1240 return TRUE; 1244 return TRUE;
1241 } 1245 }
1242 } 1246 }
1243 break; 1247 break;
1244 case CPumpKINDlg::wrqConfirmIfExists: 1248 case CPumpKINDlg::wrqConfirmIfExists:
1245 if(!exists) 1249 if(!exists)
1246 break; 1250 break;
1247 case CPumpKINDlg::wrqAlwaysConfirm: 1251 case CPumpKINDlg::wrqAlwaysConfirm: