Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FTP/550 (ENODEV) for clients using "LIST -a" #66

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions source/ftpSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1230,26 +1230,27 @@ void FtpSession::xferDir (char const *const args_, XferDirMode const mode_, bool
if (std::strlen (args_) > 0)
{
// an argument was provided
auto const path = buildResolvedPath (m_cwd, args_);
if (path.empty ())

// work around broken clients that think LIST -a/-l is valid
if (workaround_)
{
// work around broken clients that think LIST -a/-l is valid
if (workaround_)
if (args_[0] == '-' && (args_[1] == 'a' || args_[1] == 'l'))
{
if (args_[0] == '-' && (args_[1] == 'a' || args_[1] == 'l'))
char const *args = &args_[2];
if (*args == '\0' || *args == ' ')
{
char const *args = &args_[2];
if (*args == '\0' || *args == ' ')
{
if (*args == ' ')
++args;
if (*args == ' ')
++args;

xferDir (args, mode_, false);
return;
}
xferDir (args, mode_, false);
return;
}
}
}

auto const path = buildResolvedPath (m_cwd, args_);
if (path.empty ())
{
sendResponse ("550 %s\r\n", std::strerror (errno));
setState (State::COMMAND, true, true);
return;
Expand Down