Browse Source

tls: allow wildcards in common name

see #4592
v0.8.18-release
Fedor Indutny 12 years ago
parent
commit
45024e7b75
  1. 5
      lib/tls.js

5
lib/tls.js

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

Loading…
Cancel
Save