]> git.pld-linux.org Git - packages/aiccu.git/blame - 11_gnutls-cleanup.patch
- cleanup
[packages/aiccu.git] / 11_gnutls-cleanup.patch
CommitLineData
3ed092f9
JR
1From: "Barak A. Pearlmutter" <barak+git@cs.nuim.ie>
2Date: Fri, 17 Aug 2012 12:23:06 +0200
3Subject: gnutls cleanup
4
5Stop ignoring some gnutls return codes.
6
7Rewrite call to depricated gnutls_set_default_priority() to use
8gnutls_priority_set_direct() instead.
9
10Remove call to deprecated routine
11gnutls_certificate_type_set_priority, no changes necessary.
12---
13 common/common.c | 27 +++++++++++++++++----------
14 1 file changed, 17 insertions(+), 10 deletions(-)
15
16--- a/common/common.c
17+++ b/common/common.c
18@@ -287,7 +287,7 @@
19
20 /* Initialize TLS session */
21 ret = gnutls_init(&sock->session, GNUTLS_CLIENT);
22- if (ret != 0)
23+ if (ret != GNUTLS_E_SUCCESS)
24 {
25 dolog(LOG_ERR, "TLS Init failed: %s (%d)\n", gnutls_strerror(ret), ret);
26 free(sock);
27@@ -296,13 +296,26 @@
28
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",
34 NULL);
35+ if (ret != GNUTLS_E_SUCCESS)
36+ {
37+ dolog(LOG_ERR, "TLS set default priority failed: %s (%d)\n", gnutls_strerror(ret), ret);
38+ gnutls_deinit(sock->session);
39+ free(sock);
40+ return NULL;
41+ }
42
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)
48+ {
49+ dolog(LOG_ERR, "TLS credentials set failed: %s (%d)\n", gnutls_strerror(ret), ret);
50+ gnutls_deinit(sock->session);
51+ free(sock);
52+ return NULL;
53+ }
54
55 #endif /* AICCU_GNUTLS*/
56
This page took 0.063477 seconds and 4 git commands to generate.