]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: ssl: add a new function ssl_sock_get_ssl_object()
authorDragan Dosen <ddosen@haproxy.com>
Mon, 11 May 2020 15:17:06 +0000 (17:17 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Thu, 14 May 2020 11:13:14 +0000 (13:13 +0200)
This one can be used later to get a SSL object from connection. It will
return NULL if connection is not established over SSL.

include/proto/ssl_sock.h
src/ssl_sock.c

index d0293948620c4d36f4ec1f53f5e93722df2d0aa0..0751f70a0998e11d16e727649d43b382d129a27f 100644 (file)
@@ -109,6 +109,8 @@ void ssl_async_fd_free(int fd);
  */
 int ssl_sock_register_msg_callback(ssl_sock_msg_callback_func func);
 
+SSL *ssl_sock_get_ssl_object(struct connection *conn);
+
 #endif /* USE_OPENSSL */
 #endif /* _PROTO_SSL_SOCK_H */
 
index 232b10b556dfcf5ee8720e4e1bfbf4800c6a8f3a..95bf9c27a7202ca471db277f0b64075b14d06e8b 100644 (file)
@@ -695,6 +695,14 @@ static void ssl_sock_unregister_msg_callbacks(void)
        }
 }
 
+SSL *ssl_sock_get_ssl_object(struct connection *conn)
+{
+       if (!ssl_sock_is_ssl(conn))
+               return NULL;
+
+       return ((struct ssl_sock_ctx *)(conn->xprt_ctx))->ssl;
+}
+
 /*
  * This function gives the detail of the SSL error. It is used only
  * if the debug mode and the verbose mode are activated. It dump all