From c50b19469e88148dc666eb8881bcdaa53f1b6c14 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 18 May 2020 18:32:01 +0100 Subject: Display errors properly in certificate window --- content/fetchers/about.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'content/fetchers/about.c') diff --git a/content/fetchers/about.c b/content/fetchers/about.c index 6eb882e79..3b8147390 100644 --- a/content/fetchers/about.c +++ b/content/fetchers/about.c @@ -1260,6 +1260,13 @@ format_certificate(struct fetch_about_context *ctx, return res; } + if (cert_info->err != SSL_CERT_ERR_OK) { + res = ssenddataf(ctx, + "
\n" + "

%s

\n", + messages_get_sslcode(cert_info->err)); + } + res = ssenddataf(ctx, "\n" "\n"); @@ -1348,7 +1355,13 @@ format_certificate(struct fetch_about_context *ctx, } res = format_certificate_fingerprint(ctx, cert_info); + if (res != NSERROR_OK) { + return res; + } + if (cert_info->err != SSL_CERT_ERR_OK) { + res = ssenddataf(ctx, "\n"); + } return res; } @@ -1416,6 +1429,12 @@ static bool fetch_about_certificate_handler(struct fetch_about_context *ctx) } + res = ssenddataf(ctx, "\n"); + if (res != NSERROR_OK) { + free_ns_cert_info(cert_info); + goto fetch_about_certificate_handler_aborted; + } + for (depth = 0; depth < chain->depth; depth++) { res = format_certificate(ctx, cert_info + depth, depth); @@ -1427,11 +1446,6 @@ static bool fetch_about_certificate_handler(struct fetch_about_context *ctx) } free_ns_cert_info(cert_info); - res = ssenddataf(ctx, "\n"); - if (res != NSERROR_OK) { - free_ns_cert_info(cert_info); - goto fetch_about_certificate_handler_aborted; - } } else { res = ssenddataf(ctx, "

Invalid certificate data

\n"); -- cgit v1.2.3
Issued To