summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.adoc1
-rw-r--r--src/plugins/irc/irc-protocol.c24
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp2
3 files changed, 18 insertions, 9 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index df2ba226e..5d737f8c2 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -40,6 +40,7 @@ New features::
Bug fixes::
* api: fix function string_match with joker in the string if multiple words matched in input string
+ * irc: fix SASL authentication when AUTHENTICATE message is received with a server name (issue #1679)
* irc: remove unneeded message about Diffie-Hellman shared secret exchange during SSL connection to server (issue #857)
* irc: escape/unescape IRC message tags values (issue #1654)
* irc: set notify level to "private" for received WALLOPS
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 366ee8b1c..9eb6e8de5 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -398,14 +398,19 @@ IRC_PROTOCOL_CALLBACK(account)
IRC_PROTOCOL_CALLBACK(authenticate)
{
- int sasl_mechanism;
- char *sasl_username, *sasl_password, *sasl_key, *answer, *sasl_error;
+ int arg_data, sasl_mechanism;
+ char *ptr_data, *sasl_username, *sasl_password, *sasl_key, *answer;
+ char *sasl_error;
IRC_PROTOCOL_MIN_ARGS(2);
if (!irc_server_sasl_enabled (server))
return WEECHAT_RC_OK;
+ arg_data = (argv[0][0] == ':') ? 2 : 1;
+ ptr_data = (argv_eol[arg_data][0] == ':') ?
+ argv_eol[arg_data] + 1 : argv_eol[arg_data];
+
irc_server_sasl_get_creds (server, &sasl_username, &sasl_password,
&sasl_key);
@@ -421,22 +426,23 @@ IRC_PROTOCOL_CALLBACK(authenticate)
break;
case IRC_SASL_MECHANISM_SCRAM_SHA_1:
answer = irc_sasl_mechanism_scram (
- server, "sha1", argv[1], sasl_username, sasl_password,
- &sasl_error);
+ server, "sha1", ptr_data,
+ sasl_username, sasl_password, &sasl_error);
break;
case IRC_SASL_MECHANISM_SCRAM_SHA_256:
answer = irc_sasl_mechanism_scram (
- server, "sha256", argv[1], sasl_username, sasl_password,
- &sasl_error);
+ server, "sha256", ptr_data,
+ sasl_username, sasl_password, &sasl_error);
break;
case IRC_SASL_MECHANISM_SCRAM_SHA_512:
answer = irc_sasl_mechanism_scram (
- server, "sha512", argv[1], sasl_username, sasl_password,
- &sasl_error);
+ server, "sha512", ptr_data,
+ sasl_username, sasl_password, &sasl_error);
break;
case IRC_SASL_MECHANISM_ECDSA_NIST256P_CHALLENGE:
answer = irc_sasl_mechanism_ecdsa_nist256p_challenge (
- server, argv[1], sasl_username, sasl_key, &sasl_error);
+ server, ptr_data,
+ sasl_username, sasl_key, &sasl_error);
break;
case IRC_SASL_MECHANISM_EXTERNAL:
answer = strdup ("+");
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index e9ff78d43..67776fc80 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -479,6 +479,8 @@ TEST(IrcProtocolWithServer, authenticate)
server_recv ("AUTHENTICATE "
"QQDaUzXAmVffxuzFy77XWBGwABBQAgdinelBrKZaR3wE7nsIETuTVY=");
+ server_recv (":server.address AUTHENTICATE "
+ "QQDaUzXAmVffxuzFy77XWBGwABBQAgdinelBrKZaR3wE7nsIETuTVY=");
}
/*