summaryrefslogtreecommitdiff
path: root/src/core/hook
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2020-04-18 11:33:22 +0200
committerSébastien Helleu <flashcode@flashtux.org>2020-04-18 11:34:59 +0200
commite130ee7358564cfd5572ca0cf1ac6871425548ed (patch)
treea9ea85596b26b17a0710d4625a17a93017a3424d /src/core/hook
parent80693dcea9b645e54d7ad246d28c2cba39da4e30 (diff)
downloadweechat-e130ee7358564cfd5572ca0cf1ac6871425548ed.zip
core: make GnuTLS a required dependency
Diffstat (limited to 'src/core/hook')
-rw-r--r--src/core/hook/wee-hook-connect.c20
-rw-r--r--src/core/hook/wee-hook-connect.h8
2 files changed, 0 insertions, 28 deletions
diff --git a/src/core/hook/wee-hook-connect.c b/src/core/hook/wee-hook-connect.c
index 0a865b0a8..133ffa8ac 100644
--- a/src/core/hook/wee-hook-connect.c
+++ b/src/core/hook/wee-hook-connect.c
@@ -57,14 +57,6 @@ hook_connect (struct t_weechat_plugin *plugin, const char *proxy,
struct t_hook_connect *new_hook_connect;
int i;
-#ifndef HAVE_GNUTLS
- /* make C compiler happy */
- (void) gnutls_sess;
- (void) gnutls_cb;
- (void) gnutls_dhkey_size;
- (void) gnutls_priorities;
-#endif /* HAVE_GNUTLS */
-
if (!address || (port <= 0) || !callback)
return NULL;
@@ -89,13 +81,11 @@ hook_connect (struct t_weechat_plugin *plugin, const char *proxy,
new_hook_connect->sock = -1;
new_hook_connect->ipv6 = ipv6;
new_hook_connect->retry = retry;
-#ifdef HAVE_GNUTLS
new_hook_connect->gnutls_sess = gnutls_sess;
new_hook_connect->gnutls_cb = gnutls_cb;
new_hook_connect->gnutls_dhkey_size = gnutls_dhkey_size;
new_hook_connect->gnutls_priorities = (gnutls_priorities) ?
strdup (gnutls_priorities) : NULL;
-#endif /* HAVE_GNUTLS */
new_hook_connect->local_hostname = (local_hostname) ?
strdup (local_hostname) : NULL;
new_hook_connect->child_read = -1;
@@ -129,7 +119,6 @@ hook_connect (struct t_weechat_plugin *plugin, const char *proxy,
* Verifies certificates.
*/
-#ifdef HAVE_GNUTLS
int
hook_connect_gnutls_verify_certificates (gnutls_session_t tls_session)
{
@@ -158,13 +147,11 @@ hook_connect_gnutls_verify_certificates (gnutls_session_t tls_session)
return rc;
}
-#endif /* HAVE_GNUTLS */
/*
* Sets certificates.
*/
-#ifdef HAVE_GNUTLS
int
hook_connect_gnutls_set_certificates (gnutls_session_t tls_session,
const gnutls_datum_t *req_ca, int nreq,
@@ -201,7 +188,6 @@ hook_connect_gnutls_set_certificates (gnutls_session_t tls_session,
return rc;
}
-#endif /* HAVE_GNUTLS */
/*
* Frees data in a connect hook.
@@ -225,13 +211,11 @@ hook_connect_free_data (struct t_hook *hook)
free (HOOK_CONNECT(hook, address));
HOOK_CONNECT(hook, address) = NULL;
}
-#ifdef HAVE_GNUTLS
if (HOOK_CONNECT(hook, gnutls_priorities))
{
free (HOOK_CONNECT(hook, gnutls_priorities));
HOOK_CONNECT(hook, gnutls_priorities) = NULL;
}
-#endif /* HAVE_GNUTLS */
if (HOOK_CONNECT(hook, local_hostname))
{
free (HOOK_CONNECT(hook, local_hostname));
@@ -336,14 +320,12 @@ hook_connect_add_to_infolist (struct t_infolist_item *item,
return 0;
if (!infolist_new_var_integer (item, "retry", HOOK_CONNECT(hook, retry)))
return 0;
-#ifdef HAVE_GNUTLS
if (!infolist_new_var_pointer (item, "gnutls_sess", HOOK_CONNECT(hook, gnutls_sess)))
return 0;
if (!infolist_new_var_pointer (item, "gnutls_cb", HOOK_CONNECT(hook, gnutls_cb)))
return 0;
if (!infolist_new_var_integer (item, "gnutls_dhkey_size", HOOK_CONNECT(hook, gnutls_dhkey_size)))
return 0;
-#endif /* HAVE_GNUTLS */
if (!infolist_new_var_string (item, "local_hostname", HOOK_CONNECT(hook, local_hostname)))
return 0;
if (!infolist_new_var_integer (item, "child_read", HOOK_CONNECT(hook, child_read)))
@@ -392,12 +374,10 @@ hook_connect_print_log (struct t_hook *hook)
log_printf (" sock. . . . . . . . . : %d", HOOK_CONNECT(hook, sock));
log_printf (" ipv6. . . . . . . . . : %d", HOOK_CONNECT(hook, ipv6));
log_printf (" retry . . . . . . . . : %d", HOOK_CONNECT(hook, retry));
-#ifdef HAVE_GNUTLS
log_printf (" gnutls_sess . . . . . : 0x%lx", HOOK_CONNECT(hook, gnutls_sess));
log_printf (" gnutls_cb . . . . . . : 0x%lx", HOOK_CONNECT(hook, gnutls_cb));
log_printf (" gnutls_dhkey_size . . : %d", HOOK_CONNECT(hook, gnutls_dhkey_size));
log_printf (" gnutls_priorities . . : '%s'", HOOK_CONNECT(hook, gnutls_priorities));
-#endif /* HAVE_GNUTLS */
log_printf (" local_hostname. . . . : '%s'", HOOK_CONNECT(hook, local_hostname));
log_printf (" child_read. . . . . . : %d", HOOK_CONNECT(hook, child_read));
log_printf (" child_write . . . . . : %d", HOOK_CONNECT(hook, child_write));
diff --git a/src/core/hook/wee-hook-connect.h b/src/core/hook/wee-hook-connect.h
index 53f59e22b..01f7b15d2 100644
--- a/src/core/hook/wee-hook-connect.h
+++ b/src/core/hook/wee-hook-connect.h
@@ -21,9 +21,7 @@
#ifndef WEECHAT_HOOK_CONNECT_H
#define WEECHAT_HOOK_CONNECT_H
-#ifdef HAVE_GNUTLS
#include <gnutls/gnutls.h>
-#endif
struct t_weechat_plugin;
struct t_infolist_item;
@@ -38,7 +36,6 @@ typedef int (t_hook_callback_connect)(const void *pointer, void *data,
const char *error,
const char *ip_address);
-#ifdef HAVE_GNUTLS
typedef int (gnutls_callback_t)(const void *pointer, void *data,
gnutls_session_t tls_session,
const gnutls_datum_t *req_ca, int nreq,
@@ -50,7 +47,6 @@ typedef int (gnutls_callback_t)(const void *pointer, void *data,
gnutls_retr_st *answer,
#endif /* LIBGNUTLS_VERSION_NUMBER >= 0x020b00 */
int action);
-#endif /* HAVE_GNUTLS */
struct t_hook_connect
{
@@ -61,12 +57,10 @@ struct t_hook_connect
int ipv6; /* use IPv6 */
int sock; /* socket (set when connected) */
int retry; /* retry count */
-#ifdef HAVE_GNUTLS
gnutls_session_t *gnutls_sess; /* GnuTLS session (SSL connection) */
gnutls_callback_t *gnutls_cb; /* GnuTLS callback during handshake */
int gnutls_dhkey_size; /* Diffie Hellman Key Exchange size */
char *gnutls_priorities; /* GnuTLS priorities */
-#endif /* HAVE_GNUTLS */
char *local_hostname; /* force local hostname (optional) */
int child_read; /* to read data in pipe from child */
int child_write; /* to write data in pipe for child */
@@ -94,7 +88,6 @@ extern struct t_hook *hook_connect (struct t_weechat_plugin *plugin,
t_hook_callback_connect *callback,
const void *callback_pointer,
void *callback_data);
-#ifdef HAVE_GNUTLS
extern int hook_connect_gnutls_verify_certificates (gnutls_session_t tls_session);
extern int hook_connect_gnutls_set_certificates (gnutls_session_t tls_session,
const gnutls_datum_t *req_ca, int nreq,
@@ -105,7 +98,6 @@ extern int hook_connect_gnutls_set_certificates (gnutls_session_t tls_session,
#else
gnutls_retr_st *answer);
#endif /* LIBGNUTLS_VERSION_NUMBER >= 0x020b00 */
-#endif /* HAVE_GNUTLS */
extern void hook_connect_free_data (struct t_hook *hook);
extern int hook_connect_add_to_infolist (struct t_infolist_item *item,
struct t_hook *hook);