]>
Commit | Line | Data |
---|---|---|
3ed092f9 JR |
1 | From: "Barak A. Pearlmutter" <barak+git@cs.nuim.ie> |
2 | Date: Fri, 17 Aug 2012 12:23:06 +0200 | |
3 | Subject: gnutls cleanup | |
4 | ||
5 | Stop ignoring some gnutls return codes. | |
6 | ||
7 | Rewrite call to depricated gnutls_set_default_priority() to use | |
8 | gnutls_priority_set_direct() instead. | |
9 | ||
10 | Remove call to deprecated routine | |
11 | gnutls_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 |