Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Unified Diff: net/cert/x509_certificate.cc

Issue 27624002: Add a histogram for measuring the number of times we fall back to common name matching, when a cert… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/x509_certificate.h ('k') | net/cert/x509_certificate_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/x509_certificate.cc
diff --git a/net/cert/x509_certificate.cc b/net/cert/x509_certificate.cc
index 36e806ebaba7ba14a0ef30bba9a764b73a798abc..862a202621069b0d4995ad07ed7416bfaf2e9e63 100644
--- a/net/cert/x509_certificate.cc
+++ b/net/cert/x509_certificate.cc
@@ -504,7 +504,8 @@ bool X509Certificate::VerifyHostname(
const std::string& hostname,
const std::string& cert_common_name,
const std::vector<std::string>& cert_san_dns_names,
- const std::vector<std::string>& cert_san_ip_addrs) {
+ const std::vector<std::string>& cert_san_ip_addrs,
+ bool* common_name_fallback_used) {
DCHECK(!hostname.empty());
// Perform name verification following http://tools.ietf.org/html/rfc6125.
// The terminology used in this method is as per that RFC:-
@@ -528,6 +529,7 @@ bool X509Certificate::VerifyHostname(
// Allow fallback to Common name matching?
const bool common_name_fallback = cert_san_dns_names.empty() &&
cert_san_ip_addrs.empty();
+ *common_name_fallback_used = common_name_fallback;
// Fully handle all cases where |hostname| contains an IP address.
if (host_info.IsIPAddress()) {
@@ -649,10 +651,12 @@ bool X509Certificate::VerifyHostname(
return false;
}
-bool X509Certificate::VerifyNameMatch(const std::string& hostname) const {
+bool X509Certificate::VerifyNameMatch(const std::string& hostname,
+ bool* common_name_fallback_used) const {
std::vector<std::string> dns_names, ip_addrs;
GetSubjectAltName(&dns_names, &ip_addrs);
- return VerifyHostname(hostname, subject_.common_name, dns_names, ip_addrs);
+ return VerifyHostname(hostname, subject_.common_name, dns_names, ip_addrs,
+ common_name_fallback_used);
}
// static
« no previous file with comments | « net/cert/x509_certificate.h ('k') | net/cert/x509_certificate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698