Subject: | Net::FTP pasv_wait() not handling errors from Net::Cmd reponse() |
The response() method in Net::Cmd calls its getline() method to read
lines from the command socket. In case something goes wrong with that
read, getline() returns undef (e.g. due to "Unexpected EOF on command
channel"). When this happens the response() method will explicitly
return CMD_ERROR (the value 5). In Net::FTP pasv_wait() the return
values from $ftp->response() and $non_pasv->response() are not checked
at all, which can cause pasv_wait() to indicate success even though you
got an "Unexpected EOF on command channel" error when trying to read the
response.
Suggested patch is to check the return values of the response() calls
against CMD_OK. If that equality check fails, return undef from
pasv_wait, which will cause pasv_xfer to return undef indicating that
something wasn't right.
A somewhat related issue is the fact that the error returned by Net::Cmd
response() in these cases is not the same thing as what the status() or
code() methods would return in a subsequent call. This could of course
be by design, but it does prevent people from doing a reasonable
workaround for the above issues with pasv_xfer()/pasv_wait().
Seems like an easy fix, and I don't really see any potential issues that
would arise from doing it.