This allows the system default trusted certs file to be specified, so
every user doesn't have to configure it themself.
Without a specified file, configure will scan a list of common
locations. The list of paths was derived from curl's acinclude.m4
file. Thanks to Dan Fandrich for the link to curl's file, and to Todd
Zullinger for some additions to the list.
---
configure.ac | 37 +++++++++++++++++++++++++++++++++++++
init.h | 2 +-
2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index b4a0874f..6b2a2c31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -856,6 +856,12 @@ AC_ARG_WITH(ssl,
AS_HELP_STRING([--with-ssl@<:@=PFX@:>@],[Enable TLS support usi
AC_ARG_WITH([gnutls], AS_HELP_STRING([--with-gnutls@<:@=PFX@:>@],[enable TLS
support using gnutls]),
[gnutls_prefix="$withval"], [gnutls_prefix="no"])
+
+AC_ARG_WITH([gnutls-default-ca-cert-file],
+
AS_HELP_STRING([--with-gnutls-default-ca-cert-file@<:@=FILE@:>@],[Default
trusted CA certificates]),
+ [],
+ [with_gnutls_default_ca_cert_file="no"])
+
if test "$gnutls_prefix" != "no" && test x"$need_ssl" != xyes
then
if test "$need_socket" != "yes"
@@ -893,6 +899,37 @@ then
MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_gnutls.o"
need_ssl=yes],
[AC_MSG_ERROR([could not find libgnutls])])
+
+ mutt_cv_ca_file=""
+ if test x"$with_gnutls_default_ca_cert_file" = x"yes"; then
+ AC_MSG_CHECKING([for gnutls_default_ca_cert_file in common locations])
+ for f in /etc/ssl/certs/ca-certificates.crt \
+ /etc/pki/tls/certs/ca-bundle.crt \
+ /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem \
+ /usr/share/ssl/certs/ca-bundle.crt \
+ /usr/local/share/certs/ca-root-nss.crt \
+ /etc/ssl/cert.pem ; do
+ if test -f $f; then
+ AC_MSG_RESULT([$f])
+ mutt_cv_ca_file="$f"
+ break
+ fi
+ done
+
+ if test x"$mutt_cv_ca_file" = x""; then
+ AC_MSG_RESULT([not found])
+ fi
+ elif test x"$with_gnutls_default_ca_cert_file" != x"no"; then
+ mutt_cv_ca_file="$with_gnutls_default_ca_cert_file"
+ fi
+
+ if test x"$mutt_cv_ca_file" != x""; then
+ AC_DEFINE_UNQUOTED([GNUTLS_DEFAULT_CA_FILE], ["$mutt_cv_ca_file"],
+ [Path to default value for
$ssl_ca_certificates_file])
+ else
+ AC_DEFINE([GNUTLS_DEFAULT_CA_FILE], 0,
+ [Path to default value for $ssl_ca_certificates_file])
+ fi
fi
fi
diff --git a/init.h b/init.h
index 31665776..8edcd8c2 100644
--- a/init.h
+++ b/init.h
@@ -4371,7 +4371,7 @@ struct option_t MuttVars[] = {
*/
#if defined(USE_SSL)
# ifdef USE_SSL_GNUTLS
- { "ssl_ca_certificates_file", DT_PATH, R_NONE, {.p=&SslCACertFile}, {.p=0} },
+ { "ssl_ca_certificates_file", DT_PATH, R_NONE, {.p=&SslCACertFile},
{.p=GNUTLS_DEFAULT_CA_FILE} },
/*
** .pp
** This variable specifies a file containing trusted CA certificates.
--
2.56.1