From c50b19469e88148dc666eb8881bcdaa53f1b6c14 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 18 May 2020 18:32:01 +0100 Subject: [PATCH] Display errors properly in certificate window --- content/fetchers/about.c | 24 +++++++++++++++++++----- resources/internal.css | 4 ++++ 2 files changed, 23 insertions(+), 5 deletions(-) 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"); diff --git a/resources/internal.css b/resources/internal.css index a6b666b67..d6278ca6a 100644 --- a/resources/internal.css +++ b/resources/internal.css @@ -214,6 +214,10 @@ body#certificate table.info td.data { font-size: 90%; } +body#certificate div.error { + background: #FFEAEA; +} + /* * configuration listing style
Issued To