Skip to content

Commit

Permalink
Use gnutls_certificate_set_x509_system_trust() where available
Browse files Browse the repository at this point in the history
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jun 10, 2012
1 parent 935e6e2 commit 768e287
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions configure.ac
Expand Up @@ -199,6 +199,8 @@ if test "$with_gnutls" = "yes" || test "$with_gnutls" = "shibboleet"; then
ssl_library=gnutls
oldlibs="$LIBS"
LIBS="$LIBS $GNUTLS_LIBS"
AC_CHECK_FUNC(gnutls_certificate_set_x509_system_trust,
[AC_DEFINE(HAVE_GNUTLS_CERTIFICATE_SET_X509_SYSTEM_TRUST, 1)], [])
AC_CHECK_FUNC(gnutls_pkcs12_simple_parse,
[AC_DEFINE(HAVE_GNUTLS_PKCS12_SIMPLE_PARSE, 1)], [])
AC_CHECK_FUNC(gnutls_session_set_premaster,
Expand Down
4 changes: 4 additions & 0 deletions gnutls.c
Expand Up @@ -941,9 +941,13 @@ int openconnect_open_https(struct openconnect_info *vpninfo)

if (!vpninfo->https_cred) {
gnutls_certificate_allocate_credentials(&vpninfo->https_cred);
#ifdef HAVE_GNUTLS_CERTIFICATE_SET_X509_SYSTEM_TRUST
gnutls_certificate_set_x509_system_trust(vpninfo->https_cred);
#else
gnutls_certificate_set_x509_trust_file(vpninfo->https_cred,
"/etc/pki/tls/certs/ca-bundle.crt",
GNUTLS_X509_FMT_PEM);
#endif
gnutls_certificate_set_verify_function (vpninfo->https_cred,
verify_peer);
/* FIXME: Ensure TLSv1.0, no options */
Expand Down

0 comments on commit 768e287

Please sign in to comment.