src/protocols/jabber/auth.c

changeset 12549
0fc163c4927a
parent 12543
8b13b94e4178
child 13207
46462c13cb1b
--- a/src/protocols/jabber/auth.c	Sun Dec 18 17:38:05 2005 +0000
+++ b/src/protocols/jabber/auth.c	Sun Dec 18 18:21:27 2005 +0000
@@ -541,21 +541,21 @@
 	guchar result[16];
 	size_t a1len;
 
-	gchar *a1, *convnode, *convpasswd, *ha1, *ha2, *kd, *x, *z;
+	gchar *a1, *convnode=NULL, *convpasswd = NULL, *ha1, *ha2, *kd, *x, *z;
 
 	if((convnode = g_convert(jid->node, strlen(jid->node), "iso-8859-1", "utf-8",
 					NULL, NULL, NULL)) == NULL) {
 		convnode = g_strdup(jid->node);
 	}
-	if((convpasswd = g_convert(passwd, strlen(passwd), "iso-8859-1", "utf-8",
-					NULL, NULL, NULL)) == NULL) {
+	if(passwd && ((convpasswd = g_convert(passwd, strlen(passwd), "iso-8859-1",
+						"utf-8", NULL, NULL, NULL)) == NULL)) {
 		convpasswd = g_strdup(passwd);
 	}
 
 	cipher = gaim_ciphers_find_cipher("md5");
 	context = gaim_cipher_context_new(cipher, NULL);
 
-	x = g_strdup_printf("%s:%s:%s", convnode, realm, convpasswd);
+	x = g_strdup_printf("%s:%s:%s", convnode, realm, convpasswd ? convpasswd : "");
 	gaim_cipher_context_append(context, (const guchar *)x, strlen(x));
 	gaim_cipher_context_digest(context, sizeof(result), result, NULL);
 

mercurial