Index: net/cert/internal/name_constraints.cc |
diff --git a/net/cert/internal/name_constraints.cc b/net/cert/internal/name_constraints.cc |
index 07e231e4d2331c7b15e65e1fc4ff5ddb73cad7db..68455c7bcba10f05fd8fda1e6584edc209fac317 100644 |
--- a/net/cert/internal/name_constraints.cc |
+++ b/net/cert/internal/name_constraints.cc |
@@ -505,6 +505,12 @@ bool NameConstraints::IsPermittedDNSName(const std::string& name) const { |
if (DNSNameMatches(name, excluded_name, WILDCARD_PARTIAL_MATCH)) |
return false; |
} |
+ |
+ // If permitted subtrees are not constrained, any name that is not excluded is |
+ // allowed. |
+ if (!(permitted_subtrees_.present_name_types & GENERAL_NAME_DNS_NAME)) |
+ return true; |
+ |
for (const std::string& permitted_name : permitted_subtrees_.dns_names) { |
// When matching wildcard hosts against permitted subtrees, consider it a |
// match only if the constraint would match all expansions of the wildcard. |
@@ -530,6 +536,12 @@ bool NameConstraints::IsPermittedDirectoryName( |
return false; |
} |
} |
+ |
+ // If permitted subtrees are not constrained, any name that is not excluded is |
+ // allowed. |
+ if (!(permitted_subtrees_.present_name_types & GENERAL_NAME_DIRECTORY_NAME)) |
+ return true; |
+ |
for (const auto& permitted_name : permitted_subtrees_.directory_names) { |
if (VerifyNameInSubtree( |
name_rdn_sequence, |
@@ -551,6 +563,12 @@ bool NameConstraints::IsPermittedIP(const IPAddressNumber& ip) const { |
if (IPNumberMatchesPrefix(ip, excluded_ip.first, excluded_ip.second)) |
return false; |
} |
+ |
+ // If permitted subtrees are not constrained, any name that is not excluded is |
+ // allowed. |
+ if (!(permitted_subtrees_.present_name_types & GENERAL_NAME_IP_ADDRESS)) |
+ return true; |
+ |
for (const auto& permitted_ip : permitted_subtrees_.ip_address_ranges) { |
if (IPNumberMatchesPrefix(ip, permitted_ip.first, permitted_ip.second)) |
return true; |