summaryrefslogtreecommitdiff
path: root/src/core/wee-network.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2012-08-14 11:05:35 +0200
committerSebastien Helleu <flashcode@flashtux.org>2012-08-14 11:05:35 +0200
commit5164bab40789c1b07b64c48f1904eeff973fd0f6 (patch)
tree076fa1a97abd566af3d402e1bcf830458f8874a0 /src/core/wee-network.c
parent03a5e8a729a4160ddbb357146d3852496b7605a4 (diff)
downloadweechat-5164bab40789c1b07b64c48f1904eeff973fd0f6.zip
core: add hidden command line options --no-gnutls and --no-gcrypt (no init/deinit of gnutls/crypt, useful for valgrind/electric-fence)
Diffstat (limited to 'src/core/wee-network.c')
-rw-r--r--src/core/wee-network.c52
1 files changed, 33 insertions, 19 deletions
diff --git a/src/core/wee-network.c b/src/core/wee-network.c
index 15a0ca70f..97d2d5e23 100644
--- a/src/core/wee-network.c
+++ b/src/core/wee-network.c
@@ -72,6 +72,9 @@ network_set_gnutls_ca_file ()
#ifdef HAVE_GNUTLS
char *ca_path, *ca_path2;
+ if (weechat_no_gnutls)
+ return;
+
ca_path = string_expand_home (CONFIG_STRING(config_network_gnutls_ca_file));
if (ca_path)
{
@@ -95,30 +98,38 @@ void
network_init ()
{
#ifdef HAVE_GNUTLS
- gnutls_global_init ();
- gnutls_certificate_allocate_credentials (&gnutls_xcred);
+ if (!weechat_no_gnutls)
+ {
+ gnutls_global_init ();
+ gnutls_certificate_allocate_credentials (&gnutls_xcred);
- network_set_gnutls_ca_file ();
+ network_set_gnutls_ca_file ();
#if LIBGNUTLS_VERSION_NUMBER >= 0x02090a
- /* for gnutls >= 2.9.10 */
- gnutls_certificate_set_verify_function (gnutls_xcred,
- &hook_connect_gnutls_verify_certificates);
+ /* for gnutls >= 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 */
- gnutls_certificate_set_retrieve_function (gnutls_xcred,
- &hook_connect_gnutls_set_certificates);
+ /* for gnutls >= 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
+ /* for gnutls < 2.11.0 */
+ gnutls_certificate_client_set_retrieve_function (gnutls_xcred,
+ &hook_connect_gnutls_set_certificates);
#endif
+ }
+#endif /* HAVE_GNUTLS */
+
#ifdef HAVE_GCRYPT
- gcry_check_version (GCRYPT_VERSION);
- gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
- gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
-#endif
+ if (!weechat_no_gcrypt)
+ {
+ gcry_check_version (GCRYPT_VERSION);
+ gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
+ gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+ }
+#endif /* HAVE_GCRYPT */
+
network_init_ok = 1;
}
@@ -132,8 +143,11 @@ network_end ()
if (network_init_ok)
{
#ifdef HAVE_GNUTLS
- gnutls_certificate_free_credentials (gnutls_xcred);
- gnutls_global_deinit();
+ if (!weechat_no_gnutls)
+ {
+ gnutls_certificate_free_credentials (gnutls_xcred);
+ gnutls_global_deinit();
+ }
#endif
network_init_ok = 0;
}