Commits

Thijs Alkemade committed 375308c

Make a number of errors fatal, so don't attempt to continue when auth failed.

Fix some strcmp calls.

Comments (0)

Files changed (1)

libpurple/protocols/irc/msgs.c

 	sasl_cb[id].id = SASL_CB_LIST_END;
 
 	do {
+		gchar *tmp = NULL;
 		again = FALSE;
 
 		ret = sasl_client_new("irc", irc->server, NULL, NULL, sasl_cb, 0, &irc->sasl_conn);
 
 		if (ret != SASL_OK) {
 			purple_debug_error("irc", "sasl_client_new failed: %d\n", ret);
+			tmp = g_strdup_printf(_("Failed to initialize SASL authentication: %s"),
+				sasl_errdetail(irc->sasl_conn));
+			purple_connection_error_reason (gc,
+				PURPLE_CONNECTION_ERROR_OTHER_ERROR, tmp);
+			g_free(tmp);
 			return;
 		}
 
 
 				purple_notify_error(gc, _("SASL authentication failed"), _("Failed to authenticate using SASL"),
 									_("No worthy authentication mechanisms found."));
+				tmp = g_strdup_printf(_("SASL authentication failed: No worthy authentication mechanisms found."));
+				purple_connection_error_reason (gc,
+					PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, tmp);
+				g_free(tmp);
 
 				irc_sasl_finish(irc);
 				return;
 			case SASL_NOMEM:
 				purple_debug_error("irc", "SASL failed!\n.");
 
+				tmp = g_strdup_printf(_("SASL authentication failed: %s"), sasl_errdetail(irc->sasl_conn));
+				purple_connection_error_reason (gc,
+					PURPLE_CONNECTION_ERROR_OTHER_ERROR, tmp);
+				g_free(tmp);
+
 				irc_sasl_finish(irc);
 				return;
 			default:
 	int ret = 0;
 	PurpleConnection *gc = purple_account_get_connection(irc->account);
 
-	if (!args[1] || !args[2] || strncmp(args[2], "sasl", 5))
+	if (!args[1] || !args[2] || strncmp(args[2], "sasl ", 6))
 		return;
-	if (strcmp(args[1], "ACK")) {
+	if (strncmp(args[1], "ACK", 4)) {
 
 		purple_notify_error(gc, _("SASL authentication failed"), _("Failed to authenticate using SASL"),
 				_("The server does not support SASL authentication."));