From af4c21ccdb1d787e94073e619edb68c07af73998 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Wed, 23 Mar 2016 20:17:07 +0100 Subject: [PATCH] Issue #126: fixed deprecated GnuTLS types. --- src/vmime/net/tls/gnutls/TLSSession_GnuTLS.cpp | 6 +++--- src/vmime/net/tls/gnutls/TLSSession_GnuTLS.hpp | 2 +- src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp | 10 +++++----- src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.hpp | 6 +++--- .../cert/gnutls/X509Certificate_GnuTLS.cpp | 14 +++++++------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/vmime/net/tls/gnutls/TLSSession_GnuTLS.cpp b/src/vmime/net/tls/gnutls/TLSSession_GnuTLS.cpp index 45cdad61..2a6450eb 100644 --- a/src/vmime/net/tls/gnutls/TLSSession_GnuTLS.cpp +++ b/src/vmime/net/tls/gnutls/TLSSession_GnuTLS.cpp @@ -122,8 +122,8 @@ struct TLSGlobal #endif // VMIME_DEBUG && GNUTLS_DEBUG - gnutls_anon_client_credentials anonCred; - gnutls_certificate_credentials certCred; + gnutls_anon_client_credentials_t anonCred; + gnutls_certificate_credentials_t certCred; }; static TLSGlobal g_gnutlsGlobal; @@ -145,7 +145,7 @@ TLSSession_GnuTLS::TLSSession_GnuTLS(shared_ptr (trspt); return sok->m_errno; @@ -362,7 +362,7 @@ int TLSSocket_GnuTLS::gnutlsErrnoFunc(gnutls_transport_ptr trspt) ssize_t TLSSocket_GnuTLS::gnutlsPushFunc - (gnutls_transport_ptr trspt, const void* data, size_t len) + (gnutls_transport_ptr_t trspt, const void* data, size_t len) { TLSSocket_GnuTLS* sok = reinterpret_cast (trspt); @@ -392,7 +392,7 @@ ssize_t TLSSocket_GnuTLS::gnutlsPushFunc ssize_t TLSSocket_GnuTLS::gnutlsPullFunc - (gnutls_transport_ptr trspt, void* data, size_t len) + (gnutls_transport_ptr_t trspt, void* data, size_t len) { TLSSocket_GnuTLS* sok = reinterpret_cast (trspt); @@ -427,14 +427,14 @@ shared_ptr TLSSocket_GnuTLS::getPeerCertifica getTracer()->traceSend("Getting peer certificates"); unsigned int certCount = 0; - const gnutls_datum* rawData = gnutls_certificate_get_peers + const gnutls_datum_t* rawData = gnutls_certificate_get_peers (*m_session->m_gnutlsSession, &certCount); if (rawData == NULL) return null; // Try X.509 - gnutls_x509_crt* x509Certs = new gnutls_x509_crt[certCount]; + gnutls_x509_crt_t* x509Certs = new gnutls_x509_crt_t[certCount]; for (unsigned int i = 0; i < certCount; ++i) { diff --git a/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.hpp b/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.hpp index def45418..502d08dc 100644 --- a/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.hpp +++ b/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.hpp @@ -91,9 +91,9 @@ private: void internalThrow(); #ifdef LIBGNUTLS_VERSION - static ssize_t gnutlsPushFunc(gnutls_transport_ptr trspt, const void* data, size_t len); - static ssize_t gnutlsPullFunc(gnutls_transport_ptr trspt, void* data, size_t len); - static int gnutlsErrnoFunc(gnutls_transport_ptr trspt); + static ssize_t gnutlsPushFunc(gnutls_transport_ptr_t trspt, const void* data, size_t len); + static ssize_t gnutlsPullFunc(gnutls_transport_ptr_t trspt, void* data, size_t len); + static int gnutlsErrnoFunc(gnutls_transport_ptr_t trspt); #else static int gnutlsPushFunc(void* trspt, const void* data, size_t len); static int gnutlsPullFunc(void* trspt, void* data, size_t len); diff --git a/src/vmime/security/cert/gnutls/X509Certificate_GnuTLS.cpp b/src/vmime/security/cert/gnutls/X509Certificate_GnuTLS.cpp index 9e32b3dd..85cfb1de 100644 --- a/src/vmime/security/cert/gnutls/X509Certificate_GnuTLS.cpp +++ b/src/vmime/security/cert/gnutls/X509Certificate_GnuTLS.cpp @@ -57,7 +57,7 @@ struct GnuTLSX509CertificateInternalData } - gnutls_x509_crt cert; + gnutls_x509_crt_t cert; }; #endif // VMIME_BUILDING_DOC @@ -108,7 +108,7 @@ shared_ptr X509Certificate::import(utility::inputStream& is) shared_ptr X509Certificate::import (const byte_t* data, const size_t length) { - gnutls_datum buffer; + gnutls_datum_t buffer; buffer.data = const_cast (data); buffer.size = static_cast (length); @@ -132,7 +132,7 @@ void X509Certificate_GnuTLS::write (utility::outputStream& os, const Format format) const { size_t dataSize = 0; - gnutls_x509_crt_fmt fmt = GNUTLS_X509_FMT_DER; + gnutls_x509_crt_fmt_t fmt = GNUTLS_X509_FMT_DER; switch (format) { @@ -203,15 +203,15 @@ bool X509Certificate_GnuTLS::verifyHostName dnsNameLength = sizeof(dnsName); - if (gnutls_x509_crt_get_dn_by_oid(m_data->cert, OID_X520_COMMON_NAME, 0, 0, dnsName, &dnsNameLength) >= 0) + if (gnutls_x509_crt_get_dn_by_oid(m_data->cert, OID_X520_COMMON_NAME, 0, 0, dnsName, &dnsNameLength) >= 0) nonMatchingNames->push_back(dnsName); - for (int i = 0, ret = 0 ; ret >= 0 ; ++i) + for (int i = 0, ret = 0 ; ret >= 0 ; ++i) { dnsNameLength = sizeof(dnsName); ret = gnutls_x509_crt_get_subject_alt_name(m_data->cert, i, dnsName, &dnsNameLength, NULL); - if (ret == GNUTLS_SAN_DNSNAME) + if (ret == GNUTLS_SAN_DNSNAME) nonMatchingNames->push_back(dnsName); } } @@ -236,7 +236,7 @@ const datetime X509Certificate_GnuTLS::getExpirationDate() const const byteArray X509Certificate_GnuTLS::getFingerprint(const DigestAlgorithm algo) const { - gnutls_digest_algorithm galgo; + gnutls_digest_algorithm_t galgo; switch (algo) {