diff --git a/src/node_crypto.cc b/src/node_crypto.cc index efaa390ff3..918c2b9089 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1144,6 +1144,9 @@ static bool SafeX509ExtPrint(BIO* out, X509_EXTENSION* ext) { for (int i = 0; i < sk_GENERAL_NAME_num(names); i++) { GENERAL_NAME* gen = sk_GENERAL_NAME_value(names, i); + if (i != 0) + BIO_write(out, ", ", 2); + if (gen->type == GEN_DNS) { ASN1_IA5STRING* name = gen->d.dNSName; diff --git a/test/fixtures/keys/0-dns-cert.pem b/test/fixtures/keys/0-dns-cert.pem index 70171dc5d1..6cfc6c43c4 100644 --- a/test/fixtures/keys/0-dns-cert.pem +++ b/test/fixtures/keys/0-dns-cert.pem @@ -1,18 +1,19 @@ -----BEGIN CERTIFICATE----- -MIIC2jCCAcSgAwIBAgICJxEwCwYJKoZIhvcNAQEFMBUxEzARBgNVBAMWCm9oLm15 -Lmdvc2gwHxcNMTQxMTA1MDMyMDUyWhcOMzQwMTAzMTAzMjA1MlowEzERMA8GA1UE -AxYIZXZpbC5jb20wggEfMAsGCSqGSIb3DQEBAQOCAQ4AMIIBCQKCAQCsFwwf1dsr +MIIC/zCCAemgAwIBAgICJxEwCwYJKoZIhvcNAQEFMBUxEzARBgNVBAMWCm9oLm15 +Lmdvc2gwHhcNMTQxMjA4MTM0MTUzWhcNMzQxMjAzMTM0MTUzWjATMREwDwYDVQQD +FghldmlsLmNvbTCCASAwCwYJKoZIhvcNAQEBA4IBDwAwggEKAoIBAQCsFwwf1dsr PdxyTHBreymbFGACLQtaOihGsSkYtIzUEF1aT90YDMzNdoLr4wkwWig5FPRMnjmX 7pXY9RVbWmwG/M2eku9S62LekUFkeY1W/QftV9LYgAg7wVDA+v3+zk/EMEqADYm6 W735tzDIKtvx+/3Dd9puQ0TLFNHBxAmTz7YNaJdIUqzs3DWT4zeZQj0RCOyWCjQL NfqQ80I7NYFYb4IJqiUY8iOTL5kPi7b5szem5EakQbhufDWun4xGTZk/URZH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--git a/test/simple/test-tls-0-dns-altname.js b/test/simple/test-tls-0-dns-altname.js index 29ee7fcb4b..002a5ca3c1 100644 --- a/test/simple/test-tls-0-dns-altname.js +++ b/test/simple/test-tls-0-dns-altname.js @@ -47,7 +47,12 @@ var server = tls.createServer({ }, function() { requests++; var cert = c.getPeerCertificate(); - assert.equal(cert.subjectaltname, 'DNS:google.com\0.evil.com'); + assert.equal(cert.subjectaltname, + 'DNS:google.com\0.evil.com, ' + + 'DNS:just-another.com, ' + + 'IP Address:8.8.8.8, '+ + 'IP Address:8.8.4.4, '+ + 'DNS:last.com'); c.write('ok'); }); });