From e95fdc3a0a089133b01ea08d1fc23196b08c07ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Tue, 4 May 2021 20:37:15 +0200 Subject: [PATCH] core: display a warning when the file with certificate authorities is not found (option weechat.network.gnutls_ca_file) --- ChangeLog.adoc | 1 + po/cs.po | 10 +++++++++- po/de.po | 11 ++++++++++- po/es.po | 10 +++++++++- po/fr.po | 16 ++++++++++++++-- po/hu.po | 10 +++++++++- po/it.po | 10 +++++++++- po/ja.po | 10 +++++++++- po/pl.po | 10 +++++++++- po/pt.po | 10 +++++++++- po/pt_BR.po | 10 +++++++++- po/ru.po | 10 +++++++++- po/tr.po | 10 +++++++++- po/weechat.pot | 10 +++++++++- src/core/wee-network.c | 25 +++++++++++++++++++++++-- 15 files changed, 147 insertions(+), 16 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 90153fde9..47ac50c22 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -28,6 +28,7 @@ New features:: Bug fixes:: + * core: display a warning when the file with certificate authorities is not found (option weechat.network.gnutls_ca_file) * core: evaluate left/right part of comparison after split on the comparison operator in ${if:xxx} (issue #1627) * core: prevent switching to start of visited buffers when jumping to next (issue #1591, issue #1592) * core: recreate buflist and fset bars on /reload when WeeChat is started without configuration files (issue #1618) diff --git a/po/cs.po b/po/cs.po index ca959c0c8..793cdf2b3 100644 --- a/po/cs.po +++ b/po/cs.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-04-11 09:28+0200\n" +"POT-Creation-Date: 2021-05-04 20:34+0200\n" "PO-Revision-Date: 2021-02-06 15:55+0100\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -4321,6 +4321,14 @@ msgstr "" "Pokud používá tento soubor jiný proces WeeChat, skuste WeeChat pustit\n" "s jiným domovským adresářem pomocí \"--dir\" volby příkazové řádky.\n" +#, fuzzy, c-format +msgid "%sWarning: failed to load certificate authorities from file %s" +msgstr "%sgnutls: nemůžu číst certifikát \"%s\"" + +#, c-format +msgid "%sWarning: no certificate authorities loaded (file not found: %s)" +msgstr "" + msgid "set server name indication (SNI) failed" msgstr "" diff --git a/po/de.po b/po/de.po index b41b7f4ae..3f1f2a749 100644 --- a/po/de.po +++ b/po/de.po @@ -24,7 +24,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-04-11 09:28+0200\n" +"POT-Creation-Date: 2021-05-04 20:34+0200\n" "PO-Revision-Date: 2021-04-13 11:40+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -5249,6 +5249,15 @@ msgstr "" "Verwendung der \"--dir\" Kommandozeilenoption, WeeChat in einem anderen " "Verzeichnis zu starten.\n" +#, fuzzy, c-format +msgid "%sWarning: failed to load certificate authorities from file %s" +msgstr "" +"%sgnutls: Zertifikat für Fingerprint (%s) konnte nicht berechnet werden" + +#, c-format +msgid "%sWarning: no certificate authorities loaded (file not found: %s)" +msgstr "" + msgid "set server name indication (SNI) failed" msgstr "Server Name Indication (SNI) konnte nicht gesetzt werden" diff --git a/po/es.po b/po/es.po index fc06a1769..cd0d4ed6b 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-04-11 09:28+0200\n" +"POT-Creation-Date: 2021-05-04 20:34+0200\n" "PO-Revision-Date: 2021-02-06 15:55+0100\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -4516,6 +4516,14 @@ msgstr "" "con otro directorio de inicio usando la opción de línea de comandos \"--dir" "\"\n" +#, fuzzy, c-format +msgid "%sWarning: failed to load certificate authorities from file %s" +msgstr "%sgnutls: no es posible leer el certificado \"%s\"" + +#, c-format +msgid "%sWarning: no certificate authorities loaded (file not found: %s)" +msgstr "" + msgid "set server name indication (SNI) failed" msgstr "" diff --git a/po/fr.po b/po/fr.po index 8026b67e7..ac3ec4d92 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-04-11 09:28+0200\n" -"PO-Revision-Date: 2021-04-11 09:29+0200\n" +"POT-Creation-Date: 2021-05-04 20:34+0200\n" +"PO-Revision-Date: 2021-05-04 20:35+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -5120,6 +5120,18 @@ msgstr "" "un autre répertoire de base en utilisant l'option de ligne de commande \"--" "dir\".\n" +#, c-format +msgid "%sWarning: failed to load certificate authorities from file %s" +msgstr "" +"%sAttention : échec de chargement des autorités de certification depuis le " +"fichier %s" + +#, c-format +msgid "%sWarning: no certificate authorities loaded (file not found: %s)" +msgstr "" +"%sAttention : aucune autorité de certification chargée (fichier non trouvé : " +"%s)" + msgid "set server name indication (SNI) failed" msgstr "la définition de l'indication de nom de serveur (SNI) a échoué" diff --git a/po/hu.po b/po/hu.po index 3d9f42370..7607c17dd 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-04-11 09:28+0200\n" +"POT-Creation-Date: 2021-05-04 20:34+0200\n" "PO-Revision-Date: 2021-02-06 15:55+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -3878,6 +3878,14 @@ msgstr "" "Ha egy másik WeeChat folyamat használja ezt a fájlt, próbálja másik\n" "saját könyvtárral futtatni a WeeChat-et a \"--dir\" opció segítségével!\n" +#, fuzzy, c-format +msgid "%sWarning: failed to load certificate authorities from file %s" +msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n" + +#, c-format +msgid "%sWarning: no certificate authorities loaded (file not found: %s)" +msgstr "" + msgid "set server name indication (SNI) failed" msgstr "" diff --git a/po/it.po b/po/it.po index e1c63eb9e..77d1b693e 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-04-11 09:28+0200\n" +"POT-Creation-Date: 2021-05-04 20:34+0200\n" "PO-Revision-Date: 2021-02-06 15:55+0100\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -4634,6 +4634,14 @@ msgstr "" "Se un'altra istanza di WeeChat usa questo file, eseguire WeeChat\n" "con un'altra home usando l'opzione da riga di comando \"--dir\".\n" +#, fuzzy, c-format +msgid "%sWarning: failed to load certificate authorities from file %s" +msgstr "%sgnutls: impossibile leggere il certificato \"%s\"" + +#, c-format +msgid "%sWarning: no certificate authorities loaded (file not found: %s)" +msgstr "" + msgid "set server name indication (SNI) failed" msgstr "" diff --git a/po/ja.po b/po/ja.po index 22974fe04..f0f33c89a 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-04-11 09:28+0200\n" +"POT-Creation-Date: 2021-05-04 20:34+0200\n" "PO-Revision-Date: 2021-02-06 15:55+0100\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" "Language-Team: Polish \n" @@ -5004,6 +5004,14 @@ msgstr "" "Jeżeli inny proces WeeChat używa tego pliku, spróbuj uruchomić WeeChat\n" "w innym katalogu domowym używając w linii komend opcji \"--dir\".\n" +#, fuzzy, c-format +msgid "%sWarning: failed to load certificate authorities from file %s" +msgstr "%sgnutls: nie udało się wyliczyć odcisku certyfikatu (%s)" + +#, c-format +msgid "%sWarning: no certificate authorities loaded (file not found: %s)" +msgstr "" + msgid "set server name indication (SNI) failed" msgstr "ustawianie wskaźnika nazwy serwera (SNI) się nie powiodło" diff --git a/po/pt.po b/po/pt.po index abdbebd24..82bd4636e 100644 --- a/po/pt.po +++ b/po/pt.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-04-11 09:28+0200\n" +"POT-Creation-Date: 2021-05-04 20:34+0200\n" "PO-Revision-Date: 2021-02-06 15:55+0100\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" @@ -4893,6 +4893,14 @@ msgstr "" "WeeChat\n" "com outro diretório usando a opção \"--dir\" na linha de comandos.\n" +#, fuzzy, c-format +msgid "%sWarning: failed to load certificate authorities from file %s" +msgstr "%sgnutls: falha ao calcular impressão digital do certificado (%s)" + +#, c-format +msgid "%sWarning: no certificate authorities loaded (file not found: %s)" +msgstr "" + msgid "set server name indication (SNI) failed" msgstr "falha ao definir indicação do nome de servidor (SNI)" diff --git a/po/pt_BR.po b/po/pt_BR.po index 5e26998b8..cb6e86d93 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-04-11 09:28+0200\n" +"POT-Creation-Date: 2021-05-04 20:34+0200\n" "PO-Revision-Date: 2021-03-05 20:43+0100\n" "Last-Translator: Érico Nogueira \n" "Language-Team: weechat-dev \n" @@ -4506,6 +4506,14 @@ msgid "" "with another home using the \"--dir\" command line option.\n" msgstr "" +#, fuzzy, c-format +msgid "%sWarning: failed to load certificate authorities from file %s" +msgstr "%sgnutls: não foi possível ler certificado \"%s\"" + +#, c-format +msgid "%sWarning: no certificate authorities loaded (file not found: %s)" +msgstr "" + msgid "set server name indication (SNI) failed" msgstr "" diff --git a/po/ru.po b/po/ru.po index 88cfe7b60..90a588646 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-04-11 09:28+0200\n" +"POT-Creation-Date: 2021-05-04 20:34+0200\n" "PO-Revision-Date: 2021-02-06 15:55+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -3908,6 +3908,14 @@ msgstr "" "WeeChat\n" "с другой домашней директорией используя параметр \"--dir\".\n" +#, fuzzy, c-format +msgid "%sWarning: failed to load certificate authorities from file %s" +msgstr "Не могу записать лог-файл \"%s\"\n" + +#, c-format +msgid "%sWarning: no certificate authorities loaded (file not found: %s)" +msgstr "" + msgid "set server name indication (SNI) failed" msgstr "" diff --git a/po/tr.po b/po/tr.po index 0c18c29cf..15e8099ba 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-04-11 09:28+0200\n" +"POT-Creation-Date: 2021-05-04 20:34+0200\n" "PO-Revision-Date: 2021-02-06 15:55+0100\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -3520,6 +3520,14 @@ msgid "" "with another home using the \"--dir\" command line option.\n" msgstr "" +#, fuzzy, c-format +msgid "%sWarning: failed to load certificate authorities from file %s" +msgstr "%sHata: dosya \"%s\" oluşturulamaz" + +#, c-format +msgid "%sWarning: no certificate authorities loaded (file not found: %s)" +msgstr "" + msgid "set server name indication (SNI) failed" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index 6c8adb26c..632a02251 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-04-11 09:28+0200\n" +"POT-Creation-Date: 2021-05-04 20:34+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -3509,6 +3509,14 @@ msgid "" "with another home using the \"--dir\" command line option.\n" msgstr "" +#, c-format +msgid "%sWarning: failed to load certificate authorities from file %s" +msgstr "" + +#, c-format +msgid "%sWarning: no certificate authorities loaded (file not found: %s)" +msgstr "" + msgid "set server name indication (SNI) failed" msgstr "" diff --git a/src/core/wee-network.c b/src/core/wee-network.c index eba23c909..056a0c2f6 100644 --- a/src/core/wee-network.c +++ b/src/core/wee-network.c @@ -61,6 +61,7 @@ #include "wee-config.h" #include "wee-proxy.h" #include "wee-string.h" +#include "../gui/gui-chat.h" #include "../plugins/plugin.h" @@ -102,8 +103,28 @@ network_set_gnutls_ca_file () ca_path2 = string_replace (ca_path, "%h", weechat_home); if (ca_path2) { - gnutls_certificate_set_x509_trust_file (gnutls_xcred, ca_path2, - GNUTLS_X509_FMT_PEM); + if (access (ca_path2, R_OK) == 0) + { + if (gnutls_certificate_set_x509_trust_file (gnutls_xcred, ca_path2, + GNUTLS_X509_FMT_PEM) < 0) + { + gui_chat_printf ( + NULL, + _("%sWarning: failed to load certificate authorities " + "from file %s"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + ca_path2); + } + } + else + { + gui_chat_printf ( + NULL, + _("%sWarning: no certificate authorities loaded " + "(file not found: %s)"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + ca_path2); + } free (ca_path2); } free (ca_path);