mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
Merge pull request #23 from ailin-nemui/ssl-flip
do not unconditionally enable tls on /connect -!
This commit is contained in:
commit
0e8717acf6
@ -191,8 +191,10 @@ static void server_setup_fill_optlist(SERVER_CONNECT_REC *conn, GHashTable *optl
|
|||||||
|
|
||||||
/* ad-hoc TLS settings from command optlist */
|
/* ad-hoc TLS settings from command optlist */
|
||||||
if ((tmp = g_hash_table_lookup(optlist, "tls_cert")) != NULL ||
|
if ((tmp = g_hash_table_lookup(optlist, "tls_cert")) != NULL ||
|
||||||
(tmp = g_hash_table_lookup(optlist, "ssl_cert")) != NULL)
|
(tmp = g_hash_table_lookup(optlist, "ssl_cert")) != NULL) {
|
||||||
conn->tls_cert = g_strdup(tmp);
|
conn->tls_cert = g_strdup(tmp);
|
||||||
|
conn->use_tls = TRUE;
|
||||||
|
}
|
||||||
if ((tmp = g_hash_table_lookup(optlist, "tls_pkey")) != NULL ||
|
if ((tmp = g_hash_table_lookup(optlist, "tls_pkey")) != NULL ||
|
||||||
(tmp = g_hash_table_lookup(optlist, "ssl_pkey")) != NULL)
|
(tmp = g_hash_table_lookup(optlist, "ssl_pkey")) != NULL)
|
||||||
conn->tls_pkey = g_strdup(tmp);
|
conn->tls_pkey = g_strdup(tmp);
|
||||||
@ -220,10 +222,10 @@ static void server_setup_fill_optlist(SERVER_CONNECT_REC *conn, GHashTable *optl
|
|||||||
if (g_hash_table_lookup(optlist, "notls_verify") != NULL)
|
if (g_hash_table_lookup(optlist, "notls_verify") != NULL)
|
||||||
conn->tls_verify = FALSE;
|
conn->tls_verify = FALSE;
|
||||||
if (g_hash_table_lookup(optlist, "tls_verify") != NULL ||
|
if (g_hash_table_lookup(optlist, "tls_verify") != NULL ||
|
||||||
g_hash_table_lookup(optlist, "ssl_verify") != NULL)
|
g_hash_table_lookup(optlist, "ssl_verify") != NULL) {
|
||||||
conn->tls_verify = TRUE;
|
conn->tls_verify = TRUE;
|
||||||
if ((conn->tls_cert != NULL && conn->tls_cert[0] != '\0') || conn->tls_verify)
|
|
||||||
conn->use_tls = TRUE;
|
conn->use_tls = TRUE;
|
||||||
|
}
|
||||||
if (g_hash_table_lookup(optlist, "notls") != NULL)
|
if (g_hash_table_lookup(optlist, "notls") != NULL)
|
||||||
conn->use_tls = FALSE;
|
conn->use_tls = FALSE;
|
||||||
if (g_hash_table_lookup(optlist, "tls") != NULL ||
|
if (g_hash_table_lookup(optlist, "tls") != NULL ||
|
||||||
|
@ -188,6 +188,7 @@ static void init_userinfo(void)
|
|||||||
|
|
||||||
static void sig_server_setup_read(IRC_SERVER_SETUP_REC *rec, CONFIG_NODE *node)
|
static void sig_server_setup_read(IRC_SERVER_SETUP_REC *rec, CONFIG_NODE *node)
|
||||||
{
|
{
|
||||||
|
int starttls;
|
||||||
g_return_if_fail(rec != NULL);
|
g_return_if_fail(rec != NULL);
|
||||||
g_return_if_fail(node != NULL);
|
g_return_if_fail(node != NULL);
|
||||||
|
|
||||||
@ -197,7 +198,10 @@ static void sig_server_setup_read(IRC_SERVER_SETUP_REC *rec, CONFIG_NODE *node)
|
|||||||
rec->max_cmds_at_once = config_node_get_int(node, "cmds_max_at_once", 0);
|
rec->max_cmds_at_once = config_node_get_int(node, "cmds_max_at_once", 0);
|
||||||
rec->cmd_queue_speed = config_node_get_int(node, "cmd_queue_speed", 0);
|
rec->cmd_queue_speed = config_node_get_int(node, "cmd_queue_speed", 0);
|
||||||
rec->max_query_chans = config_node_get_int(node, "max_query_chans", 0);
|
rec->max_query_chans = config_node_get_int(node, "max_query_chans", 0);
|
||||||
rec->starttls = config_node_get_bool(node, "starttls", STARTTLS_NOTSET);
|
starttls = config_node_get_bool(node, "starttls", -1);
|
||||||
|
rec->starttls = starttls == -1 ? STARTTLS_NOTSET :
|
||||||
|
starttls == 0 ? STARTTLS_DISALLOW :
|
||||||
|
STARTTLS_ENABLED;
|
||||||
if (rec->starttls == STARTTLS_ENABLED) {
|
if (rec->starttls == STARTTLS_ENABLED) {
|
||||||
rec->use_tls = 0;
|
rec->use_tls = 0;
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
(IRC_SERVER_SETUP(server) ? TRUE : FALSE)
|
(IRC_SERVER_SETUP(server) ? TRUE : FALSE)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
STARTTLS_NOTSET = -1, /* */
|
STARTTLS_DISALLOW = -1, /* */
|
||||||
STARTTLS_DISALLOW = 0,
|
STARTTLS_NOTSET = 0,
|
||||||
STARTTLS_ENABLED = 1
|
STARTTLS_ENABLED = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user