summaryrefslogtreecommitdiff
path: root/src/lib/libtls/tls_conninfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libtls/tls_conninfo.c')
-rw-r--r--src/lib/libtls/tls_conninfo.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/lib/libtls/tls_conninfo.c b/src/lib/libtls/tls_conninfo.c
index 86fca2337d..48bb89fe63 100644
--- a/src/lib/libtls/tls_conninfo.c
+++ b/src/lib/libtls/tls_conninfo.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_conninfo.c,v 1.3 2015/09/28 15:18:08 jsing Exp $ */ 1/* $OpenBSD: tls_conninfo.c,v 1.4 2015/10/07 23:25:45 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2015 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2015 Bob Beck <beck@openbsd.org>
@@ -121,7 +121,7 @@ tls_get_peer_cert_subject(struct tls *ctx, char **subject)
121 121
122int 122int
123tls_get_conninfo(struct tls *ctx) { 123tls_get_conninfo(struct tls *ctx) {
124 int rv = -1; 124 const char * tmp;
125 if (ctx->ssl_peer_cert != NULL) { 125 if (ctx->ssl_peer_cert != NULL) {
126 if (tls_get_peer_cert_hash(ctx, &ctx->conninfo->hash) == -1) 126 if (tls_get_peer_cert_hash(ctx, &ctx->conninfo->hash) == -1)
127 goto err; 127 goto err;
@@ -130,16 +130,21 @@ tls_get_conninfo(struct tls *ctx) {
130 goto err; 130 goto err;
131 if (tls_get_peer_cert_issuer(ctx, &ctx->conninfo->issuer) == -1) 131 if (tls_get_peer_cert_issuer(ctx, &ctx->conninfo->issuer) == -1)
132 goto err; 132 goto err;
133 ctx->conninfo->version = strdup(SSL_get_version(ctx->ssl_conn));
134 if (ctx->conninfo->version == NULL)
135 goto err;
136 ctx->conninfo->cipher = strdup(SSL_get_cipher(ctx->ssl_conn));
137 if (ctx->conninfo->cipher == NULL)
138 goto err;
139 } 133 }
140 rv = 0; 134 if ((tmp = SSL_get_version(ctx->ssl_conn)) == NULL)
135 goto err;
136 ctx->conninfo->version = strdup(tmp);
137 if (ctx->conninfo->version == NULL)
138 goto err;
139 if ((tmp = SSL_get_cipher(ctx->ssl_conn)) == NULL)
140 goto err;
141 ctx->conninfo->cipher = strdup(tmp);
142 if (ctx->conninfo->cipher == NULL)
143 goto err;
144 return (0);
141err: 145err:
142 return (rv); 146 tls_free_conninfo(ctx->conninfo);
147 return (-1);
143} 148}
144 149
145void 150void