changeset 20465:2a5c1de05e0a

Fix authentication failures handling (ticket 1246) and fix some compiler warnings
author Carlos Silva <typ0@pidgin.im>
date Sat, 07 Jul 2007 19:55:14 +0000
parents 8f7ccadce62d
children a8599711efb7
files libpurple/protocols/msn/soap.c
diffstat 1 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/soap.c	Thu Jul 05 06:48:38 2007 +0000
+++ b/libpurple/protocols/msn/soap.c	Sat Jul 07 19:55:14 2007 +0000
@@ -362,7 +362,25 @@
 			}
 		}
 
-		msn_session_set_error(session, MSN_ERROR_SERV_UNAVAILABLE, error);
+		msn_session_set_error(session, MSN_ERROR_AUTH, error);
+	}
+	/* Handle Passport 3.0 authentication failures.
+	 * Further info: http://msnpiki.msnfanatic.com/index.php/MSNP13:SOAPTweener
+	 */
+	else if (strstr(soapconn->read_buf,
+				"<faultcode>wsse:FailedAuthentication</faultcode>") != NULL)
+	{
+		char *faultstring;
+
+		faultstring = strstr(soapconn->read_buf, "<faultstring>");
+
+		if (faultstring != NULL)
+		{
+			faultstring += strlen("<faultstring>");
+			*strstr(soapconn->read_buf, "</faultstring>") = '\0';
+		}
+		
+		msn_session_set_error(session, MSN_ERROR_AUTH, faultstring);
 	}
 	else if (strstr(soapconn->read_buf, "HTTP/1.1 503 Service Unavailable"))
 	{
@@ -610,7 +628,7 @@
 					"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"
 					"Accept: */*\r\n"
 					"Host: %s\r\n"
-					"Content-Length: %d\r\n"
+					"Content-Length: %" G_GSIZE_FORMAT "\r\n"
 					"Connection: Keep-Alive\r\n"
 					"Cache-Control: no-cache\r\n\r\n",
 					request->login_path,