summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2006-10-13 19:13:18 (UTC)
committer Michael Krelin <hacker@klever.net>2006-10-13 19:13:18 (UTC)
commit325e7fc43721df3efaa8539190fada6e6e3aa8fa (patch) (side-by-side diff)
treeec03bf74e17eb497e0fcd31b521192b0b14bd83e
parent577427e68ef10a4d2b75d28e42b22952ae3bcf23 (diff)
downloadpumpkin-325e7fc43721df3efaa8539190fada6e6e3aa8fa.zip
pumpkin-325e7fc43721df3efaa8539190fada6e6e3aa8fa.tar.gz
pumpkin-325e7fc43721df3efaa8539190fada6e6e3aa8fa.tar.bz2
Enabled logging of outgoing errors, added reject with explicit error message
when file is too large for the block size set. git-svn-id: http://svn.klever.net/kin/pumpkin/trunk@192 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--PumpKINDlg.cpp7
-rw-r--r--pumpkin.rc5
-rw-r--r--resource.h2
3 files changed, 10 insertions, 4 deletions
diff --git a/PumpKINDlg.cpp b/PumpKINDlg.cpp
index 2a01918..bb15211 100644
--- a/PumpKINDlg.cpp
+++ b/PumpKINDlg.cpp
@@ -775,12 +775,17 @@ CFileException e;
if(m__timeOut){
m_timeOut=m__timeOut;
v.Format("%u",m_timeOut);
o[tftpoTOut]=v;
}
}
+ // XXX: see if we can enforce our preference regarding block size here.
+ if(m_xferSize >= (m_blkSize<<16)) {
+ Deny(tftp::errUndefined,IDS_TFTP_ERROR_TOOBIG);
+ return TRUE;
+ }
state = stateXfer;
m_ACK=0;
if(o.GetCount()){
tftp *p = tftp::Allocate(tftp::tftpOACK::tftpSize(&o));
ASSERT(p);
p->SetOpcode(tftp::opOACK);
@@ -875,17 +880,15 @@ void CXferSocket::Deny(CFileException* e)
void CXferSocket::PostError(UINT errCode,UINT errID)
{
CString msg;
msg.LoadString(errID);
ASSERT(m_Daddy);
-/* // ***
CString tmp;
tmp.Format(IDS_LOG_SENTTFTPERROR,errCode,(LPCTSTR)msg);
m_Daddy->LogLine(tmp);
- */
tftp* err = tftp::Allocate(tftp::tftpERROR::tftpSize(msg));
err->SetOpcode(tftp::opERROR);
err->errSet(errCode,msg);
PostTFTP(err);
}
diff --git a/pumpkin.rc b/pumpkin.rc
index 5ce2438..adca112 100644
--- a/pumpkin.rc
+++ b/pumpkin.rc
@@ -94,13 +94,13 @@ BEGIN
END
IDD_PUMPKIN_DIALOG DIALOGEX 0, 0, 362, 193
STYLE DS_3DLOOK | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_ACCEPTFILES | WS_EX_APPWINDOW
CAPTION " PumpKIN"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "List1",IDC_CONNECTIONS,"SysListView32",LVS_REPORT |
LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,7,295,108,
WS_EX_DLGMODALFRAME
PUSHBUTTON "&Get File",IDC_GET,305,7,50,17,BS_NOTIFY,
WS_EX_CLIENTEDGE
@@ -559,13 +559,13 @@ BEGIN
IDS_LOG_LISTENOPCODE "Invalid opcode in initial connection request"
IDS_LOG_XFERUDPSEND "UDP packet send failed"
IDS_LOG_XFERRECEIVE "Error on xfer socket"
IDS_LOG_XFERSEND "Error on xfer socket"
IDS_LOG_XFERUDPRECEIVE "UDP packet receive failed"
IDS_LOG_XFERSOURCETID "Packet from unexpected source"
- IDS_LOG_SENTTFTPERROR ":%u: %s"
+ IDS_LOG_SENTTFTPERROR ">> %u: %s"
IDS_LOG_GOTTFTPERROR "TFTP:%u: %s"
IDS_LOG_XFEROPCODE "Invalid opcode (%u) during transfer received"
IDS_LOG_XFERRRQFINISHED "Transfer of '%s' has successfully completed"
IDS_TITLE_OPTIONS "Options"
IDS_LOG_WRQSERVE "Writing of '%s' of type '%s' is requested by %s"
IDS_TFTP_ERROR_FAILEDTORENAME "Too many clones of the file"
@@ -653,12 +653,13 @@ BEGIN
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_INVALID_RULE "Invalid access rule."
IDS_LOG_LOGERROR "Error logging to '%s'"
+ IDS_TFTP_ERROR_TOOBIG "File is too big, try increasing block size"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/resource.h b/resource.h
index 1bdce59..7961e5e 100644
--- a/resource.h
+++ b/resource.h
@@ -85,12 +85,14 @@
#define IDS_BOX_CANTBIND 156
#define IDS_NO_XFER_OP 157
#define IDS_INVALID_IP 158
#define IDS_INVALID_NETMASK 159
#define IDS_INVALID_RULE 160
#define IDS_LOG_LOGERROR 161
+#define IDS_TFTP_ERROR_TOOBIG 162
+#define IDS_LOG_DENYING 163
#define IDC_KLEVERNET 1000
#define IDC_CONNECTIONS 1001
#define IDC_LOG 1003
#define IDC_GET 1004
#define IDC_PUT 1005
#define IDC_ABORT 1006