2012-11-27 [colin] 3.9.0cvs24
authorColin Leroy <colin@colino.net>
Tue, 27 Nov 2012 10:18:56 +0000 (10:18 +0000)
committerColin Leroy <colin@colino.net>
Tue, 27 Nov 2012 10:18:56 +0000 (10:18 +0000)
* src/common/ssl.c
Fix bug #2826, "replace deprecated gnutls function"
Patch by Christian Hesse

ChangeLog
PATCHSETS
configure.ac
src/common/ssl.c

index 5e53244..6686a9e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-11-27 [colin]     3.9.0cvs24
+
+       * src/common/ssl.c
+               Fix bug #2826, "replace deprecated gnutls function"
+               Patch by Christian Hesse
+
 2012-11-27 [colin]     3.9.0cvs23
 
        * src/gtk/manage_window.c
index 8ab5639..a876550 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.13 -r 1.1.2.14 doc/man/claws-mail.1;  cvs diff -u -r 1.115.2.263 -r 1.115.2.264 src/main.c;  cvs diff -u -r 1.17.2.65 -r 1.17.2.66 src/send_message.c;  cvs diff -u -r 1.1.4.12 -r 1.1.4.13 src/send_message.h;  ) > 3.9.0cvs21.patchset
 ( cvs diff -u -r 1.274.2.356 -r 1.274.2.357 src/mainwindow.c;  cvs diff -u -r 1.204.2.213 -r 1.204.2.214 src/prefs_common.c;  cvs diff -u -r 1.103.2.142 -r 1.103.2.143 src/prefs_common.h;  ) > 3.9.0cvs22.patchset
 ( cvs diff -u -r 1.1.4.12 -r 1.1.4.13 src/gtk/manage_window.c;  ) > 3.9.0cvs23.patchset
+( cvs diff -u -r 1.9.2.58 -r 1.9.2.59 src/common/ssl.c;  ) > 3.9.0cvs24.patchset
index d289c6d..0f03577 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=9
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=23
+EXTRA_VERSION=24
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 50ac5a3..a47ce3d 100644 (file)
@@ -57,10 +57,17 @@ typedef struct _thread_data {
 } thread_data;
 #endif
 
+#if GNUTLS_VERSION_NUMBER <= 0x020c00
 static int gnutls_client_cert_cb(gnutls_session_t session,
                                const gnutls_datum_t *req_ca_rdn, int nreqs,
                                const gnutls_pk_algorithm_t *sign_algos,
                                int sign_algos_length, gnutls_retr_st *st)
+#else
+static int gnutls_cert_cb(gnutls_session_t session,
+                               const gnutls_datum_t *req_ca_rdn, int nreqs,
+                               const gnutls_pk_algorithm_t *sign_algos,
+                               int sign_algos_length, gnutls_retr2_st *st)
+#endif
 {
        SSLClientCertHookData hookdata;
        SockInfo *sockinfo = (SockInfo *)gnutls_session_get_ptr(session);
@@ -91,7 +98,11 @@ static int gnutls_client_cert_cb(gnutls_session_t session,
 
        if (type == GNUTLS_CRT_X509 && sockinfo->client_crt && sockinfo->client_key) {
                st->ncerts = 1;
+#if GNUTLS_VERSION_NUMBER <= 0x020c00
                st->type = type;
+#else
+               st->key_type = type;
+#endif
                st->cert.x509 = &(sockinfo->client_crt);
                st->key.x509 = sockinfo->client_key;
                st->deinit_all = 0;
@@ -287,10 +298,11 @@ gboolean ssl_init_socket_with_method(SockInfo *sockinfo, SSLMethod method)
 
        gnutls_transport_set_ptr(session, (gnutls_transport_ptr_t) GINT_TO_POINTER(sockinfo->sock));
        gnutls_session_set_ptr(session, sockinfo);
-       /* TODO: gnutls_certificate_client_set_retrieve_function() is deprecated and should be replaced with
-        * gnutls_certificate_set_retrieve_function() which was introduced in gnutls 2.12 in March 2011
-        * getting this right with defines is not easy, so how long do we need compatibility to gntls <= 2.10? */
+#if GNUTLS_VERSION_NUMBER <= 0x020c00
        gnutls_certificate_client_set_retrieve_function(xcred, gnutls_client_cert_cb);
+#else
+       gnutls_certificate_set_retrieve_function(xcred, gnutls_cert_cb);
+#endif
 
        gnutls_dh_set_prime_bits(session, 512);