summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2017-06-17 17:01:42 +0200
committerLemonBoy <thatlemon@gmail.com>2017-07-25 22:53:33 +0200
commitd971c0292082823182f333a412207a9a8f6ad008 (patch)
tree36b3263517d153f8a6ca4045732b093f4a61b593 /src
parent9d3cfe1069b5cfaf0efb972e36695b781ecf93de (diff)
downloadirssi-d971c0292082823182f333a412207a9a8f6ad008.zip
Allow the user to clear the sasl-related fields
There was no easy way for the user to disable the SASL authentication or to clear the username/password once the network was created. Closes #718
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/irc/fe-ircnet.c6
-rw-r--r--src/irc/core/irc-servers-setup.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/fe-common/irc/fe-ircnet.c b/src/fe-common/irc/fe-ircnet.c
index b70a9ea7..24dad63f 100644
--- a/src/fe-common/irc/fe-ircnet.c
+++ b/src/fe-common/irc/fe-ircnet.c
@@ -163,11 +163,11 @@ static void cmd_network_add_modify(const char *data, gboolean add)
/* 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);
+ if (value != NULL) rec->sasl_mechanism = *value != '\0' ? g_strdup(value) : NULL;
value = g_hash_table_lookup(optlist, "sasl_username");
- if (value != NULL && *value != '\0') rec->sasl_username = g_strdup(value);
+ if (value != NULL) rec->sasl_username = *value != '\0' ? g_strdup(value) : NULL;
value = g_hash_table_lookup(optlist, "sasl_password");
- if (value != NULL && *value != '\0') rec->sasl_password = g_strdup(value);
+ if (value != NULL) rec->sasl_password = *value != '\0' ? g_strdup(value) : NULL;
ircnet_create(rec);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NETWORK_ADDED, name);
diff --git a/src/irc/core/irc-servers-setup.c b/src/irc/core/irc-servers-setup.c
index f425b587..6040d3a5 100644
--- a/src/irc/core/irc-servers-setup.c
+++ b/src/irc/core/irc-servers-setup.c
@@ -89,6 +89,8 @@ static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn,
/* Validate the SASL parameters filled by sig_chatnet_read() or cmd_network_add */
conn->sasl_mechanism = SASL_MECHANISM_NONE;
+ conn->sasl_username = NULL;
+ conn->sasl_password = NULL;
if (ircnet->sasl_mechanism != NULL) {
if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "plain")) {
@@ -102,9 +104,7 @@ static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn,
g_warning("The fields sasl_username and sasl_password are either missing or empty");
}
else if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "external")) {
- conn->sasl_mechanism = SASL_MECHANISM_EXTERNAL;
- conn->sasl_username = NULL;
- conn->sasl_password = NULL;
+ conn->sasl_mechanism = SASL_MECHANISM_EXTERNAL;
}
else
g_warning("Unsupported SASL mechanism \"%s\" selected", ircnet->sasl_mechanism);