mirror of
https://github.com/irssi/irssi.git
synced 2025-04-26 04:51:11 -05:00
changes suggested by ahf
This commit is contained in:
parent
51508ff1d3
commit
9668217509
@ -99,6 +99,8 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
|
||||
else if (g_hash_table_lookup(optlist, "4") != NULL)
|
||||
conn->family = AF_INET;
|
||||
|
||||
if (g_hash_table_lookup(optlist, "notls") != NULL)
|
||||
conn->use_tls = FALSE;
|
||||
if (g_hash_table_lookup(optlist, "tls") != NULL || g_hash_table_lookup(optlist, "ssl") != NULL)
|
||||
conn->use_tls = TRUE;
|
||||
if ((tmp = g_hash_table_lookup(optlist, "tls_cert")) != NULL || (tmp = g_hash_table_lookup(optlist, "ssl_cert")) != NULL)
|
||||
@ -107,6 +109,8 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
|
||||
conn->tls_pkey = g_strdup(tmp);
|
||||
if ((tmp = g_hash_table_lookup(optlist, "tls_pass")) != NULL || (tmp = g_hash_table_lookup(optlist, "ssl_pass")) != NULL)
|
||||
conn->tls_pass = g_strdup(tmp);
|
||||
if (g_hash_table_lookup(optlist, "notls_verify") != NULL)
|
||||
conn->tls_verify = FALSE;
|
||||
if (g_hash_table_lookup(optlist, "tls_verify") != NULL || g_hash_table_lookup(optlist, "ssl_verify") != NULL)
|
||||
conn->tls_verify = TRUE;
|
||||
if ((tmp = g_hash_table_lookup(optlist, "tls_cafile")) != NULL || (tmp = g_hash_table_lookup(optlist, "ssl_cafile")) != NULL)
|
||||
@ -149,13 +153,13 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
|
||||
return conn;
|
||||
}
|
||||
|
||||
/* SYNTAX: CONNECT [-4 | -6] [-tls] [-tls_cert <cert>] [-tls_pkey <pkey>] [-tls_pass <password>]
|
||||
/* SYNTAX: CONNECT [-4 | -6] [-tls_cert <cert>] [-tls_pkey <pkey>] [-tls_pass <password>]
|
||||
[-tls_verify] [-tls_cafile <cafile>] [-tls_capath <capath>]
|
||||
[-tls_ciphers <list>] [-tls_pinned_cert <fingerprint>] [-tls_pinned_pubkey <fingerprint>]
|
||||
[-!] [-noautosendcmd]
|
||||
[-noproxy] [-network <network>] [-host <hostname>]
|
||||
[-rawlog <file>]
|
||||
<address>|<chatnet> [<port> [<password> [<nick>]]] */
|
||||
[-tls_ciphers <list>] [-tls_pinned_cert <fingerprint>]
|
||||
[-tls_pinned_pubkey <fingerprint>] [-!] [-noautosendcmd] [-tls | -notls]
|
||||
[-starttls | -disallow_starttls] [-noproxy] [-network <network>]
|
||||
[-host <hostname>] [-rawlog <file>]
|
||||
<address>|<chatnet> [<port> [<password> [<nick>]]] */
|
||||
/* NOTE: -network replaces the old -ircnet flag. */
|
||||
static void cmd_connect(const char *data)
|
||||
{
|
||||
@ -520,9 +524,9 @@ void chat_commands_init(void)
|
||||
command_set_options(
|
||||
"connect",
|
||||
"4 6 !! -network ~ssl ~+ssl_cert ~+ssl_pkey ~+ssl_pass ~ssl_verify ~+ssl_cafile "
|
||||
"~+ssl_capath ~+ssl_ciphers ~+ssl_pinned_cert ~+ssl_pinned_pubkey tls +tls_cert "
|
||||
"+tls_pkey +tls_pass tls_verify +tls_cafile +tls_capath +tls_ciphers +tls_pinned_cert "
|
||||
"+tls_pinned_pubkey +host noproxy -rawlog noautosendcmd");
|
||||
"~+ssl_capath ~+ssl_ciphers ~+ssl_pinned_cert ~+ssl_pinned_pubkey tls notls +tls_cert "
|
||||
"+tls_pkey +tls_pass tls_verify notls_verify +tls_cafile +tls_capath +tls_ciphers "
|
||||
"+tls_pinned_cert +tls_pinned_pubkey +host noproxy -rawlog noautosendcmd");
|
||||
command_set_options("msg", "channel nick");
|
||||
}
|
||||
|
||||
|
@ -51,9 +51,10 @@ const char *get_visible_target(IRC_SERVER_REC *server, const char *target)
|
||||
return target;
|
||||
}
|
||||
|
||||
/* SYNTAX: SERVER ADD|MODIFY [-4 | -6] [-tls] [-tls_cert <cert>] [-tls_pkey <pkey>]
|
||||
/* SYNTAX: SERVER ADD|MODIFY [-4 | -6] [-tls_cert <cert>] [-tls_pkey <pkey>]
|
||||
[-tls_pass <password>] [-tls_verify] [-tls_cafile <cafile>]
|
||||
[-tls_capath <capath>] [-tls_ciphers <list>] [-starttls | -nostarttls]
|
||||
[-tls_capath <capath>] [-tls_ciphers <list>] [-tls | -notls]
|
||||
[-starttls | -nostarttls | -disallow_starttls | -nodisallow_starttls]
|
||||
[-auto | -noauto] [-network <network>] [-host <hostname>]
|
||||
[-cmdspeed <ms>] [-cmdmax <count>] [-port <port>] <address> [<port>
|
||||
[<password>]] */
|
||||
@ -85,9 +86,10 @@ static void sig_server_add_fill(IRC_SERVER_SETUP_REC *rec,
|
||||
if (value != NULL && *value != '\0') rec->max_cmds_at_once = atoi(value);
|
||||
value = g_hash_table_lookup(optlist, "querychans");
|
||||
if (value != NULL && *value != '\0') rec->max_query_chans = atoi(value);
|
||||
if (g_hash_table_lookup(optlist, "nonostarttls"))
|
||||
if (g_hash_table_lookup(optlist, "nodisallow_starttls") ||
|
||||
g_hash_table_lookup(optlist, "nostarttls"))
|
||||
rec->starttls = -1;
|
||||
if (g_hash_table_lookup(optlist, "nostarttls"))
|
||||
if (g_hash_table_lookup(optlist, "disallow_starttls"))
|
||||
rec->starttls = 0;
|
||||
if (g_hash_table_lookup(optlist, "starttls"))
|
||||
rec->starttls = 1;
|
||||
@ -114,8 +116,10 @@ static void cmd_server_list(const char *data)
|
||||
g_string_append(str, "autoconnect, ");
|
||||
if (rec->no_proxy)
|
||||
g_string_append(str, "noproxy, ");
|
||||
if (rec->starttls >= 0)
|
||||
g_string_append_printf(str, "%sstarttls, ", rec->starttls ? "" : "no");
|
||||
if (rec->starttls == 0)
|
||||
g_string_append(str, "disallow_starttls, ");
|
||||
if (rec->starttls == 1)
|
||||
g_string_append(str, "starttls, ");
|
||||
if (rec->use_tls)
|
||||
g_string_append(str, "tls, ");
|
||||
if (rec->tls_cert) {
|
||||
@ -163,12 +167,11 @@ void fe_irc_server_init(void)
|
||||
signal_add("server add fill", (SIGNAL_FUNC) sig_server_add_fill);
|
||||
command_bind("server list", NULL, (SIGNAL_FUNC) cmd_server_list);
|
||||
|
||||
command_set_options(
|
||||
"server add",
|
||||
"-ircnet -network -cmdspeed -cmdmax -querychans starttls nostarttls nonostarttls");
|
||||
command_set_options(
|
||||
"server modify",
|
||||
"-ircnet -network -cmdspeed -cmdmax -querychans starttls nostarttls nonostarttls");
|
||||
command_set_options("server add", "-ircnet -network -cmdspeed -cmdmax -querychans starttls "
|
||||
"nostarttls disallow_starttls nodisallow_starttls");
|
||||
command_set_options("server modify",
|
||||
"-ircnet -network -cmdspeed -cmdmax -querychans starttls nostarttls "
|
||||
"disallow_starttls nodisallow_starttls");
|
||||
}
|
||||
|
||||
void fe_irc_server_deinit(void)
|
||||
|
@ -1053,7 +1053,7 @@ void irc_commands_init(void)
|
||||
signal_add("whois end", (SIGNAL_FUNC) event_end_of_whois);
|
||||
signal_add("whowas event", (SIGNAL_FUNC) event_whowas);
|
||||
|
||||
command_set_options("connect", "+ircnet starttls nostarttls");
|
||||
command_set_options("connect", "+ircnet starttls disallow_starttls");
|
||||
command_set_options("topic", "delete");
|
||||
command_set_options("list", "yes");
|
||||
command_set_options("away", "one all");
|
||||
|
@ -51,7 +51,7 @@ static void sig_server_connect_copy(SERVER_CONNECT_REC **dest,
|
||||
rec->sasl_mechanism = src->sasl_mechanism;
|
||||
rec->sasl_username = g_strdup(src->sasl_username);
|
||||
rec->sasl_password = g_strdup(src->sasl_password);
|
||||
rec->no_starttls = src->no_starttls;
|
||||
rec->disallow_starttls = src->disallow_starttls;
|
||||
rec->starttls = src->starttls;
|
||||
*dest = (SERVER_CONNECT_REC *) rec;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ static void sig_server_setup_fill_reconn(IRC_SERVER_CONNECT_REC *conn,
|
||||
if (sserver->max_query_chans > 0)
|
||||
conn->max_query_chans = sserver->max_query_chans;
|
||||
if (sserver->starttls == 0)
|
||||
conn->no_starttls = 1;
|
||||
conn->disallow_starttls = 1;
|
||||
else if (sserver->starttls == 1)
|
||||
conn->starttls = 1;
|
||||
}
|
||||
@ -67,8 +67,8 @@ static void sig_server_setup_fill_connect(IRC_SERVER_CONNECT_REC *conn, GHashTab
|
||||
|
||||
if (g_hash_table_lookup(optlist, "starttls") != NULL)
|
||||
conn->starttls = 1;
|
||||
else if (g_hash_table_lookup(optlist, "nostarttls") != NULL)
|
||||
conn->no_starttls = 1;
|
||||
else if (g_hash_table_lookup(optlist, "disallow_starttls") != NULL)
|
||||
conn->disallow_starttls = 1;
|
||||
}
|
||||
|
||||
static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn,
|
||||
|
@ -244,7 +244,7 @@ static void server_init_1(IRC_SERVER_REC *server)
|
||||
irc_cap_toggle(server, CAP_ACCOUNT_NOTIFY, TRUE);
|
||||
irc_cap_toggle(server, CAP_SELF_MESSAGE, TRUE);
|
||||
irc_cap_toggle(server, CAP_SERVER_TIME, TRUE);
|
||||
if (!conn->use_tls && (conn->starttls || !conn->no_starttls)) {
|
||||
if (!conn->use_tls && (conn->starttls || !conn->disallow_starttls)) {
|
||||
irc_cap_toggle(server, CAP_STARTTLS, TRUE);
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ void irc_server_send_starttls(IRC_SERVER_REC *server)
|
||||
{
|
||||
g_return_if_fail(server != NULL);
|
||||
|
||||
g_warning("Now attempting STARTTLS");
|
||||
g_warning("[%s] Now attempting STARTTLS", server->tag);
|
||||
irc_send_cmd_now(server, "STARTTLS");
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ struct _IRC_SERVER_CONNECT_REC {
|
||||
int max_query_chans;
|
||||
|
||||
int max_kicks, max_msgs, max_modes, max_whois;
|
||||
int no_starttls:1;
|
||||
int disallow_starttls:1;
|
||||
int starttls:1;
|
||||
};
|
||||
/* clang-format on */
|
||||
|
Loading…
x
Reference in New Issue
Block a user