Mercurial > pidgin
comparison src/protocols/jabber/auth.c @ 12549:1e0caf8f40dc
[gaim-migrate @ 14867]
maybe fix 1384317
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sun, 18 Dec 2005 18:21:27 +0000 |
parents | 09cae5fdd5b6 |
children | 0c4db52c6a3d |
comparison
equal
deleted
inserted
replaced
12548:6503701eb44f | 12549:1e0caf8f40dc |
---|---|
539 GaimCipher *cipher; | 539 GaimCipher *cipher; |
540 GaimCipherContext *context; | 540 GaimCipherContext *context; |
541 guchar result[16]; | 541 guchar result[16]; |
542 size_t a1len; | 542 size_t a1len; |
543 | 543 |
544 gchar *a1, *convnode, *convpasswd, *ha1, *ha2, *kd, *x, *z; | 544 gchar *a1, *convnode=NULL, *convpasswd = NULL, *ha1, *ha2, *kd, *x, *z; |
545 | 545 |
546 if((convnode = g_convert(jid->node, strlen(jid->node), "iso-8859-1", "utf-8", | 546 if((convnode = g_convert(jid->node, strlen(jid->node), "iso-8859-1", "utf-8", |
547 NULL, NULL, NULL)) == NULL) { | 547 NULL, NULL, NULL)) == NULL) { |
548 convnode = g_strdup(jid->node); | 548 convnode = g_strdup(jid->node); |
549 } | 549 } |
550 if((convpasswd = g_convert(passwd, strlen(passwd), "iso-8859-1", "utf-8", | 550 if(passwd && ((convpasswd = g_convert(passwd, strlen(passwd), "iso-8859-1", |
551 NULL, NULL, NULL)) == NULL) { | 551 "utf-8", NULL, NULL, NULL)) == NULL)) { |
552 convpasswd = g_strdup(passwd); | 552 convpasswd = g_strdup(passwd); |
553 } | 553 } |
554 | 554 |
555 cipher = gaim_ciphers_find_cipher("md5"); | 555 cipher = gaim_ciphers_find_cipher("md5"); |
556 context = gaim_cipher_context_new(cipher, NULL); | 556 context = gaim_cipher_context_new(cipher, NULL); |
557 | 557 |
558 x = g_strdup_printf("%s:%s:%s", convnode, realm, convpasswd); | 558 x = g_strdup_printf("%s:%s:%s", convnode, realm, convpasswd ? convpasswd : ""); |
559 gaim_cipher_context_append(context, (const guchar *)x, strlen(x)); | 559 gaim_cipher_context_append(context, (const guchar *)x, strlen(x)); |
560 gaim_cipher_context_digest(context, sizeof(result), result, NULL); | 560 gaim_cipher_context_digest(context, sizeof(result), result, NULL); |
561 | 561 |
562 a1 = g_strdup_printf("xxxxxxxxxxxxxxxx:%s:%s", nonce, cnonce); | 562 a1 = g_strdup_printf("xxxxxxxxxxxxxxxx:%s:%s", nonce, cnonce); |
563 a1len = strlen(a1); | 563 a1len = strlen(a1); |