From 540756bf5446f30b66b716027b4f8550a462f4fc Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Fri, 27 Mar 2009 16:48:58 +0100 Subject: Fix SSL connection to some IRC servers using Diffie Hellman and small exchange keys (bug #25996) --- src/core/wee-config.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-) (limited to 'src/core/wee-config.c') diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 7d6b727bd..b5fd829e4 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -159,6 +159,10 @@ struct t_config_option *config_history_max_lines; struct t_config_option *config_history_max_commands; struct t_config_option *config_history_display_default; +/* config, network section */ + +struct t_config_option *config_network_gnutls_dh_prime_bits; + /* config, plugin section */ struct t_config_option *config_plugin_autoload; @@ -978,12 +982,12 @@ config_weechat_key_write_cb (void *data, struct t_config_file *config_file, } /* - * config_weechat_init: init WeeChat config structure - * return: 1 if ok, 0 if error + * config_weechat_init_options: init WeeChat config structure (all core options) + * return: 1 if ok, 0 if error */ int -config_weechat_init () +config_weechat_init_options () { struct t_config_section *ptr_section; @@ -1680,6 +1684,24 @@ config_weechat_init () } weechat_config_section_proxy = ptr_section; + + /* network */ + ptr_section = config_file_new_section (weechat_config_file, "network", + 0, 0, + NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL); + if (!ptr_section) + { + config_file_free (weechat_config_file); + return 0; + } + + config_network_gnutls_dh_prime_bits = config_file_new_option ( + weechat_config_file, ptr_section, + "gnutls_dh_prime_bitsmax_lines", "integer", + N_("minimum size in bits for handshake using Diffie Hellman key " + "exchange"), + NULL, 0, INT_MAX, "512", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); /* plugin */ ptr_section = config_file_new_section (weechat_config_file, "plugin", @@ -1785,6 +1807,27 @@ config_weechat_init () return 1; } +/* + * config_weechat_init: init WeeChat config structure + * return: 1 if ok, 0 if error + */ + +int +config_weechat_init () +{ + int rc; + + rc = config_weechat_init_options (); + + if (!rc) + { + gui_chat_printf (NULL, + _("FATAL: error initializing configuration options")); + } + + return rc; +} + /* * config_weechat_read: read WeeChat configuration file * return one of these values: @@ -1806,6 +1849,13 @@ config_weechat_read () gui_bar_use_temp_bars (); gui_bar_create_default (); } + + if (rc != WEECHAT_CONFIG_READ_OK) + { + gui_chat_printf (NULL, + _("%sError reading configuration"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); + } return rc; } -- cgit v1.2.3