From b28d3c267510d2e80e4730f71ff1fa5f61795499 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Fri, 22 May 2020 10:37:15 +0100 Subject: query/ssl: Include link to view certificate details Signed-off-by: Daniel Silverstone --- content/fetchers/about.c | 10 +++++++++- desktop/browser_window.c | 17 +++++++++++++++++ resources/FatMessages | 5 +++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/content/fetchers/about.c b/content/fetchers/about.c index d7c1f7e7e..532223fbb 100644 --- a/content/fetchers/about.c +++ b/content/fetchers/about.c @@ -2199,6 +2199,7 @@ static bool fetch_about_query_privacy_handler(struct fetch_about_context *ctx) const char *title; struct nsurl *siteurl = NULL; char *description = NULL; + const char *chainurl = ""; const struct fetch_multipart_data *curmd; /* mutipart data iterator */ /* extract parameters from multipart post data */ @@ -2211,6 +2212,8 @@ static bool fetch_about_query_privacy_handler(struct fetch_about_context *ctx) } } else if (strcmp(curmd->name, "reason") == 0) { reason = curmd->value; + } else if (strcmp(curmd->name, "chainurl") == 0) { + chainurl = curmd->value; } curmd = curmd->next; } @@ -2258,7 +2261,12 @@ static bool fetch_about_query_privacy_handler(struct fetch_about_context *ctx) goto fetch_about_query_ssl_handler_aborted; } } - res = ssenddataf(ctx, "

%s

", reason); + res = ssenddataf(ctx, + "

%s

" + "

%s

", + reason, + chainurl, + messages_get("ViewCertificates")); if (res != NSERROR_OK) { goto fetch_about_query_ssl_handler_aborted; } diff --git a/desktop/browser_window.c b/desktop/browser_window.c index 60f8d8947..2dcd0791d 100644 --- a/desktop/browser_window.c +++ b/desktop/browser_window.c @@ -1125,6 +1125,7 @@ browser_window__handle_bad_certs(struct browser_window *bw, /* Initially we don't know WHY the SSL cert was bad */ const char *reason = messages_get_sslcode(SSL_CERT_ERR_UNKNOWN); size_t depth; + nsurl *chainurl = NULL; memset(¶ms, 0, sizeof(params)); @@ -1157,6 +1158,20 @@ browser_window__handle_bad_certs(struct browser_window *bw, goto out; } + err = cert_chain_to_query(bw->loading_cert_chain, &chainurl); + + if (err != NSERROR_OK) { + goto out; + } + + err = fetch_multipart_data_new_kv(¶ms.post_multipart, + "chainurl", + nsurl_access(chainurl)); + + if (err != NSERROR_OK) { + goto out; + } + /* Now we issue the fetch */ bw->internal_nav = true; err = browser_window__navigate_internal(bw, ¶ms); @@ -1166,6 +1181,8 @@ browser_window__handle_bad_certs(struct browser_window *bw, out: browser_window__free_fetch_parameters(¶ms); + if (chainurl != NULL) + nsurl_unref(chainurl); return err; } diff --git a/resources/FatMessages b/resources/FatMessages index 671ba2832..cbbead236 100644 --- a/resources/FatMessages +++ b/resources/FatMessages @@ -1078,6 +1078,11 @@ it.all.PrivacyTitle:Errore della privacy nl.all.PrivacyTitle:Privacyfout en.all.PrivacyDescription:A privacy error occurred while communicating with %s this may be a site configuration error or an attempt to steal private information (passwords, messages or credit cards) it.all.PrivacyDescription:Si è verificato un errore della privacy durante la comunicazione con %s fai attenzione, questo potrebbe essere un errore di configurazione del sito oppure un tentativo di rubare informazioni private (password, messaggi o numeri di carte di credito) +en.all.ViewCertificates:View certificate details +de.all.ViewCertificates:Zertifikatdetails anzeigen +fr.all.ViewCertificates:Afficher les détails du certificat +it.all.ViewCertificates:Visualizza i dettagli del certificato +nl.all.ViewCertificates:Bekijk certificaatdetails en.all.Proceed:Proceed de.all.Proceed:Vorgehen fr.all.Proceed:Procéder -- cgit v1.2.3