From 325e7fc43721df3efaa8539190fada6e6e3aa8fa Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Fri, 13 Oct 2006 19:13:18 +0000 Subject: 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 --- diff --git a/PumpKINDlg.cpp b/PumpKINDlg.cpp index 2a01918..bb15211 100644 --- a/PumpKINDlg.cpp +++ b/PumpKINDlg.cpp @@ -778,6 +778,11 @@ CFileException e; 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()){ @@ -878,11 +883,9 @@ 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); diff --git a/pumpkin.rc b/pumpkin.rc index 5ce2438..adca112 100644 --- a/pumpkin.rc +++ b/pumpkin.rc @@ -97,7 +97,7 @@ 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, @@ -562,7 +562,7 @@ BEGIN 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" @@ -656,6 +656,7 @@ 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 @@ -88,6 +88,8 @@ #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 -- cgit v0.9.0.2