From 4b6b848785314aa9b62475c520c04f675d6bfa71 Mon Sep 17 00:00:00 2001 From: Lyon Chen Date: Mon, 11 Apr 2016 10:08:00 -0400 Subject: [PATCH] Add SSL_SESSION_get0_hostname() Reviewed-by: Rich Salz --- include/openssl/ssl.h | 1 + ssl/ssl_sess.c | 5 +++++ util/libssl.num | 1 + 3 files changed, 7 insertions(+) diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h index ef7ef56802..44f44bf7b2 100644 --- a/include/openssl/ssl.h +++ b/include/openssl/ssl.h @@ -1473,6 +1473,7 @@ __owur long SSL_SESSION_get_time(const SSL_SESSION *s); __owur long SSL_SESSION_set_time(SSL_SESSION *s, long t); __owur long SSL_SESSION_get_timeout(const SSL_SESSION *s); __owur long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); +__owur const char *SSL_SESSION_get0_hostname(const SSL_SESSION *s); __owur int SSL_SESSION_has_ticket(const SSL_SESSION *s); __owur unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s); void SSL_SESSION_get0_ticket(const SSL_SESSION *s, unsigned char **tick, diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c index 70e2683ee4..d5b7fe3310 100644 --- a/ssl/ssl_sess.c +++ b/ssl/ssl_sess.c @@ -925,6 +925,11 @@ long SSL_SESSION_set_time(SSL_SESSION *s, long t) return (t); } +const char *SSL_SESSION_get0_hostname(const SSL_SESSION *s) +{ + return s->tlsext_hostname; +} + int SSL_SESSION_has_ticket(const SSL_SESSION *s) { return (s->tlsext_ticklen > 0) ? 1 : 0; diff --git a/util/libssl.num b/util/libssl.num index 781a8cb7e6..636892cd8a 100644 --- a/util/libssl.num +++ b/util/libssl.num @@ -393,3 +393,4 @@ SSL_CTX_get0_ctlog_store 392 1_1_0 EXIST::FUNCTION:CT SSL_enable_ct 393 1_1_0 EXIST::FUNCTION:CT SSL_CTX_enable_ct 394 1_1_0 EXIST::FUNCTION:CT SSL_CTX_get_ciphers 395 1_1_0 EXIST::FUNCTION: +SSL_SESSION_get0_hostname 396 1_1_0 EXIST::FUNCTION: -- 2.25.1