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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 presented_names = &common_name_as_vector; | 611 presented_names = &common_name_as_vector; |
612 } | 612 } |
613 for (std::vector<std::string>::const_iterator it = | 613 for (std::vector<std::string>::const_iterator it = |
614 presented_names->begin(); | 614 presented_names->begin(); |
615 it != presented_names->end(); ++it) { | 615 it != presented_names->end(); ++it) { |
616 // Catch badly corrupt cert names up front. | 616 // Catch badly corrupt cert names up front. |
617 if (it->empty() || it->find('\0') != std::string::npos) { | 617 if (it->empty() || it->find('\0') != std::string::npos) { |
618 DVLOG(1) << "Bad name in cert: " << *it; | 618 DVLOG(1) << "Bad name in cert: " << *it; |
619 continue; | 619 continue; |
620 } | 620 } |
621 std::string presented_name(base::StringToLowerASCII(*it)); | 621 std::string presented_name(base::ToLowerASCII(*it)); |
622 | 622 |
623 // Remove trailing dot, if any. | 623 // Remove trailing dot, if any. |
624 if (*presented_name.rbegin() == '.') | 624 if (*presented_name.rbegin() == '.') |
625 presented_name.resize(presented_name.length() - 1); | 625 presented_name.resize(presented_name.length() - 1); |
626 | 626 |
627 // The hostname must be at least as long as the cert name it is matching, | 627 // The hostname must be at least as long as the cert name it is matching, |
628 // as we require the wildcard (if present) to match at least one character. | 628 // as we require the wildcard (if present) to match at least one character. |
629 if (presented_name.length() > reference_name.length()) | 629 if (presented_name.length() > reference_name.length()) |
630 continue; | 630 continue; |
631 | 631 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 RemoveFromCache(cert_handle_); | 757 RemoveFromCache(cert_handle_); |
758 FreeOSCertHandle(cert_handle_); | 758 FreeOSCertHandle(cert_handle_); |
759 } | 759 } |
760 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { | 760 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { |
761 RemoveFromCache(intermediate_ca_certs_[i]); | 761 RemoveFromCache(intermediate_ca_certs_[i]); |
762 FreeOSCertHandle(intermediate_ca_certs_[i]); | 762 FreeOSCertHandle(intermediate_ca_certs_[i]); |
763 } | 763 } |
764 } | 764 } |
765 | 765 |
766 } // namespace net | 766 } // namespace net |
OLD | NEW |