1 From: "Barak A. Pearlmutter" <barak+git@cs.nuim.ie>
2 Date: Fri, 17 Aug 2012 12:23:06 +0200
3 Subject: gnutls cleanup
5 Stop ignoring some gnutls return codes.
7 Rewrite call to depricated gnutls_set_default_priority() to use
8 gnutls_priority_set_direct() instead.
10 Remove call to deprecated routine
11 gnutls_certificate_type_set_priority, no changes necessary.
13 common/common.c | 27 +++++++++++++++++----------
14 1 file changed, 17 insertions(+), 10 deletions(-)
20 /* Initialize TLS session */
21 ret = gnutls_init(&sock->session, GNUTLS_CLIENT);
23 + if (ret != GNUTLS_E_SUCCESS)
25 dolog(LOG_ERR, "TLS Init failed: %s (%d)\n", gnutls_strerror(ret), ret);
29 /* Use default priorities */
30 /* Allow connections to servers that have OpenPGP keys as well */
31 - gnutls_priority_set_direct(sock->session,
32 + ret = gnutls_priority_set_direct(sock->session,
33 "NORMAL:+CTYPE-OPENPGP",
35 + if (ret != GNUTLS_E_SUCCESS)
37 + dolog(LOG_ERR, "TLS set default priority failed: %s (%d)\n", gnutls_strerror(ret), ret);
38 + gnutls_deinit(sock->session);
43 /* Configure the x509 credentials for the current session */
44 - gnutls_credentials_set(sock->session, GNUTLS_CRD_CERTIFICATE, g_aiccu->tls_cred);
45 - /* XXX: Return value is not documented in GNUTLS documentation! */
46 + ret = gnutls_credentials_set(sock->session, GNUTLS_CRD_CERTIFICATE, g_aiccu->tls_cred);
47 + if (ret != GNUTLS_E_SUCCESS)
49 + dolog(LOG_ERR, "TLS credentials set failed: %s (%d)\n", gnutls_strerror(ret), ret);
50 + gnutls_deinit(sock->session);
55 #endif /* AICCU_GNUTLS*/