+From: "Barak A. Pearlmutter" <barak+git@cs.nuim.ie>
+Date: Fri, 17 Aug 2012 12:23:06 +0200
+Subject: gnutls cleanup
+
+Stop ignoring some gnutls return codes.
+
+Rewrite call to depricated gnutls_set_default_priority() to use
+gnutls_priority_set_direct() instead.
+
+Remove call to deprecated routine
+gnutls_certificate_type_set_priority, no changes necessary.
+---
+ common/common.c | 27 +++++++++++++++++----------
+ 1 file changed, 17 insertions(+), 10 deletions(-)
+
+--- a/common/common.c
++++ b/common/common.c
+@@ -287,7 +287,7 @@
+
+ /* Initialize TLS session */
+ ret = gnutls_init(&sock->session, GNUTLS_CLIENT);
+- if (ret != 0)
++ if (ret != GNUTLS_E_SUCCESS)
+ {
+ dolog(LOG_ERR, "TLS Init failed: %s (%d)\n", gnutls_strerror(ret), ret);
+ free(sock);
+@@ -296,13 +296,26 @@
+
+ /* Use default priorities */
+ /* Allow connections to servers that have OpenPGP keys as well */
+- gnutls_priority_set_direct(sock->session,
++ ret = gnutls_priority_set_direct(sock->session,
+ "NORMAL:+CTYPE-OPENPGP",
+ NULL);
++ if (ret != GNUTLS_E_SUCCESS)
++ {
++ dolog(LOG_ERR, "TLS set default priority failed: %s (%d)\n", gnutls_strerror(ret), ret);
++ gnutls_deinit(sock->session);
++ free(sock);
++ return NULL;
++ }
+
+ /* Configure the x509 credentials for the current session */
+- gnutls_credentials_set(sock->session, GNUTLS_CRD_CERTIFICATE, g_aiccu->tls_cred);
+- /* XXX: Return value is not documented in GNUTLS documentation! */
++ ret = gnutls_credentials_set(sock->session, GNUTLS_CRD_CERTIFICATE, g_aiccu->tls_cred);
++ if (ret != GNUTLS_E_SUCCESS)
++ {
++ dolog(LOG_ERR, "TLS credentials set failed: %s (%d)\n", gnutls_strerror(ret), ret);
++ gnutls_deinit(sock->session);
++ free(sock);
++ return NULL;
++ }
+
+ #endif /* AICCU_GNUTLS*/
+