diff options
author | tedu <> | 2014-10-03 14:14:40 +0000 |
---|---|---|
committer | tedu <> | 2014-10-03 14:14:40 +0000 |
commit | c4534eb6d78a5c5d49990b6f7a9e52af771e8471 (patch) | |
tree | f3a4f9d49ea98f54a4255f5a2ad77c098f92226f /src/lib/libressl/ressl_client.c | |
parent | 9f8a5da13b6653b86f949e67554dafa4591353c0 (diff) | |
download | openbsd-c4534eb6d78a5c5d49990b6f7a9e52af771e8471.tar.gz openbsd-c4534eb6d78a5c5d49990b6f7a9e52af771e8471.tar.bz2 openbsd-c4534eb6d78a5c5d49990b6f7a9e52af771e8471.zip |
allow disabling hostname and cert verification separately.
if you're careful, cert only verification can be useful.
always enable both though, to avoid accidentally leaving one off.
ok jsing
Diffstat (limited to '')
-rw-r--r-- | src/lib/libressl/ressl_client.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libressl/ressl_client.c b/src/lib/libressl/ressl_client.c index 8723a35ae0..013963f3a1 100644 --- a/src/lib/libressl/ressl_client.c +++ b/src/lib/libressl/ressl_client.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ressl_client.c,v 1.4 2014/09/29 15:11:29 jsing Exp $ */ | 1 | /* $OpenBSD: ressl_client.c,v 1.5 2014/10/03 14:14:40 tedu Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -142,12 +142,14 @@ ressl_connect_socket(struct ressl *ctx, int socket, const char *hostname) | |||
142 | if (ressl_configure_ssl(ctx) != 0) | 142 | if (ressl_configure_ssl(ctx) != 0) |
143 | goto err; | 143 | goto err; |
144 | 144 | ||
145 | if (ctx->config->verify) { | 145 | if (ctx->config->verify_host) { |
146 | if (hostname == NULL) { | 146 | if (hostname == NULL) { |
147 | ressl_set_error(ctx, "server name not specified"); | 147 | ressl_set_error(ctx, "server name not specified"); |
148 | goto err; | 148 | goto err; |
149 | } | 149 | } |
150 | } | ||
150 | 151 | ||
152 | if (ctx->config->verify_cert) { | ||
151 | SSL_CTX_set_verify(ctx->ssl_ctx, SSL_VERIFY_PEER, NULL); | 153 | SSL_CTX_set_verify(ctx->ssl_ctx, SSL_VERIFY_PEER, NULL); |
152 | 154 | ||
153 | if (SSL_CTX_load_verify_locations(ctx->ssl_ctx, | 155 | if (SSL_CTX_load_verify_locations(ctx->ssl_ctx, |
@@ -188,7 +190,7 @@ ressl_connect_socket(struct ressl *ctx, int socket, const char *hostname) | |||
188 | goto err; | 190 | goto err; |
189 | } | 191 | } |
190 | 192 | ||
191 | if (ctx->config->verify) { | 193 | if (ctx->config->verify_host) { |
192 | cert = SSL_get_peer_certificate(ctx->ssl_conn); | 194 | cert = SSL_get_peer_certificate(ctx->ssl_conn); |
193 | if (cert == NULL) { | 195 | if (cert == NULL) { |
194 | ressl_set_error(ctx, "no server certificate"); | 196 | ressl_set_error(ctx, "no server certificate"); |