commit 31dc76667294e4304f7149af8bf22cd2a5252b2f
parent fa1278d30b9ab7ccf3cbefbf44d28908f8a2cd6b
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Thu, 15 Nov 2018 08:31:33 +0100
Sanitize filenames for saved TLS certificates.
Fixes using unsafe_ssl_certs pref on Windows, as that
includes certificate fingerprint in the filename.
Fingerprints contain colons, and those are not allowed
in filenames on Windows.
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/common/ssl_certificate.c b/src/common/ssl_certificate.c
@@ -54,14 +54,19 @@ gboolean prefs_common_unsafe_ssl_certs(void);
static gchar *get_certificate_path(const gchar *host, const gchar *port, const gchar *fp)
{
+ gchar *ret;
+
if (fp != NULL && prefs_common_unsafe_ssl_certs())
- return g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+ ret = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
"certs", G_DIR_SEPARATOR_S,
host, ".", port, ".", fp, ".cert", NULL);
else
- return g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+ ret = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
"certs", G_DIR_SEPARATOR_S,
host, ".", port, ".cert", NULL);
+
+ subst_for_filename(ret);
+ return ret;
}
static gchar *get_certificate_chain_path(const gchar *host, const gchar *port, const gchar *fp)