IRC: Skip EXTERNAL SASL auth mechanism release-2.x.y

Thu, 22 Sep 2016 01:24:53 +0200

author
Kernc <kerncece@gmail.com>
date
Thu, 22 Sep 2016 01:24:53 +0200
branch
release-2.x.y
changeset 38210
e11ea6f07c5b
parent 38208
31ecbdda7ff3
child 38212
274575856b52

IRC: Skip EXTERNAL SASL auth mechanism

Makes Freenode and other servers that prefer SASL EXTERNAL
fingerprint authentication work again.

Ref:
"Cannot connect to IRC (Freenode)"
https://pidgin.im/pipermail/support/2016-September/029627.html

libpurple/protocols/irc/msgs.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/irc/msgs.c	Wed Feb 22 12:50:51 2017 -0300
+++ b/libpurple/protocols/irc/msgs.c	Thu Sep 22 01:24:53 2016 +0200
@@ -1574,6 +1574,8 @@
 	int id = 0;
 	PurpleConnection *gc = purple_account_get_connection(irc->account);
 	const char *mech_list = NULL;
+	char *pos;
+	size_t index;
 
 	if (strncmp(args[2], "sasl ", 6))
 		return;
@@ -1637,6 +1639,15 @@
 	}
 
 	irc->sasl_mechs = g_string_new(mech_list);
+	/* Drop EXTERNAL mechanism since we don't support it */
+	if ((pos = strstr(irc->sasl_mechs->str, "EXTERNAL"))) {
+		index = pos - irc->sasl_mechs->str;
+		g_string_erase(irc->sasl_mechs, index, strlen("EXTERNAL"));
+		/* Remove space which separated this mech from the next */
+		if ((irc->sasl_mechs->str)[index] == ' ') {
+			g_string_erase(irc->sasl_mechs, index, 1);
+		}
+	}
 
 	irc_auth_start_cyrus(irc);
 }

mercurial