diff options
| author | beck <> | 2026-08-26 16:25:12 +0000 |
|---|---|---|
| committer | beck <> | 2026-08-26 16:25:12 +0000 |
| commit | 85f442b9807a72de444e8a0c8670310031ffd5e8 (patch) | |
| tree | aa08bb263c3b4fbd5eed9304c708e6d367f72dd9 /src/lib | |
| parent | fdfc50d36c7ad9d362a0a6c0043189e17aa2c87d (diff) | |
| download | openbsd-85f442b9807a72de444e8a0c8670310031ffd5e8.tar.gz openbsd-85f442b9807a72de444e8a0c8670310031ffd5e8.tar.bz2 openbsd-85f442b9807a72de444e8a0c8670310031ffd5e8.zip | |
Don't drop X509_V_ERR_HOSTNAME_MISMATCH when verify callback returns 1
While not the advised way of using the verify callback (either by OpenSSL
or by us) in production, sometimes folks like to return 1 from everything
in the callback and then check the error return and make decicions about
things.
This fix ensures that such callbacks will see the hostname mismatch and
be able to act upon them.
Reported by Alexander Aleksandrovic Klimov
ok tb@
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/libcrypto/x509/x509_verify.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509_verify.c b/src/lib/libcrypto/x509/x509_verify.c index e0efa9ffc5..a8fd5a37d3 100644 --- a/src/lib/libcrypto/x509/x509_verify.c +++ b/src/lib/libcrypto/x509/x509_verify.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_verify.c,v 1.78 2026/07/31 03:59:50 kenjiro Exp $ */ | 1 | /* $OpenBSD: x509_verify.c,v 1.79 2026/08/26 16:25:12 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| @@ -760,8 +760,11 @@ x509_verify_cert_hostname(struct x509_verify_ctx *ctx, X509 *cert, char *name) | |||
| 760 | if (ctx->xsc != NULL) { | 760 | if (ctx->xsc != NULL) { |
| 761 | int ret; | 761 | int ret; |
| 762 | 762 | ||
| 763 | if ((ret = x509_vfy_check_id(ctx->xsc)) == 0) | 763 | ret = x509_vfy_check_id(ctx->xsc); |
| 764 | if (ctx->xsc->error != X509_V_OK) { | ||
| 764 | ctx->error = ctx->xsc->error; | 765 | ctx->error = ctx->xsc->error; |
| 766 | ctx->error_depth = ctx->xsc->error_depth; | ||
| 767 | } | ||
| 765 | return ret; | 768 | return ret; |
| 766 | } | 769 | } |
| 767 | return 1; | 770 | return 1; |
