Skip to content

Commit

Permalink
Prevent wpa_supplicant.conf from being downloaded
Browse files Browse the repository at this point in the history
To be tested
  • Loading branch information
probonopd committed Nov 16, 2024
1 parent f8a5ee5 commit decd737
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/net/ftpworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,13 @@ bool CFTPWorker::Retrieve(const char* pArgs)
FIL File;
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)
{
SendStatus(TFTPStatus::FileActionNotTaken, "Could not open file for reading.");
Expand Down Expand Up @@ -986,10 +993,10 @@ bool CFTPWorker::ListFileNames(const char* pArgs)
const TDirectoryListEntry& Entry = pDirEntries[i];
if (Entry.Type == TDirectoryListEntryType::Directory)
continue;
/*if (Entry.Name == "wpa_supplicant.conf")
if (strcmp(Entry.Name, "wpa_supplicant.conf") == 0)
{
continue;
}*/
}
const int nLength = snprintf(Buffer, sizeof(Buffer), "%s\r\n", Entry.Name);
if (pDataSocket->Send(Buffer, nLength, 0) < 0)
{
Expand Down

0 comments on commit decd737

Please sign in to comment.