changeset 30549:c4cac45b0a74

merge of '8955da011b0481f0598f9cb0ee24fc2184396c69' and '94fa017925fa206fc36f520ee42c54f57429b4e1'
author Paul Aurich <paul@darkrain42.org>
date Sat, 29 May 2010 00:16:30 +0000
parents bf088afdc813 (current diff) bc9f74e9f596 (diff)
children b2d69f34b7df
files
diffstat 3 files changed, 28 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.c	Sat May 29 00:08:23 2010 +0000
+++ b/libpurple/protocols/msn/directconn.c	Sat May 29 00:16:30 2010 +0000
@@ -50,7 +50,6 @@
 msn_dc_calculate_nonce_hash(MsnDirectConnNonceType type,
                             const guchar nonce[16], gchar nonce_hash[37])
 {
-	guint32 *tmp;
 	guchar digest[20];
 
 	if (type == DC_NONCE_SHA1) {
@@ -63,18 +62,29 @@
 		memcpy(digest, nonce, 16);
 	}
 
-	/* TODO: Somebody please tell me why this first one causes a warning,
-	         but the others don't! */
-	tmp = (guint32 *)&digest[0];
+	g_sprintf(nonce_hash,
+	          "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
+
+	          digest[3],
+	          digest[2],
+	          digest[1],
+	          digest[0],
+
+	          digest[5],
+	          digest[4],
 
-	g_sprintf(nonce_hash,
-	          "%08X-%04X-%04X-%04X-%08X%04X",
-	          GUINT32_FROM_LE(*tmp),
-	          GUINT16_FROM_LE(*((guint16 *)(digest + 4))),
-	          GUINT16_FROM_LE(*((guint16 *)(digest + 6))),
-	          GUINT16_FROM_BE(*((guint16 *)(digest + 8))),
-	          GUINT32_FROM_BE(*((guint32 *)(digest + 10))),
-	          GUINT16_FROM_BE(*((guint16 *)(digest + 14)))
+	          digest[7],
+	          digest[6],
+
+	          digest[8],
+	          digest[9],
+
+	          digest[10],
+	          digest[11],
+	          digest[12],
+	          digest[13],
+	          digest[14],
+	          digest[15]
 	);
 }
 
--- a/libpurple/protocols/msn/slp.c	Sat May 29 00:08:23 2010 +0000
+++ b/libpurple/protocols/msn/slp.c	Sat May 29 00:16:30 2010 +0000
@@ -288,11 +288,11 @@
 	if (nonce) {
 		*ntype = DC_NONCE_SHA1;
 	} else {
-		guint32 n1, n5;
-		guint16 n2, n3, n4, n6;
+		guint32 n1, n6;
+		guint16 n2, n3, n4, n5;
 		nonce = get_token(content, "Nonce: {", "}\r\n");
 		if (nonce
-		 && sscanf(nonce, "%08x-%04hx-%04hx-%04hx-%08x%04hx",
+		 && sscanf(nonce, "%08x-%04hx-%04hx-%04hx-%04hx%08x",
 		           &n1, &n2, &n3, &n4, &n5, &n6) == 6) {
 			*ntype = DC_NONCE_PLAIN;
 			g_free(nonce);
@@ -301,8 +301,8 @@
 			*(guint16 *)(nonce +  4) = GUINT16_TO_LE(n2);
 			*(guint16 *)(nonce +  6) = GUINT16_TO_LE(n3);
 			*(guint16 *)(nonce +  8) = GUINT16_TO_BE(n4);
-			*(guint32 *)(nonce + 10) = GUINT32_TO_BE(n5);
-			*(guint16 *)(nonce + 14) = GUINT16_TO_BE(n6);
+			*(guint16 *)(nonce + 10) = GUINT16_TO_BE(n5);
+			*(guint32 *)(nonce + 12) = GUINT32_TO_BE(n6);
 		} else {
 			/* Invalid nonce, so ignore request */
 			g_free(nonce);
--- a/libpurple/protocols/msn/slplink.c	Sat May 29 00:08:23 2010 +0000
+++ b/libpurple/protocols/msn/slplink.c	Sat May 29 00:16:30 2010 +0000
@@ -215,6 +215,7 @@
 
 	/* The slplink has no slpcalls in it, release it from the DC. */
 	if (slplink->slp_calls == NULL && slplink->dc != NULL) {
+		slplink->dc->slplink = NULL;
 		msn_dc_destroy(slplink->dc);
 		slplink->dc = NULL;
 	}