summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2017-09-11 17:23:39 -0400
committerMyles Borins <myles.borins@gmail.com>2017-10-25 04:09:44 -0400
commit6b0812860dfed0a6931c1ed10ec0330dc2d50a40 (patch)
treea7c69736ea88292e1af8ec884873fd6f53175835 /src
parent78dc92860fdfc8f57f116af1dbfe2da18e4650b1 (diff)
downloadnode-new-6b0812860dfed0a6931c1ed10ec0330dc2d50a40.tar.gz
crypto: use SSL_SESSION_get_id
This accessor exists in OpenSSL 1.0.2, so it may be used already. This is cherry-picked from PR #8491. PR-URL: https://github.com/nodejs/node/pull/15348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src')
-rw-r--r--src/node_crypto.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index 9f4ac37448..f33b885ff4 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -1410,10 +1410,13 @@ int SSLWrap<Base>::NewSessionCallback(SSL* s, SSL_SESSION* sess) {
memset(serialized, 0, size);
i2d_SSL_SESSION(sess, &serialized);
+ unsigned int session_id_length;
+ const unsigned char* session_id = SSL_SESSION_get_id(sess,
+ &session_id_length);
Local<Object> session = Buffer::Copy(
env,
- reinterpret_cast<char*>(sess->session_id),
- sess->session_id_length).ToLocalChecked();
+ reinterpret_cast<const char*>(session_id),
+ session_id_length).ToLocalChecked();
Local<Value> argv[] = { session, buff };
w->new_session_wait_ = true;
w->MakeCallback(env->onnewsession_string(), arraysize(argv), argv);