OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_network_transaction.h" | 5 #include "net/ftp/ftp_network_transaction.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 FtpSocketDataProviderEvilEpsv ctrl_socket("227 Portscan (||||)\r\n", | 1179 FtpSocketDataProviderEvilEpsv ctrl_socket("227 Portscan (||||)\r\n", |
1180 FtpSocketDataProvider::PRE_QUIT); | 1180 FtpSocketDataProvider::PRE_QUIT); |
1181 ExecuteTransaction(&ctrl_socket, "ftp://host/file", 1, ERR_INVALID_RESPONSE); | 1181 ExecuteTransaction(&ctrl_socket, "ftp://host/file", 1, ERR_INVALID_RESPONSE); |
1182 } | 1182 } |
1183 | 1183 |
1184 TEST_P(FtpNetworkTransactionTest, DownloadTransactionEvilEpsvReallyBadFormat5) { | 1184 TEST_P(FtpNetworkTransactionTest, DownloadTransactionEvilEpsvReallyBadFormat5) { |
1185 // This test makes no sense for IPv4 connections (we don't use EPSV there). | 1185 // This test makes no sense for IPv4 connections (we don't use EPSV there). |
1186 if (GetFamily() == AF_INET) | 1186 if (GetFamily() == AF_INET) |
1187 return; | 1187 return; |
1188 | 1188 |
1189 const char response[] = "227 Portscan (\0\0\031773\0)\r\n"; | 1189 // Breaking the string in the next line prevents MSVC warning C4125. |
| 1190 const char response[] = "227 Portscan (\0\0\031" "773\0)\r\n"; |
1190 FtpSocketDataProviderEvilEpsv ctrl_socket(response, sizeof(response)-1, | 1191 FtpSocketDataProviderEvilEpsv ctrl_socket(response, sizeof(response)-1, |
1191 FtpSocketDataProvider::PRE_QUIT); | 1192 FtpSocketDataProvider::PRE_QUIT); |
1192 ExecuteTransaction(&ctrl_socket, "ftp://host/file", 1, ERR_INVALID_RESPONSE); | 1193 ExecuteTransaction(&ctrl_socket, "ftp://host/file", 1, ERR_INVALID_RESPONSE); |
1193 } | 1194 } |
1194 | 1195 |
1195 TEST_P(FtpNetworkTransactionTest, DownloadTransactionEvilEpsvUnsafePort1) { | 1196 TEST_P(FtpNetworkTransactionTest, DownloadTransactionEvilEpsvUnsafePort1) { |
1196 // This test makes no sense for IPv4 connections (we don't use EPSV there). | 1197 // This test makes no sense for IPv4 connections (we don't use EPSV there). |
1197 if (GetFamily() == AF_INET) | 1198 if (GetFamily() == AF_INET) |
1198 return; | 1199 return; |
1199 | 1200 |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 FtpSocketDataProvider::PRE_TYPE, | 1594 FtpSocketDataProvider::PRE_TYPE, |
1594 "257 \"\"\r\n", | 1595 "257 \"\"\r\n", |
1595 OK); | 1596 OK); |
1596 } | 1597 } |
1597 | 1598 |
1598 INSTANTIATE_TEST_CASE_P(FTP, | 1599 INSTANTIATE_TEST_CASE_P(FTP, |
1599 FtpNetworkTransactionTest, | 1600 FtpNetworkTransactionTest, |
1600 ::testing::Values(AF_INET, AF_INET6)); | 1601 ::testing::Values(AF_INET, AF_INET6)); |
1601 | 1602 |
1602 } // namespace net | 1603 } // namespace net |
OLD | NEW |