summaryrefslogtreecommitdiff
path: root/src/core/wee-network.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2021-05-04 20:37:15 +0200
committerSébastien Helleu <flashcode@flashtux.org>2021-05-04 20:37:15 +0200
commite95fdc3a0a089133b01ea08d1fc23196b08c07ae (patch)
treefd66b43b74f6af570713b40e9a00e817f0aa67a0 /src/core/wee-network.c
parent9f0e7fb47ec2feb551a30b39dde114b1074acb16 (diff)
downloadweechat-e95fdc3a0a089133b01ea08d1fc23196b08c07ae.zip
core: display a warning when the file with certificate authorities is not found (option weechat.network.gnutls_ca_file)
Diffstat (limited to 'src/core/wee-network.c')
-rw-r--r--src/core/wee-network.c25
1 files changed, 23 insertions, 2 deletions
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);