Browse Source

Revert "tls: allow wildcards in common name"

This reverts commit 45024e7b75.

It's making test/simple/test-tls-check-server-identity.js fail:

  AssertionError: Test#4 failed: { host: 'b.a.com',
    cert: { subject: { CN: '*.a.com' } },
    result: false }
      at <omitted>/test/simple/test-tls-check-server-identity.js:201:10
v0.8.18-release
Ben Noordhuis 12 years ago
parent
commit
30e237041d
  1. 5
      lib/tls.js

5
lib/tls.js

@ -156,13 +156,14 @@ 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], true));
dnsNames.push(regexpify(commonNames[i], false));
}
} else {
dnsNames.push(regexpify(commonNames, true));
dnsNames.push(regexpify(commonNames, false));
}
valid = dnsNames.some(function(re) {

Loading…
Cancel
Save