diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-08-03 19:58:13 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-08-03 19:58:13 +0200 |
commit | 791b910a77b24053309d2ae308aed37da0da166c (patch) | |
tree | 2a783b8ace03b9077593f37f9293e2e923aa0ff6 /src/plugins/irc | |
parent | d89c4f559c817a92da94d98baf9f3829238b0392 (diff) | |
download | weechat-791b910a77b24053309d2ae308aed37da0da166c.zip |
irc: fix SASL authentication when AUTHENTICATE message is received with a server name (closes #1679)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 24 |
1 files changed, 15 insertions, 9 deletions
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 ("+"); |