| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 static bool CheckNameConstraints(const std::vector<std::string>& dns_names, | 558 static bool CheckNameConstraints(const std::vector<std::string>& dns_names, |
| 559 const char domains[][kMaxDomainLength]) { | 559 const char domains[][kMaxDomainLength]) { |
| 560 for (std::vector<std::string>::const_iterator i = dns_names.begin(); | 560 for (std::vector<std::string>::const_iterator i = dns_names.begin(); |
| 561 i != dns_names.end(); ++i) { | 561 i != dns_names.end(); ++i) { |
| 562 bool ok = false; | 562 bool ok = false; |
| 563 url::CanonHostInfo host_info; | 563 url::CanonHostInfo host_info; |
| 564 const std::string dns_name = CanonicalizeHost(*i, &host_info); | 564 const std::string dns_name = CanonicalizeHost(*i, &host_info); |
| 565 if (host_info.IsIPAddress()) | 565 if (host_info.IsIPAddress()) |
| 566 continue; | 566 continue; |
| 567 | 567 |
| 568 const size_t registry_len = registry_controlled_domains::GetRegistryLength( | |
| 569 dns_name, | |
| 570 registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, | |
| 571 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | |
| 572 // If the name is not in a known TLD, ignore it. This permits internal | 568 // If the name is not in a known TLD, ignore it. This permits internal |
| 573 // names. | 569 // names. |
| 574 if (registry_len == 0) | 570 if (!registry_controlled_domains::HostHasRegistryControlledDomain( |
| 571 dns_name, registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
| 572 registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)) |
| 575 continue; | 573 continue; |
| 576 | 574 |
| 577 for (size_t j = 0; domains[j][0]; ++j) { | 575 for (size_t j = 0; domains[j][0]; ++j) { |
| 578 const size_t domain_length = strlen(domains[j]); | 576 const size_t domain_length = strlen(domains[j]); |
| 579 // The DNS name must have "." + domains[j] as a suffix. | 577 // The DNS name must have "." + domains[j] as a suffix. |
| 580 if (i->size() <= (1 /* period before domain */ + domain_length)) | 578 if (i->size() <= (1 /* period before domain */ + domain_length)) |
| 581 continue; | 579 continue; |
| 582 | 580 |
| 583 std::string suffix = | 581 std::string suffix = |
| 584 base::ToLowerASCII(&(*i)[i->size() - domain_length - 1]); | 582 base::ToLowerASCII(&(*i)[i->size() - domain_length - 1]); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 return true; | 741 return true; |
| 744 | 742 |
| 745 // For certificates issued after 1 April 2015: 39 months. | 743 // For certificates issued after 1 April 2015: 39 months. |
| 746 if (start >= time_2015_04_01 && month_diff > 39) | 744 if (start >= time_2015_04_01 && month_diff > 39) |
| 747 return true; | 745 return true; |
| 748 | 746 |
| 749 return false; | 747 return false; |
| 750 } | 748 } |
| 751 | 749 |
| 752 } // namespace net | 750 } // namespace net |
| OLD | NEW |