summaryrefslogtreecommitdiff
path: root/src/lib/libtls/tls_client.c
diff options
context:
space:
mode:
authorbcook <>2014-12-07 16:56:17 +0000
committerbcook <>2014-12-07 16:56:17 +0000
commitdf159794178eaab75bdfe6f692e876f2da10c396 (patch)
tree5c66d957212c1e16825ea92d01779555b1a78024 /src/lib/libtls/tls_client.c
parent6095fdcf15afb6c9da4fd123ad558a7abb9e2524 (diff)
downloadopenbsd-df159794178eaab75bdfe6f692e876f2da10c396.tar.gz
openbsd-df159794178eaab75bdfe6f692e876f2da10c396.tar.bz2
openbsd-df159794178eaab75bdfe6f692e876f2da10c396.zip
Allow specific libtls hostname validation errors to propagate.
Remove direct calls to printf from the tls_check_hostname() path. This allows NUL byte error messages to bubble up to the caller, to be logged in a program-appropriate way. It also removes non-portable calls to getprogname(). ok jsing@
Diffstat (limited to '')
-rw-r--r--src/lib/libtls/tls_client.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/libtls/tls_client.c b/src/lib/libtls/tls_client.c
index b851a6ecd0..43819cf0b6 100644
--- a/src/lib/libtls/tls_client.c
+++ b/src/lib/libtls/tls_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_client.c,v 1.4 2014/12/07 15:48:02 bcook Exp $ */ 1/* $OpenBSD: tls_client.c,v 1.5 2014/12/07 16:56:17 bcook Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -209,9 +209,10 @@ tls_connect_fds(struct tls *ctx, int fd_read, int fd_write,
209 tls_set_error(ctx, "no server certificate"); 209 tls_set_error(ctx, "no server certificate");
210 goto err; 210 goto err;
211 } 211 }
212 if (tls_check_hostname(cert, hostname) != 0) { 212 if ((ret = tls_check_hostname(ctx, cert, hostname)) != 0) {
213 tls_set_error(ctx, "host `%s' not present in" 213 if (ret != -2)
214 " server certificate", hostname); 214 tls_set_error(ctx, "host `%s' not present in"
215 " server certificate", hostname);
215 goto err; 216 goto err;
216 } 217 }
217 } 218 }