pidgin: 21d37789: After trying the available SASL mechs, j...

evands at pidgin.im evands at pidgin.im
Fri May 2 18:55:50 EDT 2008


-----------------------------------------------------------------
Revision: 21d37789f674809d615fc7676a092f1da438b0f5
Ancestor: b28057d6ade7c221b0616c3b02e86659e2d8b10b
Author: evands at pidgin.im
Date: 2008-05-02T22:50:13
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/21d37789f674809d615fc7676a092f1da438b0f5

Modified files:
        libpurple/protocols/jabber/auth.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/auth.c	b2095ab8bfd68a544933793bc20645ffe0033571
+++ libpurple/protocols/jabber/auth.c	df5b848ea3fe1a1fc09c21ebc2dff76a99c2b90d
@@ -377,6 +377,10 @@ static void jabber_auth_start_cyrus(Jabb
 					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 @@ void jabber_auth_handle_failure(JabberSt
 			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);


More information about the Commits mailing list