| 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/x509_certificate.h" | 5 #include "net/cert/x509_certificate.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 presented_names = &common_name_as_vector; | 603 presented_names = &common_name_as_vector; |
| 604 } | 604 } |
| 605 for (std::vector<std::string>::const_iterator it = | 605 for (std::vector<std::string>::const_iterator it = |
| 606 presented_names->begin(); | 606 presented_names->begin(); |
| 607 it != presented_names->end(); ++it) { | 607 it != presented_names->end(); ++it) { |
| 608 // Catch badly corrupt cert names up front. | 608 // Catch badly corrupt cert names up front. |
| 609 if (it->empty() || it->find('\0') != std::string::npos) { | 609 if (it->empty() || it->find('\0') != std::string::npos) { |
| 610 DVLOG(1) << "Bad name in cert: " << *it; | 610 DVLOG(1) << "Bad name in cert: " << *it; |
| 611 continue; | 611 continue; |
| 612 } | 612 } |
| 613 std::string presented_name(StringToLowerASCII(*it)); | 613 std::string presented_name(base::StringToLowerASCII(*it)); |
| 614 | 614 |
| 615 // Remove trailing dot, if any. | 615 // Remove trailing dot, if any. |
| 616 if (*presented_name.rbegin() == '.') | 616 if (*presented_name.rbegin() == '.') |
| 617 presented_name.resize(presented_name.length() - 1); | 617 presented_name.resize(presented_name.length() - 1); |
| 618 | 618 |
| 619 // The hostname must be at least as long as the cert name it is matching, | 619 // The hostname must be at least as long as the cert name it is matching, |
| 620 // as we require the wildcard (if present) to match at least one character. | 620 // as we require the wildcard (if present) to match at least one character. |
| 621 if (presented_name.length() > reference_name.length()) | 621 if (presented_name.length() > reference_name.length()) |
| 622 continue; | 622 continue; |
| 623 | 623 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 RemoveFromCache(cert_handle_); | 760 RemoveFromCache(cert_handle_); |
| 761 FreeOSCertHandle(cert_handle_); | 761 FreeOSCertHandle(cert_handle_); |
| 762 } | 762 } |
| 763 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { | 763 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { |
| 764 RemoveFromCache(intermediate_ca_certs_[i]); | 764 RemoveFromCache(intermediate_ca_certs_[i]); |
| 765 FreeOSCertHandle(intermediate_ca_certs_[i]); | 765 FreeOSCertHandle(intermediate_ca_certs_[i]); |
| 766 } | 766 } |
| 767 } | 767 } |
| 768 | 768 |
| 769 } // namespace net | 769 } // namespace net |
| OLD | NEW |