diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-15 09:09:34 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-15 09:09:34 +0000 |
commit | daf807347e3ef9c60787b088d9a1b98a4f826d75 (patch) | |
tree | b9a8a07e2c05864623050eff9d25261d32f20796 /net/ftp | |
parent | a381f367a022c926d31e69e1eff6b6116da90c7e (diff) | |
download | chromium_src-daf807347e3ef9c60787b088d9a1b98a4f826d75.zip chromium_src-daf807347e3ef9c60787b088d9a1b98a4f826d75.tar.gz chromium_src-daf807347e3ef9c60787b088d9a1b98a4f826d75.tar.bz2 |
FTP: Fix an infinite loop in a rare condition.
After issuing the PASS command, we should never issue
earlier commands again. The code was sending USER when it
received "503 Bad command sequence" error code.
TEST=added to net_unittests
BUG=38707
Review URL: http://codereview.chromium.org/2094002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47364 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp')
-rw-r--r-- | net/ftp/ftp_network_transaction.cc | 17 | ||||
-rw-r--r-- | net/ftp/ftp_network_transaction_unittest.cc | 11 |
2 files changed, 15 insertions, 13 deletions
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index c939455..70ebde1 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -706,10 +706,9 @@ int FtpNetworkTransaction::ProcessResponseUSER( next_state_ = STATE_CTRL_WRITE_PASS; break; case ERROR_CLASS_TRANSIENT_ERROR: - if (response.status_code == 421) - return Stop(ERR_FAILED); - break; + return Stop(ERR_FAILED); case ERROR_CLASS_PERMANENT_ERROR: + response_.needs_auth = true; return Stop(ERR_FAILED); default: NOTREACHED(); @@ -739,18 +738,10 @@ int FtpNetworkTransaction::ProcessResponsePASS( next_state_ = STATE_CTRL_WRITE_ACCT; break; case ERROR_CLASS_TRANSIENT_ERROR: - if (response.status_code == 421) { - // TODO(ibrar): Retry here. - } return Stop(ERR_FAILED); case ERROR_CLASS_PERMANENT_ERROR: - if (response.status_code == 503) { - next_state_ = STATE_CTRL_WRITE_USER; - } else { - response_.needs_auth = true; - return Stop(ERR_FAILED); - } - break; + response_.needs_auth = true; + return Stop(ERR_FAILED); default: NOTREACHED(); return Stop(ERR_UNEXPECTED); diff --git a/net/ftp/ftp_network_transaction_unittest.cc b/net/ftp/ftp_network_transaction_unittest.cc index 6b359a5..1a5ed53 100644 --- a/net/ftp/ftp_network_transaction_unittest.cc +++ b/net/ftp/ftp_network_transaction_unittest.cc @@ -1209,6 +1209,17 @@ TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailPass) { ERR_FAILED); } +// Regression test for http://crbug.com/38707. +TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailPass503) { + FtpSocketDataProviderDirectoryListing ctrl_socket; + TransactionFailHelper(&ctrl_socket, + "ftp://host", + FtpSocketDataProvider::PRE_PASSWD, + FtpSocketDataProvider::PRE_QUIT, + "503 Bad sequence of commands\r\n", + ERR_FAILED); +} + TEST_F(FtpNetworkTransactionTest, DirectoryTransactionFailSyst) { FtpSocketDataProviderDirectoryListing ctrl_socket; TransactionFailHelper(&ctrl_socket, |