summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-28 08:54:46 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-28 08:54:46 +0000
commit5974d563c4ec7176465b6e4257b410e960df15f0 (patch)
treeda757c4e1c7c3c65d867ac14593aebcd7e2d9414
parent38fbc92187626c3ee170688337f189b35d9d3bc3 (diff)
downloadchromium_src-5974d563c4ec7176465b6e4257b410e960df15f0.zip
chromium_src-5974d563c4ec7176465b6e4257b410e960df15f0.tar.gz
chromium_src-5974d563c4ec7176465b6e4257b410e960df15f0.tar.bz2
FTP: fix directory listing parser for ftp.symantec.com.
Some servers do not send the symlink target that we were expecting, possibly for security reasons. BUG=56972 TEST=net_unittests Review URL: http://codereview.chromium.org/3416028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60763 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/ftp/ftp_directory_listing_parser_ls.cc8
-rw-r--r--net/ftp/ftp_directory_listing_parser_ls_unittest.cc3
2 files changed, 8 insertions, 3 deletions
diff --git a/net/ftp/ftp_directory_listing_parser_ls.cc b/net/ftp/ftp_directory_listing_parser_ls.cc
index 38025a0..038af11 100644
--- a/net/ftp/ftp_directory_listing_parser_ls.cc
+++ b/net/ftp/ftp_directory_listing_parser_ls.cc
@@ -158,9 +158,11 @@ bool FtpDirectoryListingParserLs::ConsumeLine(const string16& line) {
entry.name = FtpUtil::GetStringPartAfterColumns(line, 6 + column_offset);
if (entry.type == FtpDirectoryListingEntry::SYMLINK) {
string16::size_type pos = entry.name.rfind(ASCIIToUTF16(" -> "));
- if (pos == string16::npos)
- return false;
- entry.name = entry.name.substr(0, pos);
+
+ // We don't require the " -> " to be present. Some FTP servers don't send
+ // the symlink target, possibly for security reasons.
+ if (pos != string16::npos)
+ entry.name = entry.name.substr(0, pos);
}
entries_.push(entry);
diff --git a/net/ftp/ftp_directory_listing_parser_ls_unittest.cc b/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
index 44c3eb6..2b57b40 100644
--- a/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
+++ b/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
@@ -49,6 +49,9 @@ TEST_F(FtpDirectoryListingParserLsTest, Good) {
{ "drwxrwxrwx 1 owner group 0 Sep 13 0:30 audio",
net::FtpDirectoryListingEntry::DIRECTORY, "audio", -1,
1994, 9, 13, 0, 30 },
+ { "lrwxrwxrwx 1 0 0 26 Sep 18 2008 pub",
+ net::FtpDirectoryListingEntry::SYMLINK, "pub", -1,
+ 2008, 9, 18, 0, 0 },
// Tests for the wu-ftpd variant:
{ "drwxr-xr-x 2 sys 512 Mar 27 2009 pub",