Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Revert "tls: allow wildcards in common name"
Browse files Browse the repository at this point in the history
This reverts commit 45024e7.

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
  • Loading branch information
bnoordhuis committed Jan 17, 2013
1 parent 08ac9fe commit 30e2370
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/tls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 30e2370

Please sign in to comment.