tls: allow wildcards in common name

see #4592
pull/24504/head
Fedor Indutny 2013-01-14 21:09:35 +04:00
parent e4598aa241
commit 4dd70bb12c
1 changed files with 2 additions and 3 deletions

View File

@ -156,14 +156,13 @@ function checkServerIdentity(host, cert) {
dnsNames = dnsNames.concat(uriNames);
// And only after check if hostname matches CN
// (because CN is deprecated, but should be used for compatiblity anyway)
var commonNames = cert.subject.CN;
if (Array.isArray(commonNames)) {
for (var i = 0, k = commonNames.length; i < k; ++i) {
dnsNames.push(regexpify(commonNames[i], false));
dnsNames.push(regexpify(commonNames[i], true));
}
} else {
dnsNames.push(regexpify(commonNames, false));
dnsNames.push(regexpify(commonNames, true));
}
valid = dnsNames.some(function(re) {