1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-10 19:53:13 +02:00

core: add gnutls version in #if compiler directives

This commit is contained in:
Sébastien Helleu
2015-01-21 07:50:54 +01:00
parent b30ad7d7f6
commit b0117f0d18
5 changed files with 16 additions and 20 deletions
+1 -1
View File
@@ -2167,7 +2167,7 @@ hook_connect_gnutls_set_certificates (gnutls_session_t tls_session,
const gnutls_datum_t *req_ca, int nreq,
const gnutls_pk_algorithm_t *pk_algos,
int pk_algos_len,
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00 /* 2.11.0 */
gnutls_retr2_st *answer)
#else
gnutls_retr_st *answer)
+2 -2
View File
@@ -245,7 +245,7 @@ typedef int (gnutls_callback_t)(void *data, gnutls_session_t tls_session,
const gnutls_datum_t *req_ca, int nreq,
const gnutls_pk_algorithm_t *pk_algos,
int pk_algos_len,
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00 /* 2.11.0 */
gnutls_retr2_st *answer,
#else
gnutls_retr_st *answer,
@@ -502,7 +502,7 @@ extern int hook_connect_gnutls_set_certificates (gnutls_session_t tls_session,
const gnutls_datum_t *req_ca, int nreq,
const gnutls_pk_algorithm_t *pk_algos,
int pk_algos_len,
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00 /* 2.11.0 */
gnutls_retr2_st *answer);
#else
gnutls_retr_st *answer);
+4 -7
View File
@@ -127,17 +127,14 @@ network_init_gnutls ()
gnutls_certificate_allocate_credentials (&gnutls_xcred);
network_set_gnutls_ca_file ();
#if LIBGNUTLS_VERSION_NUMBER >= 0x02090a
/* for gnutls >= 2.9.10 */
#if LIBGNUTLS_VERSION_NUMBER >= 0x02090a /* 2.9.10 */
gnutls_certificate_set_verify_function (gnutls_xcred,
&hook_connect_gnutls_verify_certificates);
#endif
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00
/* for gnutls >= 2.11.0 */
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00 /* 2.11.0 */
gnutls_certificate_set_retrieve_function (gnutls_xcred,
&hook_connect_gnutls_set_certificates);
#else
/* for gnutls < 2.11.0 */
gnutls_certificate_client_set_retrieve_function (gnutls_xcred,
&hook_connect_gnutls_set_certificates);
#endif
@@ -1299,7 +1296,7 @@ network_connect_gnutls_handshake_fd_cb (void *arg_hook_connect, int fd)
{
fcntl (HOOK_CONNECT(hook_connect, sock), F_SETFL,
HOOK_CONNECT(hook_connect, handshake_fd_flags));
#if LIBGNUTLS_VERSION_NUMBER < 0x02090a
#if LIBGNUTLS_VERSION_NUMBER < 0x02090a /* 2.9.10 */
/*
* gnutls only has the gnutls_certificate_set_verify_function()
* function since version 2.9.10. We need to call our verify
@@ -1529,7 +1526,7 @@ network_connect_child_read_cb (void *arg_hook_connect, int fd)
}
fcntl (HOOK_CONNECT(hook_connect, sock), F_SETFL,
HOOK_CONNECT(hook_connect, handshake_fd_flags));
#if LIBGNUTLS_VERSION_NUMBER < 0x02090a
#if LIBGNUTLS_VERSION_NUMBER < 0x02090a /* 2.9.10 */
/*
* gnutls only has the gnutls_certificate_set_verify_function()
* function since version 2.9.10. We need to call our verify
+8 -8
View File
@@ -3807,7 +3807,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
const gnutls_datum_t *req_ca, int nreq,
const gnutls_pk_algorithm_t *pk_algos,
int pk_algos_len,
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00 /* 2.11.0 */
gnutls_retr2_st *answer,
#else
gnutls_retr_st *answer,
@@ -3815,7 +3815,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
int action)
{
struct t_irc_server *server;
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00 /* 2.11.0 */
gnutls_retr2_st tls_struct;
#else
gnutls_retr_st tls_struct;
@@ -3828,7 +3828,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
char *cert_path0, *cert_path1, *cert_path2, *cert_str;
const char *weechat_dir, *fingerprint;
int rc, ret, fingerprint_match, hostname_match, cert_temp_init;
#if LIBGNUTLS_VERSION_NUMBER >= 0x010706
#if LIBGNUTLS_VERSION_NUMBER >= 0x010706 /* 1.7.6 */
gnutls_datum_t cinfo;
int rinfo;
#endif
@@ -3923,9 +3923,9 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
hostname_match = 1;
}
}
#if LIBGNUTLS_VERSION_NUMBER >= 0x010706
#if LIBGNUTLS_VERSION_NUMBER >= 0x010706 /* 1.7.6 */
/* display infos about certificate */
#if LIBGNUTLS_VERSION_NUMBER < 0x020400
#if LIBGNUTLS_VERSION_NUMBER < 0x020400 /* 2.4.0 */
rinfo = gnutls_x509_crt_print (cert_temp,
GNUTLS_X509_CRT_ONELINE, &cinfo);
#else
@@ -4113,7 +4113,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
else
{
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00
#if LIBGNUTLS_VERSION_NUMBER >= 0x020b00 /* 2.11.0 */
tls_struct.cert_type = GNUTLS_CRT_X509;
tls_struct.key_type = GNUTLS_PRIVKEY_X509;
#else
@@ -4123,9 +4123,9 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
tls_struct.deinit_all = 0;
tls_struct.cert.x509 = &server->tls_cert;
tls_struct.key.x509 = server->tls_cert_key;
#if LIBGNUTLS_VERSION_NUMBER >= 0x010706
#if LIBGNUTLS_VERSION_NUMBER >= 0x010706 /* 1.7.6 */
/* client certificate info */
#if LIBGNUTLS_VERSION_NUMBER < 0x020400
#if LIBGNUTLS_VERSION_NUMBER < 0x020400 /* 2.4.0 */
rinfo = gnutls_x509_crt_print (server->tls_cert,
GNUTLS_X509_CRT_ONELINE,
&cinfo);
+1 -2
View File
@@ -1121,8 +1121,7 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server)
if (relay_gnutls_dh_params)
{
gnutls_dh_params_init (relay_gnutls_dh_params);
#if LIBGNUTLS_VERSION_NUMBER >= 0x020c00
/* for gnutls >= 2.12.0 */
#if LIBGNUTLS_VERSION_NUMBER >= 0x020c00 /* 2.12.0 */
bits = gnutls_sec_param_to_pk_bits (GNUTLS_PK_DH,
GNUTLS_SEC_PARAM_LOW);
#else