Fix for file injection is broken on centos computes with Cirros images LP #1587960
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / aiccu / 0001-gnutls.patch
1 aiccu.h, common.c, common.h: fixes for deprecated GNUTLS functions and types
2
3 Signed-off-by: Michael Rommel <rommel@layer-7.net>
4
5 diff -purN aiccu_20070115.orig/common/aiccu.h aiccu_20070115/common/aiccu.h
6 --- aiccu_20070115.orig/common/aiccu.h  2007-01-15 13:01:43.000000000 +0100
7 +++ aiccu_20070115/common/aiccu.h       2013-08-31 23:50:53.651936146 +0200
8 @@ -111,7 +111,7 @@ struct AICCU_conf
9  #endif
10  
11  #ifdef AICCU_GNUTLS
12 -       gnutls_certificate_credentials  tls_cred;       /* GNUTLS credentials */
13 +       gnutls_certificate_credentials_t tls_cred;      /* GNUTLS credentials */
14  #endif
15  
16         bool            daemonize;              /* Daemonize? */
17 diff -purN aiccu_20070115.orig/common/common.c aiccu_20070115/common/common.c
18 --- aiccu_20070115.orig/common/common.c 2006-12-21 15:08:50.000000000 +0100
19 +++ aiccu_20070115/common/common.c      2013-09-01 01:21:36.031396740 +0200
20 @@ -271,9 +271,8 @@ TLSSOCKET sock_alloc(void);
21  TLSSOCKET sock_alloc(void)
22  {
23  #ifdef AICCU_GNUTLS
24 -       /* Allow connections to servers that have OpenPGP keys as well */
25 -       const int       cert_type_priority[3] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 };
26         int             ret;
27 +       const char      *err;
28  #endif /* AICCU_GNUTLS*/
29  
30         TLSSOCKET       sock;   
31 @@ -297,11 +296,16 @@ TLSSOCKET sock_alloc(void)
32         }
33  
34         /* Use default priorities */
35 -       gnutls_set_default_priority(sock->session);
36 -       /* XXX: Return value is not documented in GNUTLS documentation! */
37 -
38 -       gnutls_certificate_type_set_priority(sock->session, cert_type_priority);
39 -       /* XXX: Return value is not documented in GNUTLS documentation! */
40 +       ret = gnutls_priority_set_direct(sock->session, "NORMAL", &err); 
41 +       if (ret < 0)
42 +       {
43 +               if (ret == GNUTLS_E_INVALID_REQUEST)
44 +               {
45 +                       dolog( LOG_ERR, "TLS set priority failed, syntax error at: %s\n", err);
46 +               }
47 +               free(sock);
48 +               return NULL;
49 +       }
50  
51         /* Configure the x509 credentials for the current session */
52         gnutls_credentials_set(sock->session, GNUTLS_CRD_CERTIFICATE, g_aiccu->tls_cred);
53 @@ -474,7 +478,7 @@ bool sock_gotls(TLSSOCKET sock)
54         }
55  
56         /* Set the transport */
57 -       gnutls_transport_set_ptr(sock->session, (gnutls_transport_ptr)sock->socket);
58 +       gnutls_transport_set_ptr(sock->session, (gnutls_transport_ptr_t) sock->socket);
59  
60         /* Perform the TLS handshake */
61         ret = gnutls_handshake(sock->session);
62 diff -purN aiccu_20070115.orig/common/common.h aiccu_20070115/common/common.h
63 --- aiccu_20070115.orig/common/common.h 2007-01-11 15:50:51.000000000 +0100
64 +++ aiccu_20070115/common/common.h      2013-08-31 23:26:13.683659455 +0200
65 @@ -381,7 +381,7 @@ struct tlssocket
66         SOCKET                  socket;
67  #ifdef AICCU_GNUTLS
68         bool                    tls_active;     /* TLS active? */
69 -       gnutls_session          session;        /* The GnuTLS sesision */
70 +       gnutls_session_t        session;        /* The GnuTLS sesision */
71  #endif
72  };
73