Prevent wpa_supplicant.conf from being downloaded

To be tested
network
probonopd 1 week ago
parent f8a5ee590f
commit decd7375da
  1. 2
      circle-stdlib
  2. 11
      src/net/ftpworker.cpp

@ -1 +1 @@
Subproject commit 3bd135d35ac23c7c726924cb85b5890cbf80bbfe Subproject commit db053a32c165c1b22423a47ed6cb5bddc72b51f2

@ -617,6 +617,13 @@ bool CFTPWorker::Retrieve(const char* pArgs)
FIL File; FIL File;
CString Path = RealPath(pArgs); CString Path = RealPath(pArgs);
// If the filename is "wpa_supplicant.conf", don't allow it to be retrieved
if (strcmp(Path, "/wpa_supplicant.conf") == 0)
{
SendStatus(TFTPStatus::FileActionNotTaken, "File action not taken.");
return false;
}
if (f_open(&File, Path, FA_READ) != FR_OK) if (f_open(&File, Path, FA_READ) != FR_OK)
{ {
SendStatus(TFTPStatus::FileActionNotTaken, "Could not open file for reading."); SendStatus(TFTPStatus::FileActionNotTaken, "Could not open file for reading.");
@ -986,10 +993,10 @@ bool CFTPWorker::ListFileNames(const char* pArgs)
const TDirectoryListEntry& Entry = pDirEntries[i]; const TDirectoryListEntry& Entry = pDirEntries[i];
if (Entry.Type == TDirectoryListEntryType::Directory) if (Entry.Type == TDirectoryListEntryType::Directory)
continue; continue;
/*if (Entry.Name == "wpa_supplicant.conf") if (strcmp(Entry.Name, "wpa_supplicant.conf") == 0)
{ {
continue; continue;
}*/ }
const int nLength = snprintf(Buffer, sizeof(Buffer), "%s\r\n", Entry.Name); const int nLength = snprintf(Buffer, sizeof(Buffer), "%s\r\n", Entry.Name);
if (pDataSocket->Send(Buffer, nLength, 0) < 0) if (pDataSocket->Send(Buffer, nLength, 0) < 0)
{ {

Loading…
Cancel
Save