summaryrefslogtreecommitdiff
path: root/src/modules/extra/m_ssl_gnutls.cpp
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-08-13 14:10:04 +0200
committerattilamolnar <attilamolnar@hush.com>2013-08-13 14:10:04 +0200
commit5f223beeaee91d8827454475c4ef6f679af4385d (patch)
treedf611db7141332a862931a30c3a0adc93b1cb0f3 /src/modules/extra/m_ssl_gnutls.cpp
parent1be212b865b3cab816cd3cb49b527add3cac6826 (diff)
m_ssl_gnutls Fix feature testing and cipher suite related errors on older GnuTLS versions
Use the (old) LIBGNUTLS_VERSION_* defines as a fallback when GNUTLS_VERSION_* is unavailable Fixes #595 reported by @rhylan
Diffstat (limited to 'src/modules/extra/m_ssl_gnutls.cpp')
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index 41e9d0c3d..1f1297ef9 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -44,8 +44,14 @@
/* $LinkerFlags: rpath("pkg-config --libs gnutls") pkgconflibs("gnutls","/libgnutls.so","-lgnutls") exec("libgcrypt-config --libs") */
/* $NoPedantic */
+#ifndef GNUTLS_VERSION_MAJOR
+#define GNUTLS_VERSION_MAJOR LIBGNUTLS_VERSION_MAJOR
+#define GNUTLS_VERSION_MINOR LIBGNUTLS_VERSION_MINOR
+#define GNUTLS_VERSION_PATCH LIBGNUTLS_VERSION_PATCH
+#endif
+
// These don't exist in older GnuTLS versions
-#if ((GNUTLS_VERSION_MAJOR > 2) || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR > 1) || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR == 1 && GNUTLS_VERSION_MICRO >= 7))
+#if ((GNUTLS_VERSION_MAJOR > 2) || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR > 1) || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR == 1 && GNUTLS_VERSION_PATCH >= 7))
#define GNUTLS_NEW_PRIO_API
#endif
@@ -570,6 +576,8 @@ class ModuleSSLGnuTLS : public Module
#ifdef GNUTLS_NEW_PRIO_API
gnutls_priority_set(session->sess, priority);
+ #else
+ gnutls_set_default_priority(session->sess);
#endif
gnutls_credentials_set(session->sess, GNUTLS_CRD_CERTIFICATE, x509_cred);
gnutls_dh_set_prime_bits(session->sess, dh_bits);