MINOR: ssl: add a new function ssl_sock_get_ssl_object()

This one can be used later to get a SSL object from connection. It will
return NULL if connection is not established over SSL.
This commit is contained in:
Dragan Dosen 2020-05-11 17:17:06 +02:00 committed by William Lallemand
parent 9ac9809cb9
commit eb607fe6a1
2 changed files with 10 additions and 0 deletions

View 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 */

View 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