Revert "Revert "tls: allow wildcards in common name""

This reverts commit 30e237041d5cd7c39e33a9382c96f109be23337d.

Works properly with b4b750b
This commit is contained in:
Fedor Indutny 2013-01-18 03:47:47 +04:00
parent 30e237041d
commit e70d1bfe64

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) {