summaryrefslogtreecommitdiff
path: root/src/ne_socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ne_socket.c')
-rw-r--r--src/ne_socket.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ne_socket.c b/src/ne_socket.c
index 5e78d70..51ccb2c 100644
--- a/src/ne_socket.c
+++ b/src/ne_socket.c
@@ -1858,6 +1858,8 @@ int ne_sock_sessid(ne_socket *sock, unsigned char *buf, size_t *buflen)
}
#else
SSL_SESSION *sess;
+ const unsigned char *idbuf;
+ unsigned int idlen;
if (!sock->ssl) {
return -1;
@@ -1865,17 +1867,18 @@ int ne_sock_sessid(ne_socket *sock, unsigned char *buf, size_t *buflen)
sess = SSL_get0_session(sock->ssl);
+ idbuf = SSL_SESSION_get_id(sess, &idlen);
if (!buf) {
- *buflen = sess->session_id_length;
+ *buflen = idlen;
return 0;
}
- if (*buflen < sess->session_id_length) {
+ if (*buflen < idlen) {
return -1;
}
- *buflen = sess->session_id_length;
- memcpy(buf, sess->session_id, *buflen);
+ *buflen = idlen;
+ memcpy(buf, idbuf, idlen);
return 0;
#endif
#else