The branch master has been updated
       via  cd1a88b3279a633f16c1a177574a83123c89c8b8 (commit)
       via  4b6b848785314aa9b62475c520c04f675d6bfa71 (commit)
      from  ff2344052bfa0132260ee3154962a2552f3d95f5 (commit)


- Log -----------------------------------------------------------------
commit cd1a88b3279a633f16c1a177574a83123c89c8b8
Author: Rich Salz <rs...@openssl.org>
Date:   Mon Apr 11 10:17:38 2016 -0400

    Write POD page.
    
    Reviewed-by: Richard Levitte <levi...@openssl.org>

commit 4b6b848785314aa9b62475c520c04f675d6bfa71
Author: Lyon Chen <lyonp...@gmail.com>
Date:   Mon Apr 11 10:08:00 2016 -0400

    Add SSL_SESSION_get0_hostname()
    
    Reviewed-by: Rich Salz <rs...@openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 doc/ssl/SSL_SESSION_get_hostname.pod | 28 ++++++++++++++++++++++++++++
 include/openssl/ssl.h                |  1 +
 ssl/ssl_sess.c                       |  5 +++++
 util/libssl.num                      |  1 +
 4 files changed, 35 insertions(+)
 create mode 100644 doc/ssl/SSL_SESSION_get_hostname.pod

diff --git a/doc/ssl/SSL_SESSION_get_hostname.pod 
b/doc/ssl/SSL_SESSION_get_hostname.pod
new file mode 100644
index 0000000..8b739e3
--- /dev/null
+++ b/doc/ssl/SSL_SESSION_get_hostname.pod
@@ -0,0 +1,28 @@
+=pod
+
+=head1 NAME
+
+SSL_SESSION_get0_hostname - retrieve the SNI hostname associated with a session
+
+=head1 SYNOPSIS
+
+ #include <openssl/ssl.h>
+
+ const char *SSL_SESSION_get0_hostname(const SSL_SESSSION *s);
+
+=head1 DESCRIPTION
+
+SSL_SESSION_get0_hostname() retrieves the SNI value that was sent by the
+client when the session was created, or NULL if no value was sent.
+
+The value returned is a pointer to memory maintained within B<s> and
+should not be free'd.
+
+=head1 SEE ALSO
+
+L<ssl(3)>,
+L<d2i_SSL_SESSION(3)>,
+L<SSL_SESSION_get_time(3)>,
+L<SSL_SESSION_free(3)>
+
+=cut
diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h
index ef7ef56..44f44bf 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 70e2683..d5b7fe3 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 781a8cb..636892c 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:
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits

Reply via email to