Display errors properly in certificate window

This commit is contained in:
Vincent Sanders 2020-05-18 18:32:01 +01:00
parent 09accc91e9
commit c50b19469e
2 changed files with 23 additions and 5 deletions

View File

@ -1260,6 +1260,13 @@ format_certificate(struct fetch_about_context *ctx,
return res;
}
if (cert_info->err != SSL_CERT_ERR_OK) {
res = ssenddataf(ctx,
"<div class=\"error\">\n"
"<p><b>%s</b></p>\n",
messages_get_sslcode(cert_info->err));
}
res = ssenddataf(ctx,
"<table class=\"info\">\n"
"<tr><th>Issued To</th><td><hr></td></tr>\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, "</div>\n");
}
return res;
}
@ -1416,6 +1429,12 @@ static bool fetch_about_certificate_handler(struct fetch_about_context *ctx)
}
res = ssenddataf(ctx, "</ul>\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, "</ul>\n");
if (res != NSERROR_OK) {
free_ns_cert_info(cert_info);
goto fetch_about_certificate_handler_aborted;
}
} else {
res = ssenddataf(ctx,
"<p>Invalid certificate data</p>\n");

View File

@ -214,6 +214,10 @@ body#certificate table.info td.data {
font-size: 90%;
}
body#certificate div.error {
background: #FFEAEA;
}
/*
* configuration listing style