changeset 22767:d5b3afea8764

After trying the available SASL mechs, jabber_auth_handle_failure() now proceeds to regular error handling instead of falling through to a final attempt with no remaining SASL mechs. Also, when removing a SASL mech from the js->sasl_mechs string, remove its preceding space, as well, so we can easily see if the string is empty just by checking its length.
author Evan Schoenberg <evan.s@dreskin.net>
date Fri, 02 May 2008 22:50:13 +0000
parents 84877c54098b
children 42dfa1139b5c
files libpurple/protocols/jabber/auth.c
diffstat 1 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/auth.c	Tue Apr 29 02:01:43 2008 +0000
+++ b/libpurple/protocols/jabber/auth.c	Fri May 02 22:50:13 2008 +0000
@@ -377,6 +377,10 @@
 					if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) {
 						g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech));
 					}
+					/* Remove space which separated this mech from the next */
+					if (strlen(js->sasl_mechs->str) > 0 && ((js->sasl_mechs->str)[0] == ' ')) {
+						g_string_erase(js->sasl_mechs, 0, 1);	
+					}
 					again = TRUE;
 				}
 
@@ -1107,12 +1111,18 @@
 			if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) {
 				g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech));
 			}
+			/* Remove space which separated this mech from the next */
+			if (strlen(js->sasl_mechs->str) > 0 && ((js->sasl_mechs->str)[0] == ' ')) {
+				g_string_erase(js->sasl_mechs, 0, 1);	
+			}			
 		}
-
-		sasl_dispose(&js->sasl);
-
-		jabber_auth_start_cyrus(js);
-		return;
+		if (strlen(js->sasl_mechs->str)) {
+			/* If we have remaining mechs to try, do so */
+			sasl_dispose(&js->sasl);
+			
+			jabber_auth_start_cyrus(js);
+			return;
+		}
 	}
 #endif
 	msg = jabber_parse_error(js, packet, &reason);