File pidgin-sasl-skip-external.patch of Package pidgin.3642

# HG changeset patch
# User Kernc <kerncece@gmail.com>
# Date 1474500293 -7200
#      Thu Sep 22 01:24:53 2016 +0200
# Branch sasl-skip-external
# Node ID 610656636af6d1d6fdd6723d5ef311c903b6a804
# Parent  2bb56551e37e919e3882d876ac08a887bb95ddf2
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

diff -r 2bb56551e37e -r 610656636af6 libpurple/protocols/irc/msgs.c
--- a/libpurple/protocols/irc/msgs.c	Wed Sep 21 12:34:03 2016 -0500
+++ b/libpurple/protocols/irc/msgs.c	Thu Sep 22 01:24:53 2016 +0200
@@ -1564,6 +1564,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;
@@ -1628,6 +1630,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);
 }
openSUSE Build Service is sponsored by