summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/help/in/network.in6
-rw-r--r--src/fe-common/irc/fe-ircnet.c24
-rw-r--r--src/irc/core/irc-chatnets.c12
-rw-r--r--src/irc/core/irc-servers-setup.c2
4 files changed, 34 insertions, 10 deletions
diff --git a/docs/help/in/network.in b/docs/help/in/network.in
index 046d9feb..2918f6ae 100644
--- a/docs/help/in/network.in
+++ b/docs/help/in/network.in
@@ -32,6 +32,12 @@
additional commands to the server.
-cmdmax: Specifies the maximum number of commands to perform before
starting the internal flood protection.
+ -sasl_mechanism Specifies the mechanism to use for the SASL authentication.
+ At the moment irssi only supports the 'plain' and the
+ 'external' mechanisms.
+ -sasl_username Specifies the username to use during the SASL authentication.
+ -sasl_password Specifies the password to use during the SASL authentication.
+
The name of the network to add, edit or remove; if no parameter is given,
the list of networks will be displayed.
diff --git a/src/fe-common/irc/fe-ircnet.c b/src/fe-common/irc/fe-ircnet.c
index 6618edd7..dab6f57f 100644
--- a/src/fe-common/irc/fe-ircnet.c
+++ b/src/fe-common/irc/fe-ircnet.c
@@ -82,10 +82,12 @@ static void cmd_network_list(void)
}
/* SYNTAX: NETWORK ADD [-nick <nick>] [-user <user>] [-realname <name>]
- [-host <host>] [-usermode <mode>] [-autosendcmd <cmd>]
- [-querychans <count>] [-whois <count>] [-msgs <count>]
- [-kicks <count>] [-modes <count>]
- [-cmdspeed <ms>] [-cmdmax <count>] <name> */
+ [-host <host>] [-usermode <mode>] [-autosendcmd <cmd>]
+ [-querychans <count>] [-whois <count>] [-msgs <count>]
+ [-kicks <count>] [-modes <count>] [-cmdspeed <ms>]
+ [-cmdmax <count>] [-sasl_mechanism <mechanism>]
+ [-sasl_username <username>] [-sasl_password <password>]
+ <name> */
static void cmd_network_add(const char *data)
{
GHashTable *optlist;
@@ -112,6 +114,9 @@ static void cmd_network_add(const char *data)
}
if (g_hash_table_lookup(optlist, "usermode")) g_free_and_null(rec->usermode);
if (g_hash_table_lookup(optlist, "autosendcmd")) g_free_and_null(rec->autosendcmd);
+ if (g_hash_table_lookup(optlist, "sasl_mechanism")) g_free_and_null(rec->sasl_mechanism);
+ if (g_hash_table_lookup(optlist, "sasl_username")) g_free_and_null(rec->sasl_username);
+ if (g_hash_table_lookup(optlist, "sasl_password")) g_free_and_null(rec->sasl_password);
}
value = g_hash_table_lookup(optlist, "kicks");
@@ -148,6 +153,14 @@ static void cmd_network_add(const char *data)
value = g_hash_table_lookup(optlist, "autosendcmd");
if (value != NULL && *value != '\0') rec->autosendcmd = g_strdup(value);
+ /* the validity of the parameters is checked in sig_server_setup_fill_chatnet */
+ value = g_hash_table_lookup(optlist, "sasl_mechanism");
+ if (value != NULL && *value != '\0') rec->sasl_mechanism = g_strdup(value);
+ value = g_hash_table_lookup(optlist, "sasl_username");
+ if (value != NULL && *value != '\0') rec->sasl_username = g_strdup(value);
+ value = g_hash_table_lookup(optlist, "sasl_password");
+ if (value != NULL && *value != '\0') rec->sasl_password = g_strdup(value);
+
ircnet_create(rec);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NETWORK_ADDED, name);
@@ -186,7 +199,8 @@ void fe_ircnet_init(void)
command_bind("network add", NULL, (SIGNAL_FUNC) cmd_network_add);
command_bind("network remove", NULL, (SIGNAL_FUNC) cmd_network_remove);
- command_set_options("network add", "-kicks -msgs -modes -whois -cmdspeed -cmdmax -nick -user -realname -host -autosendcmd -querychans -usermode");
+ command_set_options("network add", "-kicks -msgs -modes -whois -cmdspeed "
+ "-cmdmax -nick -user -realname -host -autosendcmd -querychans -usermode -sasl_mechanism -sasl_username -sasl_password");
}
void fe_ircnet_deinit(void)
diff --git a/src/irc/core/irc-chatnets.c b/src/irc/core/irc-chatnets.c
index b9b221b8..d72f71dd 100644
--- a/src/irc/core/irc-chatnets.c
+++ b/src/irc/core/irc-chatnets.c
@@ -49,9 +49,9 @@ static void sig_chatnet_read(IRC_CHATNET_REC *rec, CONFIG_NODE *node)
rec->max_modes = config_node_get_int(node, "max_modes", 0);
rec->max_whois = config_node_get_int(node, "max_whois", 0);
- rec->sasl_mechanism = config_node_get_str(node, "sasl_mechanism", NULL);
- rec->sasl_username = config_node_get_str(node, "sasl_username", NULL);
- rec->sasl_password = config_node_get_str(node, "sasl_password", NULL);
+ rec->sasl_mechanism = g_strdup(config_node_get_str(node, "sasl_mechanism", NULL));
+ rec->sasl_username = g_strdup(config_node_get_str(node, "sasl_username", NULL));
+ rec->sasl_password = g_strdup(config_node_get_str(node, "sasl_password", NULL));
}
static void sig_chatnet_saved(IRC_CHATNET_REC *rec, CONFIG_NODE *node)
@@ -88,8 +88,12 @@ static void sig_chatnet_saved(IRC_CHATNET_REC *rec, CONFIG_NODE *node)
static void sig_chatnet_destroyed(IRC_CHATNET_REC *rec)
{
- if (IS_IRC_CHATNET(rec))
+ if (IS_IRC_CHATNET(rec)) {
g_free(rec->usermode);
+ g_free(rec->sasl_mechanism);
+ g_free(rec->sasl_username);
+ g_free(rec->sasl_password);
+ }
}
diff --git a/src/irc/core/irc-servers-setup.c b/src/irc/core/irc-servers-setup.c
index f5e4f8f4..bf1d2ddf 100644
--- a/src/irc/core/irc-servers-setup.c
+++ b/src/irc/core/irc-servers-setup.c
@@ -81,7 +81,7 @@ static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn,
if (ircnet->max_query_chans > 0)
conn->max_query_chans = ircnet->max_query_chans;
- /* Validate the SASL parameters filled by sig_chatnet_read() */
+ /* Validate the SASL parameters filled by sig_chatnet_read() or cmd_network_add */
conn->sasl_mechanism = SASL_MECHANISM_NONE;
if (ircnet->sasl_mechanism != NULL) {