summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2012-07-20 20:47:05 +0400
committerFedor Indutny <fedor.indutny@gmail.com>2012-07-20 20:51:38 +0400
commit4aa09d1e0e29139484e3f2c72294fd8315c9ca33 (patch)
treec56343a390599008ebc6744c904ceb4b59e73099
parente43fe5c833c941aba25bfdb6193ef41fc50ae405 (diff)
downloadnodejs-4aa09d1e0e29139484e3f2c72294fd8315c9ca33.tar.gz
nodejs-4aa09d1e0e29139484e3f2c72294fd8315c9ca33.tar.bz2
nodejs-4aa09d1e0e29139484e3f2c72294fd8315c9ca33.zip
tls: localhost is valid against identity-check
-rw-r--r--lib/tls.js4
-rw-r--r--test/simple/test-tls-check-server-identity.js7
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/tls.js b/lib/tls.js
index 640328ec4..aec7cae42 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -85,10 +85,6 @@ function checkServerIdentity(host, cert) {
// Add trailing dot (make hostnames uniform)
if (!/\.$/.test(host)) host += '.';
- // Host names with less than one dots are considered too broad,
- // and should not be allowed
- if (!/^.+\..+$/.test(host)) return /$./;
-
// The same applies to hostname with more than one wildcard,
// if hostname has wildcard when wildcards are not allowed,
// or if there are less than two dots after wildcard (i.e. *.com or *d.com)
diff --git a/test/simple/test-tls-check-server-identity.js b/test/simple/test-tls-check-server-identity.js
index f79823b84..99835f8f5 100644
--- a/test/simple/test-tls-check-server-identity.js
+++ b/test/simple/test-tls-check-server-identity.js
@@ -180,6 +180,13 @@ var tests = [
},
result: false
},
+ {
+ host: 'localhost', cert: {
+ subjectaltname: 'DNS:a.com',
+ subject: { CN: 'localhost' }
+ },
+ result: true
+ },
];
tests.forEach(function(test, i) {