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/cert/cert_verify_proc.h" | 5 #include "net/cert/cert_verify_proc.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 static const size_t kMaxTLDLength = 4; | 424 static const size_t kMaxTLDLength = 4; |
425 | 425 |
426 // CheckNameConstraints verifies that every name in |dns_names| is in one of | 426 // CheckNameConstraints verifies that every name in |dns_names| is in one of |
427 // the domains specified by |tlds|. The |tlds| array is terminated by an empty | 427 // the domains specified by |tlds|. The |tlds| array is terminated by an empty |
428 // string. | 428 // string. |
429 static bool CheckNameConstraints(const std::vector<std::string>& dns_names, | 429 static bool CheckNameConstraints(const std::vector<std::string>& dns_names, |
430 const char tlds[][kMaxTLDLength]) { | 430 const char tlds[][kMaxTLDLength]) { |
431 for (std::vector<std::string>::const_iterator i = dns_names.begin(); | 431 for (std::vector<std::string>::const_iterator i = dns_names.begin(); |
432 i != dns_names.end(); ++i) { | 432 i != dns_names.end(); ++i) { |
433 bool ok = false; | 433 bool ok = false; |
434 url_canon::CanonHostInfo host_info; | 434 url::CanonHostInfo host_info; |
435 const std::string dns_name = CanonicalizeHost(*i, &host_info); | 435 const std::string dns_name = CanonicalizeHost(*i, &host_info); |
436 if (host_info.IsIPAddress()) | 436 if (host_info.IsIPAddress()) |
437 continue; | 437 continue; |
438 | 438 |
439 const size_t registry_len = registry_controlled_domains::GetRegistryLength( | 439 const size_t registry_len = registry_controlled_domains::GetRegistryLength( |
440 dns_name, | 440 dns_name, |
441 registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, | 441 registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
442 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | 442 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
443 // If the name is not in a known TLD, ignore it. This permits internal | 443 // If the name is not in a known TLD, ignore it. This permits internal |
444 // names. | 444 // names. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 return true; | 535 return true; |
536 } | 536 } |
537 } | 537 } |
538 } | 538 } |
539 } | 539 } |
540 | 540 |
541 return false; | 541 return false; |
542 } | 542 } |
543 | 543 |
544 } // namespace net | 544 } // namespace net |
OLD | NEW |