summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-04-28 12:29:56 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-04-28 12:29:56 +0200
commitf393d0a3d263c7357946513b106e7ab5765fcd75 (patch)
tree020d4e9de84d9295437a43794a5d0197675bc714 /src
parentf4f90e85fb668ddb22b5148d356a25d689bdfd08 (diff)
downloadweechat-f393d0a3d263c7357946513b106e7ab5765fcd75.zip
irc: add option "ssl_priorities" in servers (task #10106, debian #624055)
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-hook.c11
-rw-r--r--src/core/wee-hook.h2
-rw-r--r--src/core/wee-network.c37
-rw-r--r--src/plugins/irc/irc-config.c155
-rw-r--r--src/plugins/irc/irc-config.h5
-rw-r--r--src/plugins/irc/irc-display.c8
-rw-r--r--src/plugins/irc/irc-server.c19
-rw-r--r--src/plugins/irc/irc-server.h1
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c1
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c1
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c1
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c1
-rw-r--r--src/plugins/scripts/script-api.c5
-rw-r--r--src/plugins/scripts/script-api.h4
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c1
-rw-r--r--src/plugins/weechat-plugin.h10
16 files changed, 199 insertions, 63 deletions
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index 822359877..3d94446aa 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -1638,9 +1638,10 @@ hook_process_run (struct t_hook *hook_process)
*/
struct t_hook *
-hook_connect (struct t_weechat_plugin *plugin, const char *proxy, const char *address,
- int port, int sock, int ipv6, void *gnutls_sess, void *gnutls_cb,
- int gnutls_dhkey_size, const char *local_hostname,
+hook_connect (struct t_weechat_plugin *plugin, const char *proxy,
+ const char *address, int port, int sock, int ipv6,
+ void *gnutls_sess, void *gnutls_cb, int gnutls_dhkey_size,
+ const char *gnutls_priorities, const char *local_hostname,
t_hook_callback_connect *callback, void *callback_data)
{
struct t_hook *new_hook;
@@ -1651,6 +1652,7 @@ hook_connect (struct t_weechat_plugin *plugin, const char *proxy, const char *ad
(void) gnutls_sess;
(void) gnutls_cb;
(void) gnutls_dhkey_size;
+ (void) gnutls_priorities;
#endif
if ((sock < 0) || !address || (port <= 0) || !callback)
@@ -1680,6 +1682,8 @@ hook_connect (struct t_weechat_plugin *plugin, const char *proxy, const char *ad
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
new_hook_connect->local_hostname = (local_hostname) ?
strdup (local_hostname) : NULL;
@@ -3418,6 +3422,7 @@ hook_print_log ()
log_printf (" gnutls_sess . . . . . : 0x%lx", HOOK_CONNECT(ptr_hook, gnutls_sess));
log_printf (" gnutls_cb . . . . . . : 0x%lx", HOOK_CONNECT(ptr_hook, gnutls_cb));
log_printf (" gnutls_dhkey_size . . : %d", HOOK_CONNECT(ptr_hook, gnutls_dhkey_size));
+ log_printf (" gnutls_priorities . . : '%s'", HOOK_CONNECT(ptr_hook, gnutls_priorities));
#endif
log_printf (" local_hostname. . . . : '%s'", HOOK_CONNECT(ptr_hook, local_hostname));
log_printf (" child_read. . . . . . : %d", HOOK_CONNECT(ptr_hook, child_read));
diff --git a/src/core/wee-hook.h b/src/core/wee-hook.h
index 457518716..dddb79329 100644
--- a/src/core/wee-hook.h
+++ b/src/core/wee-hook.h
@@ -221,6 +221,7 @@ struct t_hook_connect
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
char *local_hostname; /* force local hostname (optional) */
int child_read; /* to read data in pipe from child */
@@ -408,6 +409,7 @@ extern struct t_hook *hook_connect (struct t_weechat_plugin *plugin,
int port, int sock, int ipv6,
void *gnutls_session, void *gnutls_cb,
int gnutls_dhkey_size,
+ const char *gnutls_priorities,
const char *local_hostname,
t_hook_callback_connect *callback,
void *callback_data);
diff --git a/src/core/wee-network.c b/src/core/wee-network.c
index 26e88661e..b0fdf5e70 100644
--- a/src/core/wee-network.c
+++ b/src/core/wee-network.c
@@ -59,14 +59,6 @@ int network_init_ok = 0;
#ifdef HAVE_GNUTLS
gnutls_certificate_credentials gnutls_xcred; /* GnuTLS client credentials */
-const int gnutls_cert_type_prio[] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 };
-#if LIBGNUTLS_VERSION_NUMBER >= 0x010700
- const int gnutls_prot_prio[] = { GNUTLS_TLS1_2, GNUTLS_TLS1_1,
- GNUTLS_TLS1_0, GNUTLS_SSL3, 0 };
-#else
- const int gnutls_prot_prio[] = { GNUTLS_TLS1_1, GNUTLS_TLS1_0,
- GNUTLS_SSL3, 0 };
-#endif
#endif
@@ -1004,6 +996,10 @@ void
network_connect_with_fork (struct t_hook *hook_connect)
{
int child_pipe[2];
+#ifdef HAVE_GNUTLS
+ int rc;
+ const char *pos_error;
+#endif
#ifndef __CYGWIN__
pid_t pid;
#endif
@@ -1012,20 +1008,27 @@ network_connect_with_fork (struct t_hook *hook_connect)
/* initialize GnuTLS if SSL asked */
if (HOOK_CONNECT(hook_connect, gnutls_sess))
{
- if (gnutls_init (HOOK_CONNECT(hook_connect, gnutls_sess), GNUTLS_CLIENT) != 0)
+ if (gnutls_init (HOOK_CONNECT(hook_connect, gnutls_sess), GNUTLS_CLIENT) != GNUTLS_E_SUCCESS)
{
(void) (HOOK_CONNECT(hook_connect, callback))
(hook_connect->callback_data,
- '0' + WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR,
+ WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR,
0, NULL, NULL);
unhook (hook_connect);
return;
}
- gnutls_set_default_priority (*HOOK_CONNECT(hook_connect, gnutls_sess));
- gnutls_certificate_type_set_priority (*HOOK_CONNECT(hook_connect, gnutls_sess),
- gnutls_cert_type_prio);
- gnutls_protocol_set_priority (*HOOK_CONNECT(hook_connect, gnutls_sess),
- gnutls_prot_prio);
+ rc = gnutls_priority_set_direct (*HOOK_CONNECT(hook_connect, gnutls_sess),
+ HOOK_CONNECT(hook_connect, gnutls_priorities),
+ &pos_error);
+ if (rc != GNUTLS_E_SUCCESS)
+ {
+ (void) (HOOK_CONNECT(hook_connect, callback))
+ (hook_connect->callback_data,
+ WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR,
+ 0, _("invalid priorities"), NULL);
+ unhook (hook_connect);
+ return;
+ }
gnutls_credentials_set (*HOOK_CONNECT(hook_connect, gnutls_sess),
GNUTLS_CRD_CERTIFICATE,
gnutls_xcred);
@@ -1039,7 +1042,7 @@ network_connect_with_fork (struct t_hook *hook_connect)
{
(void) (HOOK_CONNECT(hook_connect, callback))
(hook_connect->callback_data,
- '0' + WEECHAT_HOOK_CONNECT_MEMORY_ERROR,
+ WEECHAT_HOOK_CONNECT_MEMORY_ERROR,
0, NULL, NULL);
unhook (hook_connect);
return;
@@ -1062,7 +1065,7 @@ network_connect_with_fork (struct t_hook *hook_connect)
case -1:
(void) (HOOK_CONNECT(hook_connect, callback))
(hook_connect->callback_data,
- '0' + WEECHAT_HOOK_CONNECT_MEMORY_ERROR,
+ WEECHAT_HOOK_CONNECT_MEMORY_ERROR,
0, NULL, NULL);
unhook (hook_connect);
return;
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 641a76aea..d368cf47a 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -801,6 +801,76 @@ irc_config_server_default_change_cb (void *data, struct t_config_option *option)
}
/*
+ * irc_config_check_gnutls_priorities: check string with GnuTLS priorities
+ * return NULL if ok, or pointer to char
+ * with error in string
+ */
+
+const char *
+irc_config_check_gnutls_priorities (const char *priorities)
+{
+#ifdef HAVE_GNUTLS
+ gnutls_priority_t priority_cache;
+ const char *pos_error;
+ int rc;
+
+ if (!priorities || !priorities[0])
+ return NULL;
+
+ rc = gnutls_priority_init (&priority_cache, priorities, &pos_error);
+ if (rc == GNUTLS_E_SUCCESS)
+ return NULL;
+ if (pos_error)
+ return pos_error;
+ return priorities;
+#else
+ /* make C compiler happy */
+ (void) priorities;
+
+ return NULL;
+#endif
+}
+
+/*
+ * irc_config_server_check_value_cb: callback called to check a server option
+ * when it is modified
+ */
+
+int
+irc_config_server_check_value_cb (void *data,
+ struct t_config_option *option,
+ const char *value)
+{
+ int index_option;
+ const char *pos_error;
+
+ /* make C compiler happy */
+ (void) option;
+
+ index_option = irc_server_search_option (data);
+ if (index_option >= 0)
+ {
+ switch (index_option)
+ {
+ case IRC_SERVER_OPTION_SSL_PRIORITIES:
+ pos_error = irc_config_check_gnutls_priorities (value);
+ if (pos_error)
+ {
+ weechat_printf (NULL,
+ _("%s%s: invalid priorities string, error "
+ "at this position in string: \"%s\""),
+ weechat_prefix ("error"), IRC_PLUGIN_NAME,
+ pos_error);
+ return 0;
+ }
+ break;
+ }
+ }
+
+ return 1;
+}
+
+/*
* irc_config_server_change_cb: callback called when a server option is modified
*/
@@ -1185,6 +1255,8 @@ irc_config_server_new_option (struct t_config_file *config_file,
const char *default_value,
const char *value,
int null_value_allowed,
+ void *callback_check_value,
+ void *callback_check_value_data,
void *callback_change,
void *callback_change_data)
{
@@ -1202,7 +1274,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1214,7 +1286,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1226,7 +1298,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1238,7 +1310,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1252,7 +1324,22 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
+ callback_change, callback_change_data,
+ NULL, NULL);
+ break;
+ case IRC_SERVER_OPTION_SSL_PRIORITIES:
+ new_option = weechat_config_new_option (
+ config_file, section,
+ option_name, "string",
+ N_("string with priorities for gnutls (for syntax, see "
+ "documentation of function gnutls_priority_init in gnutls "
+ "manual, common strings are: \"PERFORMANCE\", \"NORMAL\", "
+ "\"SECURE128\", \"SECURE256\", \"EXPORT\", \"NONE\")"),
+ NULL, 0, 0,
+ default_value, value,
+ null_value_allowed,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1264,7 +1351,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, INT_MAX,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1276,7 +1363,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1288,7 +1375,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1300,7 +1387,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
"plain|dh-blowfish", 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1312,7 +1399,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1324,7 +1411,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1337,7 +1424,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 1, 3600,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1349,7 +1436,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1361,7 +1448,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1373,7 +1460,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 1, 65535,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1385,7 +1472,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1397,7 +1484,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1409,7 +1496,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1422,7 +1509,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1437,7 +1524,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1450,7 +1537,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 3600,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1463,7 +1550,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1475,7 +1562,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1487,7 +1574,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 3600*24,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1502,7 +1589,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 1, 3600,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1516,7 +1603,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 60,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1530,7 +1617,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 60,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1543,7 +1630,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 60 * 24 * 7,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1556,7 +1643,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 1000000,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1569,7 +1656,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1582,7 +1669,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- NULL, NULL,
+ callback_check_value, callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1596,8 +1683,8 @@ irc_config_server_new_option (struct t_config_file *config_file,
default_value, value,
null_value_allowed,
(section == irc_config_section_server_default) ?
- &irc_config_server_default_check_notify : NULL,
- NULL,
+ &irc_config_server_default_check_notify : callback_check_value,
+ callback_check_value_data,
callback_change, callback_change_data,
NULL, NULL);
break;
@@ -1782,6 +1869,8 @@ irc_config_server_create_default_options (struct t_config_section *section)
irc_server_option_default[i],
default_value,
0,
+ &irc_config_server_check_value_cb,
+ irc_server_option_string[i],
&irc_config_server_default_change_cb,
irc_server_option_string[i]);
}
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index ae01d5931..912f1de6b 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -154,6 +154,9 @@ extern struct t_hashtable *irc_config_hashtable_nick_color_force;
extern struct t_hashtable *irc_config_hashtable_nick_prefixes;
extern void irc_config_set_nick_colors ();
+extern int irc_config_server_check_value_cb (void *data,
+ struct t_config_option *option,
+ const char *value);
extern void irc_config_server_change_cb (void *data,
struct t_config_option *option);
struct t_config_option *irc_config_server_new_option (struct t_config_file *config_file,
@@ -163,6 +166,8 @@ struct t_config_option *irc_config_server_new_option (struct t_config_file *conf
const char *default_value,
const char *value,
int null_value_allowed,
+ void *callback_check_value,
+ void *callback_check_value_data,
void *callback_change,
void *callback_change_data);
extern int irc_config_init ();
diff --git a/src/plugins/irc/irc-display.c b/src/plugins/irc/irc-display.c
index c123ddf3e..a1ce8f6dd 100644
--- a/src/plugins/irc/irc-display.c
+++ b/src/plugins/irc/irc-display.c
@@ -220,6 +220,14 @@ irc_display_server (struct t_irc_server *server, int with_detail)
weechat_printf (NULL, " ssl_cert . . . . . . : %s'%s'",
IRC_COLOR_CHAT_VALUE,
weechat_config_string (server->options[IRC_SERVER_OPTION_SSL_CERT]));
+ /* 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));
+ else
+ weechat_printf (NULL, " ssl_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)",
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index b642b93cd..c2eca6189 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -66,7 +66,7 @@ struct t_irc_message *irc_msgq_last_msg = NULL;
char *irc_server_option_string[IRC_SERVER_NUM_OPTIONS] =
{ "addresses", "proxy", "ipv6",
- "ssl", "ssl_cert", "ssl_dhkey_size", "ssl_verify",
+ "ssl", "ssl_cert", "ssl_priorities", "ssl_dhkey_size", "ssl_verify",
"password", "sasl_mechanism", "sasl_username", "sasl_password", "sasl_timeout",
"autoconnect", "autoreconnect", "autoreconnect_delay",
"nicks", "username", "realname", "local_hostname",
@@ -80,7 +80,7 @@ char *irc_server_option_string[IRC_SERVER_NUM_OPTIONS] =
char *irc_server_option_default[IRC_SERVER_NUM_OPTIONS] =
{ "", "", "off",
- "off", "", "2048", "on",
+ "off", "", "NORMAL", "2048", "on",
"", "plain", "", "", "15",
"off", "on", "10",
"", "", "", "",
@@ -687,6 +687,8 @@ irc_server_alloc (const char *name)
NULL,
NULL,
1,
+ &irc_config_server_check_value_cb,
+ irc_server_option_string[i],
&irc_config_server_change_cb,
irc_server_option_string[i]);
irc_config_server_change_cb (irc_server_option_string[i],
@@ -3359,6 +3361,7 @@ irc_server_connect (struct t_irc_server *server)
(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),
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME),
&irc_server_connect_cb,
server);
@@ -3368,7 +3371,7 @@ irc_server_connect (struct t_irc_server *server)
server->current_port,
server->sock,
IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6),
- NULL, NULL, 0,
+ NULL, NULL, 0, NULL,
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME),
&irc_server_connect_cb,
server);
@@ -3976,6 +3979,9 @@ irc_server_add_to_infolist (struct t_infolist *infolist,
if (!weechat_infolist_new_var_string (ptr_item, "ssl_cert",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_CERT)))
return 0;
+ if (!weechat_infolist_new_var_string (ptr_item, "ssl_priorities",
+ IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_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)))
return 0;
@@ -4166,6 +4172,13 @@ irc_server_print_log ()
else
weechat_log_printf (" ssl_cert . . . . . . : '%s'",
weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_SSL_CERT]));
+ /* 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));
+ 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')",
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index 6891f9fbc..676959edd 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -38,6 +38,7 @@ enum t_irc_server_option
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_PRIORITIES, /* gnutls priorities */
IRC_SERVER_OPTION_SSL_DHKEY_SIZE, /* Diffie Hellman key size */
IRC_SERVER_OPTION_SSL_VERIFY, /* check if the connection is trusted */
IRC_SERVER_OPTION_PASSWORD, /* password for server */
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index c89ad16d0..50a505b39 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -3729,6 +3729,7 @@ weechat_lua_api_hook_connect (lua_State *L)
NULL, /* gnutls session */
NULL, /* gnutls callback */
0, /* gnutls DH key size */
+ NULL, /* gnutls priorities */
local_hostname,
&weechat_lua_api_hook_connect_cb,
function,
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 97f54c8a6..3847d945a 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -3355,6 +3355,7 @@ XS (XS_weechat_api_hook_connect)
NULL, /* gnutls session */
NULL, /* gnutls callback */
0, /* gnutls DH key size */
+ NULL, /* gnutls priorities */
local_hostname,
&weechat_perl_api_hook_connect_cb,
function,
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index daf7d8b75..12b74ed7e 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -3547,6 +3547,7 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
NULL, /* gnutls session */
NULL, /* gnutls callback */
0, /* gnutls DH key size */
+ NULL, /* gnutls priorities */
local_hostname,
&weechat_python_api_hook_connect_cb,
function,
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index a9df9537a..17e0476d3 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -3856,6 +3856,7 @@ weechat_ruby_api_hook_connect (VALUE class, VALUE proxy, VALUE address,
NULL, /* gnutls session */
NULL, /* gnutls callback */
0, /* gnutls DH key size */
+ NULL, /* gnutls priorities */
c_local_hostname,
&weechat_ruby_api_hook_connect_cb,
c_function,
diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c
index 3aefdd446..b7a6fbf55 100644
--- a/src/plugins/scripts/script-api.c
+++ b/src/plugins/scripts/script-api.c
@@ -929,6 +929,7 @@ script_api_hook_connect (struct t_weechat_plugin *weechat_plugin,
const char *proxy, const char *address, int port,
int sock, int ipv6, void *gnutls_sess,
void *gnutls_cb, int gnutls_dhkey_size,
+ const char *gnutls_priorities,
const char *local_hostname,
int (*callback)(void *data, int status,
int gnutls_rc,
@@ -946,8 +947,8 @@ script_api_hook_connect (struct t_weechat_plugin *weechat_plugin,
new_hook = weechat_hook_connect (proxy, address, port, sock, ipv6,
gnutls_sess, gnutls_cb, gnutls_dhkey_size,
- local_hostname, callback,
- new_script_callback);
+ gnutls_priorities, local_hostname,
+ callback, new_script_callback);
if (!new_hook)
{
script_callback_free_data (new_script_callback);
diff --git a/src/plugins/scripts/script-api.h b/src/plugins/scripts/script-api.h
index a9bc5fe32..80ec4e2b9 100644
--- a/src/plugins/scripts/script-api.h
+++ b/src/plugins/scripts/script-api.h
@@ -170,8 +170,10 @@ extern struct t_hook *script_api_hook_connect (struct t_weechat_plugin *weechat_
int port,
int sock,
int ipv6,
- void *gnutls_sess, void *gnutls_cb,
+ void *gnutls_sess,
+ void *gnutls_cb,
int gnutls_dhkey_size,
+ const char *gnutls_priorities,
const char *local_hostname,
int (*callback)(void *data,
int status,
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index 03e84c30f..bb5b5d250 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -3814,6 +3814,7 @@ weechat_tcl_api_hook_connect (ClientData clientData, Tcl_Interp *interp,
NULL, /* gnutls session */
NULL, /* gnutls callback */
0, /* gnutls DH key size */
+ NULL, /* gnutls priorities */
local_hostname,
&weechat_tcl_api_hook_connect_cb,
function,
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index 87669b9dd..852e8d0fd 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -45,7 +45,7 @@ struct timeval;
*/
/* API version (used to check that plugin has same API and can be loaded) */
-#define WEECHAT_PLUGIN_API_VERSION "20110426-01"
+#define WEECHAT_PLUGIN_API_VERSION "20110428-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -471,6 +471,7 @@ struct t_weechat_plugin
int ipv6,
void *gnutls_sess, void *gnutls_cb,
int gnutls_dhkey_size,
+ const char *gnutls_priorities,
const char *local_hostname,
int (*callback)(void *data,
int status,
@@ -1159,12 +1160,13 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__callback, __callback_data)
#define weechat_hook_connect(__proxy, __address, __port, __sock, \
__ipv6, __gnutls_sess, __gnutls_cb, \
- __gnutls_dhkey_size, __local_hostname, \
- __callback, __data) \
+ __gnutls_dhkey_size, __gnutls_priorities, \
+ __local_hostname, __callback, __data) \
weechat_plugin->hook_connect(weechat_plugin, __proxy, __address, \
__port, __sock, __ipv6, __gnutls_sess, \
__gnutls_cb, __gnutls_dhkey_size, \
- __local_hostname, __callback, __data)
+ __gnutls_priorities, __local_hostname, \
+ __callback, __data)
#define weechat_hook_print(__buffer, __tags, __msg, __strip__colors, \
__callback, __data) \
weechat_plugin->hook_print(weechat_plugin, __buffer, __tags, \