Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: net/ftp/ftp_directory_listing_parser_ls_unittest.cc

Issue 6096006: FTP: correctly handle directory listings containing "Permission denied" errors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_ls.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/ftp/ftp_directory_listing_parser_unittest.h" 5 #include "net/ftp/ftp_directory_listing_parser_unittest.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "net/ftp/ftp_directory_listing_parser_ls.h" 10 #include "net/ftp/ftp_directory_listing_parser_ls.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 net::FtpDirectoryListingParserLs parser(GetMockCurrentTime()); 89 net::FtpDirectoryListingParserLs parser(GetMockCurrentTime());
90 RunSingleLineTestCase(&parser, good_cases[i]); 90 RunSingleLineTestCase(&parser, good_cases[i]);
91 } 91 }
92 } 92 }
93 93
94 TEST_F(FtpDirectoryListingParserLsTest, Ignored) { 94 TEST_F(FtpDirectoryListingParserLsTest, Ignored) {
95 const char* ignored_cases[] = { 95 const char* ignored_cases[] = {
96 "drwxr-xr-x 2 0 0 4096 Mar 18 2007 ", // http://crbug.com/60065 96 "drwxr-xr-x 2 0 0 4096 Mar 18 2007 ", // http://crbug.com/60065
97 97
98 "ftpd: .: Permission denied",
99 "ftpd-BSD: .: Permission denied",
100
98 // Tests important for security: verify that after we detect the column 101 // Tests important for security: verify that after we detect the column
99 // offset we don't try to access invalid memory on malformed input. 102 // offset we don't try to access invalid memory on malformed input.
100 "drwxr-xr-x 3 ftp ftp 4096 May 15 18:11", 103 "drwxr-xr-x 3 ftp ftp 4096 May 15 18:11",
101 "drwxr-xr-x 3 ftp 4096 May 15 18:11", 104 "drwxr-xr-x 3 ftp 4096 May 15 18:11",
102 "drwxr-xr-x folder 0 May 15 18:11", 105 "drwxr-xr-x folder 0 May 15 18:11",
103 }; 106 };
104 for (size_t i = 0; i < arraysize(ignored_cases); i++) { 107 for (size_t i = 0; i < arraysize(ignored_cases); i++) {
105 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, 108 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
106 ignored_cases[i])); 109 ignored_cases[i]));
107 110
(...skipping 27 matching lines...) Expand all
135 "d-wx-wx-wt$ 4 ftp 989 512 Dec 8 15:54 incoming", 138 "d-wx-wx-wt$ 4 ftp 989 512 Dec 8 15:54 incoming",
136 "-qqqqqqqqq+ 2 sys 512 Mar 27 2009 pub", 139 "-qqqqqqqqq+ 2 sys 512 Mar 27 2009 pub",
137 }; 140 };
138 for (size_t i = 0; i < arraysize(bad_cases); i++) { 141 for (size_t i = 0; i < arraysize(bad_cases); i++) {
139 net::FtpDirectoryListingParserLs parser(GetMockCurrentTime()); 142 net::FtpDirectoryListingParserLs parser(GetMockCurrentTime());
140 EXPECT_FALSE(parser.ConsumeLine(UTF8ToUTF16(bad_cases[i]))) << bad_cases[i]; 143 EXPECT_FALSE(parser.ConsumeLine(UTF8ToUTF16(bad_cases[i]))) << bad_cases[i];
141 } 144 }
142 } 145 }
143 146
144 } // namespace 147 } // namespace
OLDNEW
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_ls.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698