Skip to content

Commit 3c09579

Browse files
aglMylesBorins
authored andcommitted
crypto: use SSL_get_servername.
(Patch by David Benjamin.) Rather than reach into the SSL_SESSION, use the intended API, SSL_get_servername. This will also help the transition to OpenSSL 1.1.0. Also don't fill in the tlsTicket field here. This is never read by oncertcb and was always false anyway; that field is maintained by clients and tracks whether the server issued a ticket or a session ID. (Note this is distinct from the copy passed to onclienthello which is used and is not a no-op.) PR-URL: #9347 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Shigeki Ohtsu <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 2ce6916 commit 3c09579

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/node_crypto.cc

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,18 +2321,13 @@ int SSLWrap<Base>::SSLCertCallback(SSL* s, void* arg) {
23212321

23222322
Local<Object> info = Object::New(env->isolate());
23232323

2324-
SSL_SESSION* sess = SSL_get_session(s);
2325-
if (sess != nullptr) {
2326-
if (sess->tlsext_hostname == nullptr) {
2327-
info->Set(env->servername_string(), String::Empty(env->isolate()));
2328-
} else {
2329-
Local<String> servername = OneByteString(env->isolate(),
2330-
sess->tlsext_hostname,
2331-
strlen(sess->tlsext_hostname));
2332-
info->Set(env->servername_string(), servername);
2333-
}
2334-
info->Set(env->tls_ticket_string(),
2335-
Boolean::New(env->isolate(), sess->tlsext_ticklen != 0));
2324+
const char* servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
2325+
if (servername == nullptr) {
2326+
info->Set(env->servername_string(), String::Empty(env->isolate()));
2327+
} else {
2328+
Local<String> str = OneByteString(env->isolate(), servername,
2329+
strlen(servername));
2330+
info->Set(env->servername_string(), str);
23362331
}
23372332

23382333
bool ocsp = false;

0 commit comments

Comments
 (0)