diff options
| author | bcook <> | 2014-12-07 16:56:17 +0000 |
|---|---|---|
| committer | bcook <> | 2014-12-07 16:56:17 +0000 |
| commit | 26bb73d6664efd39d99f8477df943507a7f03b5e (patch) | |
| tree | 5c66d957212c1e16825ea92d01779555b1a78024 /src/lib/libtls/tls_client.c | |
| parent | ee67fae33e31b0a137774a402a100e614c3cbc9d (diff) | |
| download | openbsd-26bb73d6664efd39d99f8477df943507a7f03b5e.tar.gz openbsd-26bb73d6664efd39d99f8477df943507a7f03b5e.tar.bz2 openbsd-26bb73d6664efd39d99f8477df943507a7f03b5e.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.c | 9 |
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 | } |
