REORG: ssl: move ssl_sock_is_ssl() to connection.h and rename it
This one doesn't use anything from an SSL context, it only checks the
type of the transport layer of a connection, thus it belongs to
connection.h. This is particularly visible due to all the ifdefs
around it in various call places.
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 8be8c6f..8f7000d 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -585,7 +585,7 @@
SSL *ssl_sock_get_ssl_object(struct connection *conn)
{
- if (!ssl_sock_is_ssl(conn))
+ if (!conn_is_ssl(conn))
return NULL;
return ((struct ssl_sock_ctx *)(conn->xprt_ctx))->ssl;
@@ -6471,7 +6471,7 @@
struct ssl_sock_ctx *ctx;
X509 *crt;
- if (!ssl_sock_is_ssl(conn))
+ if (!conn_is_ssl(conn))
return 0;
ctx = conn->xprt_ctx;
@@ -6491,7 +6491,7 @@
__OPENSSL_110_CONST__ ASN1_OBJECT *algorithm;
X509 *crt;
- if (!ssl_sock_is_ssl(conn))
+ if (!conn_is_ssl(conn))
return NULL;
ctx = conn->xprt_ctx;
crt = SSL_get_certificate(ctx->ssl);
@@ -6507,7 +6507,7 @@
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
struct ssl_sock_ctx *ctx;
- if (!ssl_sock_is_ssl(conn))
+ if (!conn_is_ssl(conn))
return NULL;
ctx = conn->xprt_ctx;
return SSL_get_servername(ctx->ssl, TLSEXT_NAMETYPE_host_name);
@@ -6521,7 +6521,7 @@
{
struct ssl_sock_ctx *ctx;
- if (!ssl_sock_is_ssl(conn))
+ if (!conn_is_ssl(conn))
return NULL;
ctx = conn->xprt_ctx;
return SSL_get_cipher_name(ctx->ssl);
@@ -6532,7 +6532,7 @@
{
struct ssl_sock_ctx *ctx;
- if (!ssl_sock_is_ssl(conn))
+ if (!conn_is_ssl(conn))
return NULL;
ctx = conn->xprt_ctx;
return SSL_get_version(ctx->ssl);
@@ -6543,7 +6543,7 @@
#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
struct ssl_sock_ctx *ctx;
- if (!ssl_sock_is_ssl(conn))
+ if (!conn_is_ssl(conn))
return;
ctx = conn->xprt_ctx;
SSL_set_alpn_protos(ctx->ssl, alpn, len);
@@ -6560,7 +6560,7 @@
char *prev_name;
- if (!ssl_sock_is_ssl(conn))
+ if (!conn_is_ssl(conn))
return;
ctx = conn->xprt_ctx;
@@ -6597,7 +6597,7 @@
};
int result = -1;
- if (!ssl_sock_is_ssl(conn))
+ if (!conn_is_ssl(conn))
goto out;
ctx = conn->xprt_ctx;
@@ -6624,7 +6624,7 @@
struct ssl_sock_ctx *ctx;
X509 *crt = NULL;
- if (!ssl_sock_is_ssl(conn))
+ if (!conn_is_ssl(conn))
return 0;
ctx = conn->xprt_ctx;
@@ -6642,7 +6642,7 @@
{
struct ssl_sock_ctx *ctx;
- if (!ssl_sock_is_ssl(conn))
+ if (!conn_is_ssl(conn))
return 0;
ctx = conn->xprt_ctx;
return SSL_SOCK_ST_FL_VERIFY_DONE & ctx->xprt_st ? 1 : 0;
@@ -6653,7 +6653,7 @@
{
struct ssl_sock_ctx *ctx;
- if (!ssl_sock_is_ssl(conn))
+ if (!conn_is_ssl(conn))
return (unsigned int)X509_V_ERR_APPLICATION_VERIFICATION;
ctx = conn->xprt_ctx;
return (unsigned int)SSL_get_verify_result(ctx->ssl);