diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-04-06 00:18:45 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-04-12 17:17:30 +0200 |
commit | dec237b1048479b29e3386d5c8ce593803f2d81d (patch) | |
tree | f90e07fa720be0bce75626bf900ac208293f2279 /src/plugins/irc | |
parent | 23b870ec1daa7c86983cefbf905850ea5eb5bc8e (diff) | |
download | weechat-dec237b1048479b29e3386d5c8ce593803f2d81d.zip |
irc: rename "ssl" options to "tls" (issue #1903)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-bar-item.c | 10 | ||||
-rw-r--r-- | src/plugins/irc/irc-color.h | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-command.c | 90 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.c | 124 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.h | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 238 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.h | 24 | ||||
-rw-r--r-- | src/plugins/irc/irc-upgrade.c | 6 | ||||
-rw-r--r-- | src/plugins/irc/irc.c | 24 |
9 files changed, 311 insertions, 209 deletions
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c index 48a3fcb99..6019c1b1b 100644 --- a/src/plugins/irc/irc-bar-item.c +++ b/src/plugins/irc/irc-bar-item.c @@ -137,7 +137,7 @@ irc_bar_item_buffer_name_content (struct t_gui_buffer *buffer, int short_name) snprintf (buf_name, sizeof (buf_name), "%s%s[%s%s%s]", _("server"), IRC_COLOR_BAR_DELIM, - (server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME, + (server && server->tls_connected) ? IRC_COLOR_STATUS_NAME_TLS : IRC_COLOR_STATUS_NAME, server->name, IRC_COLOR_BAR_DELIM); } @@ -151,11 +151,11 @@ irc_bar_item_buffer_name_content (struct t_gui_buffer *buffer, int short_name) "%s%s%s%s%s%s%s%s%s%s", (part_from_channel) ? IRC_COLOR_BAR_DELIM : "", (part_from_channel) ? "(" : "", - (server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME, + (server && server->tls_connected) ? IRC_COLOR_STATUS_NAME_TLS : IRC_COLOR_STATUS_NAME, (server && display_server) ? server->name : "", (server && display_server) ? IRC_COLOR_BAR_DELIM : "", (server && display_server) ? "/" : "", - (server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME, + (server && server->tls_connected) ? IRC_COLOR_STATUS_NAME_TLS : IRC_COLOR_STATUS_NAME, (short_name) ? weechat_buffer_get_string (buffer, "short_name") : channel->name, (part_from_channel) ? IRC_COLOR_BAR_DELIM : "", (part_from_channel) ? ")" : ""); @@ -190,7 +190,7 @@ irc_bar_item_buffer_name_content (struct t_gui_buffer *buffer, int short_name) snprintf (buf, sizeof (buf), "%s%s", - (server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME, + (server && server->tls_connected) ? IRC_COLOR_STATUS_NAME_TLS : IRC_COLOR_STATUS_NAME, buf_name); return strdup (buf); @@ -549,7 +549,7 @@ irc_bar_item_tls_version (const void *pointer, void *data, irc_buffer_get_server_and_channel (buffer, &server, NULL); if (server && server->is_connected) { - if (server->ssl_connected) + if (server->tls_connected) { if (server->gnutls_sess) { diff --git a/src/plugins/irc/irc-color.h b/src/plugins/irc/irc-color.h index 95b18de2e..02a2690e0 100644 --- a/src/plugins/irc/irc-color.h +++ b/src/plugins/irc/irc-color.h @@ -82,7 +82,7 @@ #define IRC_COLOR_NOTICE weechat_color(weechat_config_string(irc_config_color_notice)) #define IRC_COLOR_STATUS_NUMBER weechat_color("status_number") #define IRC_COLOR_STATUS_NAME weechat_color("status_name") -#define IRC_COLOR_STATUS_NAME_SSL weechat_color("status_name_tls") +#define IRC_COLOR_STATUS_NAME_TLS weechat_color("status_name_tls") #define IRC_COLOR_MESSAGE_JOIN weechat_color(weechat_config_string(irc_config_color_message_join)) #define IRC_COLOR_MESSAGE_ACCOUNT weechat_color(weechat_config_string(irc_config_color_message_account)) #define IRC_COLOR_MESSAGE_CHGHOST weechat_color(weechat_config_string(irc_config_color_message_chghost)) diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 76003f957..04bfba877 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -5116,65 +5116,65 @@ irc_command_display_server (struct t_irc_server *server, int with_detail) IRC_COLOR_CHAT_VALUE, (weechat_config_boolean (server->options[IRC_SERVER_OPTION_IPV6])) ? _("on") : _("off")); - /* ssl */ - if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SSL])) - weechat_printf (NULL, " ssl. . . . . . . . . : (%s)", - (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? + /* tls */ + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_TLS])) + weechat_printf (NULL, " tls. . . . . . . . . : (%s)", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_TLS)) ? _("on") : _("off")); else - weechat_printf (NULL, " ssl. . . . . . . . . : %s%s", + weechat_printf (NULL, " tls. . . . . . . . . : %s%s", IRC_COLOR_CHAT_VALUE, - (weechat_config_boolean (server->options[IRC_SERVER_OPTION_SSL])) ? + (weechat_config_boolean (server->options[IRC_SERVER_OPTION_TLS])) ? _("on") : _("off")); - /* ssl_cert */ - if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SSL_CERT])) - weechat_printf (NULL, " ssl_cert . . . . . . : ('%s')", - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_CERT)); + /* tls_cert */ + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_TLS_CERT])) + weechat_printf (NULL, " tls_cert . . . . . . : ('%s')", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_TLS_CERT)); else - weechat_printf (NULL, " ssl_cert . . . . . . : %s'%s'", + weechat_printf (NULL, " tls_cert . . . . . . : %s'%s'", IRC_COLOR_CHAT_VALUE, - weechat_config_string (server->options[IRC_SERVER_OPTION_SSL_CERT])); - /* ssl_password */ - if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SSL_PASSWORD])) - weechat_printf (NULL, " ssl_password . . . . : %s", + weechat_config_string (server->options[IRC_SERVER_OPTION_TLS_CERT])); + /* tls_password */ + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_TLS_PASSWORD])) + weechat_printf (NULL, " tls_password . . . . : %s", _("(hidden)")); else - weechat_printf (NULL, " ssl_password . . . . : %s%s", + weechat_printf (NULL, " tls_password . . . . : %s%s", IRC_COLOR_CHAT_VALUE, _("(hidden)")); - /* ssl_priorities */ - if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SSL_PRIORITIES])) - weechat_printf (NULL, " ssl_priorities . . . : ('%s')", - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_PRIORITIES)); + /* tls_priorities */ + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_TLS_PRIORITIES])) + weechat_printf (NULL, " tls_priorities . . . : ('%s')", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_TLS_PRIORITIES)); else - weechat_printf (NULL, " ssl_priorities . . . : %s'%s'", + weechat_printf (NULL, " tls_priorities . . . : %s'%s'", IRC_COLOR_CHAT_VALUE, - weechat_config_string (server->options[IRC_SERVER_OPTION_SSL_PRIORITIES])); - /* ssl_dhkey_size */ - if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SSL_DHKEY_SIZE])) - weechat_printf (NULL, " ssl_dhkey_size . . . : (%d)", - IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE)); + weechat_config_string (server->options[IRC_SERVER_OPTION_TLS_PRIORITIES])); + /* tls_dhkey_size */ + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_TLS_DHKEY_SIZE])) + weechat_printf (NULL, " tls_dhkey_size . . . : (%d)", + IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_TLS_DHKEY_SIZE)); else - weechat_printf (NULL, " ssl_dhkey_size . . . : %s%d", + weechat_printf (NULL, " tls_dhkey_size . . . : %s%d", IRC_COLOR_CHAT_VALUE, - weechat_config_integer (server->options[IRC_SERVER_OPTION_SSL_DHKEY_SIZE])); - /* ssl_fingerprint */ - if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SSL_FINGERPRINT])) - weechat_printf (NULL, " ssl_fingerprint. . . : ('%s')", - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_FINGERPRINT)); + weechat_config_integer (server->options[IRC_SERVER_OPTION_TLS_DHKEY_SIZE])); + /* tls_fingerprint */ + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT])) + weechat_printf (NULL, " tls_fingerprint. . . : ('%s')", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_TLS_FINGERPRINT)); else - weechat_printf (NULL, " ssl_fingerprint. . . : %s'%s'", + weechat_printf (NULL, " tls_fingerprint. . . : %s'%s'", IRC_COLOR_CHAT_VALUE, - weechat_config_string (server->options[IRC_SERVER_OPTION_SSL_FINGERPRINT])); - /* ssl_verify */ - if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SSL_VERIFY])) - weechat_printf (NULL, " ssl_verify . . . . . : (%s)", - (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL_VERIFY)) ? + weechat_config_string (server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT])); + /* tls_verify */ + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_TLS_VERIFY])) + weechat_printf (NULL, " tls_verify . . . . . : (%s)", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_TLS_VERIFY)) ? _("on") : _("off")); else - weechat_printf (NULL, " ssl_verify . . . . . : %s%s", + weechat_printf (NULL, " tls_verify . . . . . : %s%s", IRC_COLOR_CHAT_VALUE, - (weechat_config_boolean (server->options[IRC_SERVER_OPTION_SSL_VERIFY])) ? + (weechat_config_boolean (server->options[IRC_SERVER_OPTION_TLS_VERIFY])) ? _("on") : _("off")); /* password */ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_PASSWORD])) @@ -6985,7 +6985,7 @@ irc_command_init () "added (NOT SAVED), see /help irc.look.temporary_servers\n" " option: set option for server (for boolean option, value can be " "omitted)\n" - " nooption: set boolean option to 'off' (for example: -nossl)\n" + " nooption: set boolean option to 'off' (for example: -notls)\n" " -all: connect to all servers defined in configuration\n" " -auto: connect to servers with autoconnect enabled\n" " -open: connect to all opened servers that are not currently " @@ -7001,8 +7001,8 @@ irc_command_init () " /connect libera\n" " /connect irc.oftc.net/6667\n" " /connect irc6.oftc.net/6667 -ipv6\n" - " /connect irc6.oftc.net/6697 -ipv6 -ssl\n" - " /connect my.server.org/6697 -ssl -password=test\n" + " /connect irc6.oftc.net/6697 -ipv6 -tls\n" + " /connect my.server.org/6697 -tls -password=test\n" " /connect irc://nick@irc.oftc.net/#channel\n" " /connect -switch"), "%(irc_servers)|-all|-auto|-open|-nojoin|-switch|%*", @@ -7526,7 +7526,7 @@ irc_command_init () " -temp: add a temporary server (not saved)\n" " option: set option for server (for boolean option, value can be " "omitted)\n" - "nooption: set boolean option to 'off' (for example: -nossl)\n" + "nooption: set boolean option to 'off' (for example: -notls)\n" " copy: duplicate a server\n" " rename: rename a server\n" " reorder: reorder list of servers\n" @@ -7557,7 +7557,7 @@ irc_command_init () "Examples:\n" " /server listfull\n" " /server add libera irc.libera.chat\n" - " /server add libera irc.libera.chat/6697 -ssl -autoconnect\n" + " /server add libera irc.libera.chat/6697 -tls -autoconnect\n" " /server add chatspike irc.chatspike.net/6667," "irc.duckspike.net/6667\n" " /server copy libera libera-test\n" diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index bbae1a381..da52dfe04 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -1178,7 +1178,7 @@ irc_config_server_check_value_cb (const void *pointer, void *data, } } break; - case IRC_SERVER_OPTION_SSL_PRIORITIES: + case IRC_SERVER_OPTION_TLS_PRIORITIES: pos_error = irc_config_check_gnutls_priorities (value); if (pos_error) { @@ -1749,11 +1749,11 @@ irc_config_server_new_option (struct t_config_file *config_file, callback_change_data, NULL, NULL, NULL); break; - case IRC_SERVER_OPTION_SSL: + case IRC_SERVER_OPTION_TLS: new_option = weechat_config_new_option ( config_file, section, option_name, "boolean", - N_("use SSL for server communication"), + N_("use TLS for server communication"), NULL, 0, 0, default_value, value, null_value_allowed, @@ -1765,11 +1765,11 @@ irc_config_server_new_option (struct t_config_file *config_file, callback_change_data, NULL, NULL, NULL); break; - case IRC_SERVER_OPTION_SSL_CERT: + case IRC_SERVER_OPTION_TLS_CERT: new_option = weechat_config_new_option ( config_file, section, option_name, "string", - N_("SSL certificate file used to automatically identify your " + N_("TLS certificate file used to automatically identify your " "nick " "(path is evaluated, see function string_eval_path_home in " "plugin API reference)"), @@ -1784,11 +1784,11 @@ irc_config_server_new_option (struct t_config_file *config_file, callback_change_data, NULL, NULL, NULL); break; - case IRC_SERVER_OPTION_SSL_PASSWORD: + case IRC_SERVER_OPTION_TLS_PASSWORD: new_option = weechat_config_new_option ( config_file, section, option_name, "string", - N_("password for SSL certificate's private key; " + N_("password for TLS certificate's private key; " "only used with gnutls version >= 3.1.0 " "(note: content is evaluated, see /help eval; server " "options are evaluated with ${irc_server.xxx} and " @@ -1804,7 +1804,7 @@ irc_config_server_new_option (struct t_config_file *config_file, callback_change_data, NULL, NULL, NULL); break; - case IRC_SERVER_OPTION_SSL_PRIORITIES: + case IRC_SERVER_OPTION_TLS_PRIORITIES: new_option = weechat_config_new_option ( config_file, section, option_name, "string", @@ -1823,7 +1823,7 @@ irc_config_server_new_option (struct t_config_file *config_file, callback_change_data, NULL, NULL, NULL); break; - case IRC_SERVER_OPTION_SSL_DHKEY_SIZE: + case IRC_SERVER_OPTION_TLS_DHKEY_SIZE: new_option = weechat_config_new_option ( config_file, section, option_name, "integer", @@ -1840,7 +1840,7 @@ irc_config_server_new_option (struct t_config_file *config_file, callback_change_data, NULL, NULL, NULL); break; - case IRC_SERVER_OPTION_SSL_FINGERPRINT: + case IRC_SERVER_OPTION_TLS_FINGERPRINT: new_option = weechat_config_new_option ( config_file, section, option_name, "string", @@ -1850,7 +1850,7 @@ irc_config_server_new_option (struct t_config_file *config_file, "40 chars for SHA-1 (insecure, not recommended); many " "fingerprints can be separated by commas; if this option " "is set, the other checks on certificates are NOT " - "performed (option \"ssl_verify\") " + "performed (option \"tls_verify\") " "(note: content is evaluated, see /help eval; server " "options are evaluated with ${irc_server.xxx} and " "${server} is replaced by the server name)"), @@ -1865,11 +1865,11 @@ irc_config_server_new_option (struct t_config_file *config_file, callback_change_data, NULL, NULL, NULL); break; - case IRC_SERVER_OPTION_SSL_VERIFY: + case IRC_SERVER_OPTION_TLS_VERIFY: new_option = weechat_config_new_option ( config_file, section, option_name, "boolean", - N_("check that the SSL connection is fully trusted"), + N_("check that the TLS connection is fully trusted"), NULL, 0, 0, default_value, value, null_value_allowed, @@ -1937,7 +1937,7 @@ irc_config_server_new_option (struct t_config_file *config_file, "digest algorithm, " "\"ecdsa-nist256p-challenge\" for key-based " "challenge authentication, " - "\"external\" for authentication using client side SSL " + "\"external\" for authentication using client side TLS " "certificate"), "plain|scram-sha-1|scram-sha-256|scram-sha-512|" "ecdsa-nist256p-challenge|external", @@ -2780,6 +2780,94 @@ irc_config_server_create_default_options (struct t_config_section *section) } /* + * Updates options in configuration file while reading the file. + */ + +struct t_hashtable * +irc_config_update_cb (const void *pointer, void *data, + struct t_config_file *config_file, + int version_read, + struct t_hashtable *data_read) +{ + const char *ptr_section, *ptr_option; + char *new_option, *pos_option; + int changes; + + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) config_file; + + /* nothing to do if the config file is already up-to-date */ + if (version_read >= IRC_CONFIG_VERSION) + return NULL; + + changes = 0; + + if (version_read < 2) + { + /* + * changes in v2: + * - options "ssl*" renamed to "tls*" + */ + ptr_section = weechat_hashtable_get (data_read, "section"); + ptr_option = weechat_hashtable_get (data_read, "option"); + if (ptr_section + && ptr_option + && (strcmp (ptr_section, "server_default") == 0)) + { + if (strncmp (ptr_option, "ssl", 3) == 0) + { + /* convert server_default options starting with "ssl" */ + new_option = strdup (ptr_option); + if (new_option) + { + memcpy (new_option, "tls", 3); + weechat_printf ( + NULL, + _("IRC option renamed: \"irc.%s.%s\" => \"irc.%s.%s\""), + ptr_section, ptr_option, + ptr_section, new_option); + weechat_hashtable_set (data_read, "option", new_option); + changes++; + free (new_option); + } + } + } + else if (ptr_section + && ptr_option + && (strcmp (ptr_section, "server") == 0)) + { + /* convert server options starting with "ssl" */ + pos_option = strrchr (ptr_option, '.'); + if (pos_option && (strncmp (pos_option + 1, "ssl", 3) == 0)) + { + new_option = strdup (ptr_option); + if (new_option) + { + pos_option = strrchr (new_option, '.'); + if (pos_option) + { + pos_option++; + memcpy (pos_option, "tls", 3); + weechat_printf ( + NULL, + _("IRC option renamed: \"irc.%s.%s\" => \"irc.%s.%s\""), + ptr_section, ptr_option, + ptr_section, new_option); + weechat_hashtable_set (data_read, "option", new_option); + changes++; + } + free (new_option); + } + } + } + } + + return (changes) ? data_read : NULL; +} + +/* * Initializes IRC configuration file. * * Returns: @@ -2811,6 +2899,14 @@ irc_config_init () if (!irc_config_file) return 0; + if (!weechat_config_set_version (irc_config_file, IRC_CONFIG_VERSION, + &irc_config_update_cb, NULL, NULL)) + { + weechat_config_free (irc_config_file); + irc_config_file = NULL; + return 0; + } + /* look */ irc_config_section_look = weechat_config_new_section ( irc_config_file, "look", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index 7b67d4fca..8e25cf71c 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -23,6 +23,8 @@ #define IRC_CONFIG_NAME "irc" #define IRC_CONFIG_PRIO_NAME (TO_STR(IRC_PLUGIN_PRIORITY) "|" IRC_CONFIG_NAME) +#define IRC_CONFIG_VERSION 2 + enum t_irc_config_look_server_buffer { IRC_CONFIG_LOOK_SERVER_BUFFER_MERGE_WITH_CORE = 0, diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index ee248dec1..7ed88ba48 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -80,13 +80,13 @@ char *irc_server_options[IRC_SERVER_NUM_OPTIONS][2] = { { "addresses", "" }, { "proxy", "" }, { "ipv6", "on" }, - { "ssl", "off" }, - { "ssl_cert", "" }, - { "ssl_password", "" }, - { "ssl_priorities", "NORMAL:-VERS-SSL3.0" }, - { "ssl_dhkey_size", "2048" }, - { "ssl_fingerprint", "" }, - { "ssl_verify", "on" }, + { "tls", "off" }, + { "tls_cert", "" }, + { "tls_password", "" }, + { "tls_priorities", "NORMAL:-VERS-SSL3.0" }, + { "tls_dhkey_size", "2048" }, + { "tls_fingerprint", "" }, + { "tls_verify", "on" }, { "password", "" }, { "capabilities", "*" }, { "sasl_mechanism", "plain" }, @@ -409,7 +409,7 @@ irc_server_eval_fingerprint (struct t_irc_server *server) int i, j, rc, algo, length; ptr_fingerprint = IRC_SERVER_OPTION_STRING(server, - IRC_SERVER_OPTION_SSL_FINGERPRINT); + IRC_SERVER_OPTION_TLS_FINGERPRINT); /* empty fingerprint is just ignored (considered OK) */ if (!ptr_fingerprint || !ptr_fingerprint[0]) @@ -1215,7 +1215,7 @@ irc_server_set_tls_version (struct t_irc_server *server) if (server->is_connected) { - if (server->ssl_connected) + if (server->tls_connected) { if (server->gnutls_sess) { @@ -1567,7 +1567,7 @@ irc_server_alloc (const char *name) new_server->authentication_method = IRC_SERVER_AUTH_METHOD_NONE; new_server->sasl_mechanism_used = -1; new_server->is_connected = 0; - new_server->ssl_connected = 0; + new_server->tls_connected = 0; new_server->disconnected = 0; new_server->gnutls_sess = NULL; new_server->tls_cert = NULL; @@ -1702,12 +1702,12 @@ irc_server_alloc (const char *name) * Fields: * - "irc": protocol (mandatory) * - "6": allow use of IPv6 (with fallback on IPv4) - * - "s": use SSL + * - "s": use TLS * - "nick": nickname to use on the server * - "pass": password for the server (can be used as nick password on most * servers) * - "server": server address - * - "port": port (default is 6667 without SSL and 6697 with SSL) + * - "port": port (default is 6667 without TLS and 6697 with TLS) * - "#chan1": channel to auto-join * * Returns pointer to new server, NULL if error. @@ -1720,7 +1720,7 @@ irc_server_alloc_with_url (const char *irc_url) char *pos_address, *pos_port, *pos_channel, *pos; char *server_address, *server_nicks, *server_autojoin; char default_port[16]; - int ipv6, ssl, length; + int ipv6, tls, length; struct t_irc_server *ptr_server; if (!irc_url || !irc_url[0]) @@ -1741,7 +1741,7 @@ irc_server_alloc_with_url (const char *irc_url) pos_channel = NULL; ipv6 = 0; - ssl = 0; + tls = 0; snprintf (default_port, sizeof (default_port), "%d", IRC_SERVER_DEFAULT_PORT); @@ -1765,26 +1765,26 @@ irc_server_alloc_with_url (const char *irc_url) } } - /* check for SSL / IPv6 */ + /* check for TLS / IPv6 */ if (weechat_strcasecmp (irc_url2, "irc6") == 0) { ipv6 = 1; } else if (weechat_strcasecmp (irc_url2, "ircs") == 0) { - ssl = 1; + tls = 1; } else if ((weechat_strcasecmp (irc_url2, "irc6s") == 0) || (weechat_strcasecmp (irc_url2, "ircs6") == 0)) { ipv6 = 1; - ssl = 1; + tls = 1; } - if (ssl) + if (tls) { snprintf (default_port, sizeof (default_port), - "%d", IRC_SERVER_DEFAULT_PORT_SSL); + "%d", IRC_SERVER_DEFAULT_PORT_TLS); } /* search for nick, password, address+port */ @@ -1861,8 +1861,8 @@ irc_server_alloc_with_url (const char *irc_url) weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_IPV6], (ipv6) ? "on" : "off", 1); - weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_SSL], - (ssl) ? "on" : "off", + weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_TLS], + (tls) ? "on" : "off", 1); if (pos_nick && pos_nick[0]) { @@ -1924,7 +1924,7 @@ irc_server_alloc_with_url (const char *irc_url) /* * Applies command line options to a server. * - * For example: -ssl -nossl -password=test -proxy=myproxy + * For example: -tls -notls -password=test -proxy=myproxy */ void @@ -2558,7 +2558,7 @@ irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf) return 0; } - if (server->ssl_connected) + if (server->tls_connected) { if (!server->gnutls_sess) return -1; @@ -2571,7 +2571,7 @@ irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf) if (rc < 0) { - if (server->ssl_connected) + if (server->tls_connected) { weechat_printf ( server->buffer, @@ -3541,7 +3541,7 @@ irc_server_recv_cb (const void *pointer, void *data, int fd) { end_recv = 1; - if (server->ssl_connected) + if (server->tls_connected) { if (!server->gnutls_sess) return WEECHAT_RC_ERROR; @@ -3558,7 +3558,7 @@ irc_server_recv_cb (const void *pointer, void *data, int fd) buffer[num_read] = '\0'; irc_server_msgq_add_buffer (server, buffer); msgq_flush = 1; /* the flush will be done after the loop */ - if (server->ssl_connected + if (server->tls_connected && (gnutls_record_check_pending (server->gnutls_sess) > 0)) { /* @@ -3570,7 +3570,7 @@ irc_server_recv_cb (const void *pointer, void *data, int fd) } else { - if (server->ssl_connected) + if (server->tls_connected) { if ((num_read == 0) || ((num_read != GNUTLS_E_AGAIN) @@ -3982,8 +3982,8 @@ irc_server_close_connection (struct t_irc_server *server) } else { - /* close SSL connection */ - if (server->ssl_connected) + /* close TLS connection */ + if (server->tls_connected) { if (server->sock != -1) gnutls_bye (server->gnutls_sess, GNUTLS_SHUT_WR); @@ -4027,7 +4027,7 @@ irc_server_close_connection (struct t_irc_server *server) server->authentication_method = IRC_SERVER_AUTH_METHOD_NONE; server->sasl_mechanism_used = -1; server->is_connected = 0; - server->ssl_connected = 0; + server->tls_connected = 0; irc_server_set_tls_version (server); } @@ -4375,17 +4375,17 @@ irc_server_connect_cb (const void *pointer, void *data, weechat_printf ( server->buffer, _("%s%s: you should play with option " - "irc.server.%s.ssl_dhkey_size (current value is %d, try " + "irc.server.%s.tls_dhkey_size (current value is %d, try " "a lower value like %d or %d)"), weechat_prefix ("error"), IRC_PLUGIN_NAME, server->name, IRC_SERVER_OPTION_INTEGER ( - server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE), + server, IRC_SERVER_OPTION_TLS_DHKEY_SIZE), IRC_SERVER_OPTION_INTEGER ( - server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE) / 2, + server, IRC_SERVER_OPTION_TLS_DHKEY_SIZE) / 2, IRC_SERVER_OPTION_INTEGER ( - server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE) / 4); + server, IRC_SERVER_OPTION_TLS_DHKEY_SIZE) / 4); } irc_server_close_connection (server); server->current_retry++; @@ -4776,7 +4776,7 @@ irc_server_gnutls_callback (const void *pointer, void *data, unsigned int i, cert_list_len, status; time_t cert_time; char *cert_path, *cert_str, *fingerprint_eval; - char *ssl_password; + char *tls_password; const char *ptr_cert_path, *ptr_fingerprint; int rc, ret, fingerprint_match, hostname_match, cert_temp_init; struct t_hashtable *options; @@ -4821,7 +4821,7 @@ irc_server_gnutls_callback (const void *pointer, void *data, /* get fingerprint option in server */ ptr_fingerprint = IRC_SERVER_OPTION_STRING(server, - IRC_SERVER_OPTION_SSL_FINGERPRINT); + IRC_SERVER_OPTION_TLS_FINGERPRINT); fingerprint_eval = irc_server_eval_fingerprint (server); if (!fingerprint_eval) { @@ -4942,7 +4942,7 @@ irc_server_gnutls_callback (const void *pointer, void *data, server->buffer, _("%sgnutls: certificate fingerprint does NOT match " "(check value of option " - "irc.server.%s.ssl_fingerprint)"), + "irc.server.%s.tls_fingerprint)"), weechat_prefix ("error"), server->name); rc = -1; } @@ -5012,7 +5012,7 @@ irc_server_gnutls_callback (const void *pointer, void *data, { /* using client certificate if it exists */ ptr_cert_path = IRC_SERVER_OPTION_STRING(server, - IRC_SERVER_OPTION_SSL_CERT); + IRC_SERVER_OPTION_TLS_CERT); if (ptr_cert_path && ptr_cert_path[0]) { options = weechat_hashtable_new ( @@ -5045,10 +5045,10 @@ irc_server_gnutls_callback (const void *pointer, void *data, GNUTLS_X509_FMT_PEM); /* key password */ - ssl_password = irc_server_eval_expression ( + tls_password = irc_server_eval_expression ( server, IRC_SERVER_OPTION_STRING(server, - IRC_SERVER_OPTION_SSL_PASSWORD)); + IRC_SERVER_OPTION_TLS_PASSWORD)); /* key */ gnutls_x509_privkey_init (&server->tls_cert_key); @@ -5062,7 +5062,7 @@ irc_server_gnutls_callback (const void *pointer, void *data, ret = gnutls_x509_privkey_import2 (server->tls_cert_key, &filedatum, GNUTLS_X509_FMT_PEM, - ssl_password, + tls_password, 0); #else ret = gnutls_x509_privkey_import (server->tls_cert_key, @@ -5076,7 +5076,7 @@ irc_server_gnutls_callback (const void *pointer, void *data, server->tls_cert_key, &filedatum, GNUTLS_X509_FMT_PEM, - ssl_password, + tls_password, GNUTLS_PKCS_PLAIN); } if (ret < 0) @@ -5129,8 +5129,8 @@ irc_server_gnutls_callback (const void *pointer, void *data, free (cert_str); } - if (ssl_password) - free (ssl_password); + if (tls_password) + free (tls_password); } else { @@ -5147,7 +5147,7 @@ irc_server_gnutls_callback (const void *pointer, void *data, end: /* an error should stop the handshake unless the user doesn't care */ if ((rc == -1) - && (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL_VERIFY) == 0)) + && (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_TLS_VERIFY) == 0)) { rc = 0; } @@ -5288,8 +5288,8 @@ irc_server_connect (struct t_irc_server *server) IRC_PLUGIN_NAME, server->current_address, server->current_port, - (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? - " (SSL)" : "", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_TLS)) ? + " (TLS)" : "", str_proxy_type, str_proxy_address, weechat_config_integer (proxy_port), @@ -5298,8 +5298,8 @@ irc_server_connect (struct t_irc_server *server) _("Connecting to server %s/%d%s via %s proxy %s/%d%s..."), server->current_address, server->current_port, - (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? - " (SSL)" : "", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_TLS)) ? + " (TLS)" : "", str_proxy_type, str_proxy_address, weechat_config_integer (proxy_port), @@ -5314,16 +5314,16 @@ irc_server_connect (struct t_irc_server *server) IRC_PLUGIN_NAME, server->current_address, server->current_port, - (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? - " (SSL)" : ""); + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_TLS)) ? + " (TLS)" : ""); weechat_log_printf ( _("%s%s: connecting to server %s/%d%s..."), "", IRC_PLUGIN_NAME, server->current_address, server->current_port, - (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? - " (SSL)" : ""); + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_TLS)) ? + " (TLS)" : ""); } /* close connection if opened */ @@ -5336,10 +5336,10 @@ irc_server_connect (struct t_irc_server *server) irc_server_autojoin_create_buffers (server); } - /* init SSL if asked and connect */ - server->ssl_connected = 0; - if (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) - server->ssl_connected = 1; + /* init TLS if asked and connect */ + server->tls_connected = 0; + if (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_TLS)) + server->tls_connected = 1; if (!server->fake_server) { server->hook_connect = weechat_hook_connect ( @@ -5348,10 +5348,10 @@ irc_server_connect (struct t_irc_server *server) server->current_port, proxy_type ? weechat_config_integer (proxy_ipv6) : IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6), server->current_retry, - (server->ssl_connected) ? &server->gnutls_sess : NULL, - (server->ssl_connected) ? &irc_server_gnutls_callback : NULL, - IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE), - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_PRIORITIES), + (server->tls_connected) ? &server->gnutls_sess : NULL, + (server->tls_connected) ? &irc_server_gnutls_callback : NULL, + IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_TLS_DHKEY_SIZE), + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_TLS_PRIORITIES), IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME), &irc_server_connect_cb, server, @@ -6167,7 +6167,7 @@ irc_server_hdata_server_cb (const void *pointer, void *data, WEECHAT_HDATA_VAR(struct t_irc_server, authentication_method, INTEGER, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, sasl_mechanism_used, INTEGER, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, is_connected, INTEGER, 0, NULL, NULL); - WEECHAT_HDATA_VAR(struct t_irc_server, ssl_connected, INTEGER, 0, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, tls_connected, INTEGER, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, disconnected, INTEGER, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, gnutls_sess, POINTER, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert, POINTER, 0, NULL, NULL); @@ -6289,26 +6289,26 @@ irc_server_add_to_infolist (struct t_infolist *infolist, if (!weechat_infolist_new_var_integer (ptr_item, "ipv6", IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6))) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "ssl", - IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL))) + if (!weechat_infolist_new_var_integer (ptr_item, "tls", + IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_TLS))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "ssl_cert", - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_CERT))) + if (!weechat_infolist_new_var_string (ptr_item, "tls_cert", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_TLS_CERT))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "ssl_password", - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_PASSWORD))) + if (!weechat_infolist_new_var_string (ptr_item, "tls_password", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_TLS_PASSWORD))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "ssl_priorities", - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_PRIORITIES))) + if (!weechat_infolist_new_var_string (ptr_item, "tls_priorities", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_TLS_PRIORITIES))) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "ssl_dhkey_size", - IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE))) + if (!weechat_infolist_new_var_integer (ptr_item, "tls_dhkey_size", + IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_TLS_DHKEY_SIZE))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "ssl_fingerprint", - IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_FINGERPRINT))) + if (!weechat_infolist_new_var_string (ptr_item, "tls_fingerprint", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_TLS_FINGERPRINT))) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "ssl_verify", - IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL_VERIFY))) + if (!weechat_infolist_new_var_integer (ptr_item, "tls_verify", + IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_TLS_VERIFY))) return 0; if (!weechat_infolist_new_var_string (ptr_item, "password", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PASSWORD))) @@ -6420,7 +6420,7 @@ irc_server_add_to_infolist (struct t_infolist *infolist, return 0; if (!weechat_infolist_new_var_integer (ptr_item, "is_connected", 0)) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "ssl_connected", 0)) + if (!weechat_infolist_new_var_integer (ptr_item, "tls_connected", 0)) return 0; if (!weechat_infolist_new_var_integer (ptr_item, "disconnected", 1)) return 0; @@ -6491,7 +6491,7 @@ irc_server_add_to_infolist (struct t_infolist *infolist, return 0; if (!weechat_infolist_new_var_integer (ptr_item, "is_connected", server->is_connected)) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "ssl_connected", server->ssl_connected)) + if (!weechat_infolist_new_var_integer (ptr_item, "tls_connected", server->tls_connected)) return 0; if (!weechat_infolist_new_var_integer (ptr_item, "disconnected", server->disconnected)) return 0; @@ -6623,56 +6623,56 @@ irc_server_print_log () weechat_log_printf (" ipv6. . . . . . . . . . . : %s", (weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_IPV6])) ? "on" : "off"); - /* ssl */ - if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SSL])) - weechat_log_printf (" ssl . . . . . . . . . . . : null (%s)", - (IRC_SERVER_OPTION_BOOLEAN(ptr_server, IRC_SERVER_OPTION_SSL)) ? + /* tls */ + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_TLS])) + weechat_log_printf (" tls . . . . . . . . . . . : null (%s)", + (IRC_SERVER_OPTION_BOOLEAN(ptr_server, IRC_SERVER_OPTION_TLS)) ? "on" : "off"); else - weechat_log_printf (" ssl . . . . . . . . . . . : %s", - (weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_SSL])) ? + weechat_log_printf (" tls . . . . . . . . . . . : %s", + (weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_TLS])) ? "on" : "off"); - /* ssl_cert */ - if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SSL_CERT])) - weechat_log_printf (" ssl_cert. . . . . . . . . : null ('%s')", - IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_SSL_CERT)); + /* tls_cert */ + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_TLS_CERT])) + weechat_log_printf (" tls_cert. . . . . . . . . : null ('%s')", + IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_TLS_CERT)); else - weechat_log_printf (" ssl_cert. . . . . . . . . : '%s'", - weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_SSL_CERT])); - /* ssl_password */ - if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SSL_PASSWORD])) - weechat_log_printf (" ssl_password. . . . . . . : null"); + weechat_log_printf (" tls_cert. . . . . . . . . : '%s'", + weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_TLS_CERT])); + /* tls_password */ + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_TLS_PASSWORD])) + weechat_log_printf (" tls_password. . . . . . . : null"); else - weechat_log_printf (" ssl_password. . . . . . . : (hidden)"); - /* ssl_priorities */ - if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SSL_PRIORITIES])) - weechat_log_printf (" ssl_priorities. . . . . . : null ('%s')", - IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_SSL_PRIORITIES)); + weechat_log_printf (" tls_password. . . . . . . : (hidden)"); + /* tls_priorities */ + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_TLS_PRIORITIES])) + weechat_log_printf (" tls_priorities. . . . . . : null ('%s')", + IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_TLS_PRIORITIES)); else - weechat_log_printf (" ssl_priorities. . . . . . : '%s'", - weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_SSL_PRIORITIES])); - /* ssl_dhkey_size */ - if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SSL_DHKEY_SIZE])) - weechat_log_printf (" ssl_dhkey_size. . . . . . : null ('%d')", - IRC_SERVER_OPTION_INTEGER(ptr_server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE)); + weechat_log_printf (" tls_priorities. . . . . . : '%s'", + weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_TLS_PRIORITIES])); + /* tls_dhkey_size */ + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_TLS_DHKEY_SIZE])) + weechat_log_printf (" tls_dhkey_size. . . . . . : null ('%d')", + IRC_SERVER_OPTION_INTEGER(ptr_server, IRC_SERVER_OPTION_TLS_DHKEY_SIZE)); else - weechat_log_printf (" ssl_dhkey_size. . . . . . : '%d'", - weechat_config_integer (ptr_server->options[IRC_SERVER_OPTION_SSL_DHKEY_SIZE])); - /* ssl_fingerprint */ - if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SSL_FINGERPRINT])) - weechat_log_printf (" ssl_fingerprint . . . . . : null ('%s')", - IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_SSL_FINGERPRINT)); + weechat_log_printf (" tls_dhkey_size. . . . . . : '%d'", + weechat_config_integer (ptr_server->options[IRC_SERVER_OPTION_TLS_DHKEY_SIZE])); + /* tls_fingerprint */ + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT])) + weechat_log_printf (" tls_fingerprint . . . . . : null ('%s')", + IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_TLS_FINGERPRINT)); else - weechat_log_printf (" ssl_fingerprint . . . . . : '%s'", - weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_SSL_FINGERPRINT])); - /* ssl_verify */ - if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SSL_VERIFY])) - weechat_log_printf (" ssl_verify. . . . . . . . : null (%s)", - (IRC_SERVER_OPTION_BOOLEAN(ptr_server, IRC_SERVER_OPTION_SSL_VERIFY)) ? + weechat_log_printf (" tls_fingerprint . . . . . : '%s'", + weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT])); + /* tls_verify */ + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_TLS_VERIFY])) + weechat_log_printf (" tls_verify. . . . . . . . : null (%s)", + (IRC_SERVER_OPTION_BOOLEAN(ptr_server, IRC_SERVER_OPTION_TLS_VERIFY)) ? "on" : "off"); else - weechat_log_printf (" ssl_verify. . . . . . . . : %s", - (weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_SSL_VERIFY])) ? + weechat_log_printf (" tls_verify. . . . . . . . : %s", + (weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_TLS_VERIFY])) ? "on" : "off"); /* password */ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_PASSWORD])) @@ -6917,7 +6917,7 @@ irc_server_print_log () weechat_log_printf (" authentication_method . . : %d", ptr_server->authentication_method); weechat_log_printf (" sasl_mechanism_used . . . : %d", ptr_server->sasl_mechanism_used); weechat_log_printf (" is_connected. . . . . . . : %d", ptr_server->is_connected); - weechat_log_printf (" ssl_connected . . . . . . : %d", ptr_server->ssl_connected); + weechat_log_printf (" tls_connected . . . . . . : %d", ptr_server->tls_connected); weechat_log_printf (" disconnected. . . . . . . : %d", ptr_server->disconnected); weechat_log_printf (" gnutls_sess . . . . . . . : 0x%lx", ptr_server->gnutls_sess); weechat_log_printf (" tls_cert. . . . . . . . . : 0x%lx", ptr_server->tls_cert); diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h index 7ac282a8f..e40f8b62e 100644 --- a/src/plugins/irc/irc-server.h +++ b/src/plugins/irc/irc-server.h @@ -52,13 +52,13 @@ enum t_irc_server_option IRC_SERVER_OPTION_ADDRESSES = 0, /* server addresses (IP/name with port) */ IRC_SERVER_OPTION_PROXY, /* proxy used for server (optional) */ IRC_SERVER_OPTION_IPV6, /* use IPv6 protocol */ - IRC_SERVER_OPTION_SSL, /* SSL protocol */ - IRC_SERVER_OPTION_SSL_CERT, /* client ssl certificate file */ - IRC_SERVER_OPTION_SSL_PASSWORD, /* client ssl certificate key password */ - IRC_SERVER_OPTION_SSL_PRIORITIES, /* gnutls priorities */ - IRC_SERVER_OPTION_SSL_DHKEY_SIZE, /* Diffie Hellman key size */ - IRC_SERVER_OPTION_SSL_FINGERPRINT, /* SHA1 fingerprint of certificate */ - IRC_SERVER_OPTION_SSL_VERIFY, /* check if the connection is trusted */ + IRC_SERVER_OPTION_TLS, /* TLS protocol */ + IRC_SERVER_OPTION_TLS_CERT, /* client TLS certificate file */ + IRC_SERVER_OPTION_TLS_PASSWORD, /* client TLS certificate key password */ + IRC_SERVER_OPTION_TLS_PRIORITIES, /* gnutls priorities */ + IRC_SERVER_OPTION_TLS_DHKEY_SIZE, /* Diffie Hellman key size */ + IRC_SERVER_OPTION_TLS_FINGERPRINT, /* SHA1 fingerprint of certificate */ + IRC_SERVER_OPTION_TLS_VERIFY, /* check if the connection is trusted */ IRC_SERVER_OPTION_PASSWORD, /* password for server */ IRC_SERVER_OPTION_CAPABILITIES, /* client capabilities to enable */ IRC_SERVER_OPTION_SASL_MECHANISM,/* mechanism for SASL authentication */ @@ -121,7 +121,7 @@ enum t_irc_server_option : weechat_config_string_default(irc_config_server_default[__index]))) #define IRC_SERVER_DEFAULT_PORT 6667 -#define IRC_SERVER_DEFAULT_PORT_SSL 6697 +#define IRC_SERVER_DEFAULT_PORT_TLS 6697 #define IRC_SERVER_DEFAULT_NICKS "weechat1,weechat2,weechat3,weechat4,weechat5" /* number of queues for sending messages */ @@ -212,11 +212,11 @@ struct t_irc_server int authentication_method; /* authentication method used to login */ int sasl_mechanism_used; /* SASL method used at login time */ int is_connected; /* 1 if WeeChat is connected to server */ - int ssl_connected; /* = 1 if connected with SSL */ + int tls_connected; /* = 1 if connected with TLS */ int disconnected; /* 1 if server has been disconnected */ - gnutls_session_t gnutls_sess; /* gnutls session (only if SSL is used) */ - gnutls_x509_crt_t tls_cert; /* certificate used if ssl_cert is set */ - gnutls_x509_privkey_t tls_cert_key; /* key used if ssl_cert is set */ + gnutls_session_t gnutls_sess; /* gnutls session (only if TLS is used) */ + gnutls_x509_crt_t tls_cert; /* certificate used if tls_cert is set */ + gnutls_x509_privkey_t tls_cert_key; /* key used if tls_cert is set */ char *unterminated_message; /* beginning of a message in input buf */ int nicks_count; /* number of nicknames */ char **nicks_array; /* nicknames (after split) */ diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c index 355a085c0..ec34b9a85 100644 --- a/src/plugins/irc/irc-upgrade.c +++ b/src/plugins/irc/irc-upgrade.c @@ -431,7 +431,11 @@ irc_upgrade_read_cb (const void *pointer, void *data, irc_upgrade_current_server->sasl_mechanism_used = -1; } irc_upgrade_current_server->is_connected = weechat_infolist_integer (infolist, "is_connected"); - irc_upgrade_current_server->ssl_connected = weechat_infolist_integer (infolist, "ssl_connected"); + /* "tls_connected" replaces "ssl_connected" in WeeChat 4.0.0 */ + if (weechat_infolist_search_var (infolist, "tls_connected")) + irc_upgrade_current_server->tls_connected = weechat_infolist_integer (infolist, "tls_connected"); + else + irc_upgrade_current_server->tls_connected = weechat_infolist_integer (infolist, "ssl_connected"); irc_upgrade_current_server->disconnected = weechat_infolist_integer (infolist, "disconnected"); str = weechat_infolist_string (infolist, "unterminated_message"); if (str) diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c index ea6612cec..f545dd603 100644 --- a/src/plugins/irc/irc.c +++ b/src/plugins/irc/irc.c @@ -104,7 +104,7 @@ irc_signal_upgrade_cb (const void *pointer, void *data, void *signal_data) { struct t_irc_server *ptr_server; - int quit, ssl_disconnected; + int quit, tls_disconnected; /* make C compiler happy */ (void) pointer; @@ -127,25 +127,25 @@ irc_signal_upgrade_cb (const void *pointer, void *data, quit = (signal_data && (strcmp (signal_data, "quit") == 0)); - ssl_disconnected = 0; + tls_disconnected = 0; for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { /* - * FIXME: it's not possible to upgrade with SSL servers connected + * FIXME: it's not possible to upgrade with TLS servers connected * (GnuTLS library can't reload data after upgrade), so we close - * connection for all SSL servers currently connected + * connection for all TLS servers currently connected */ - if (ptr_server->is_connected && (ptr_server->ssl_connected || quit)) + if (ptr_server->is_connected && (ptr_server->tls_connected || quit)) { if (!quit) { - ssl_disconnected++; + tls_disconnected++; weechat_printf ( ptr_server->buffer, _("%s%s: disconnecting from server because upgrade can't " - "work for servers connected via SSL"), + "work for servers connected via TLS"), weechat_prefix ("error"), IRC_PLUGIN_NAME); } irc_server_disconnect (ptr_server, 0, 0); @@ -160,18 +160,18 @@ irc_signal_upgrade_cb (const void *pointer, void *data, ptr_server->reconnect_delay - 1; } } - if (ssl_disconnected > 0) + if (tls_disconnected > 0) { weechat_printf ( NULL, NG_("%s%s: disconnected from %d server " - "(SSL connection not supported with upgrade)", + "(TLS connection not supported with upgrade)", "%s%s: disconnected from %d servers " - "(SSL connection not supported with upgrade)", - ssl_disconnected), + "(TLS connection not supported with upgrade)", + tls_disconnected), weechat_prefix ("error"), IRC_PLUGIN_NAME, - ssl_disconnected); + tls_disconnected); } return WEECHAT_RC_OK; |