comparison libgaim/protocols/jabber/auth.c @ 15108:24b19f0d25de

[gaim-migrate @ 17894] hopefully fix the jabber crash people are seeing, and plug a small memory leak committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Mon, 04 Dec 2006 12:52:18 +0000
parents bc440018e208
children ffec45ff82d0
comparison
equal deleted inserted replaced
15107:917a50335af3 15108:24b19f0d25de
714 714
715 dec_in = gaim_base64_decode(enc_in, &declen); 715 dec_in = gaim_base64_decode(enc_in, &declen);
716 716
717 js->sasl_state = sasl_client_step(js->sasl, (char*)dec_in, declen, 717 js->sasl_state = sasl_client_step(js->sasl, (char*)dec_in, declen,
718 NULL, &c_out, &clen); 718 NULL, &c_out, &clen);
719 g_free(enc_in);
719 g_free(dec_in); 720 g_free(dec_in);
720 if (js->sasl_state != SASL_CONTINUE && js->sasl_state != SASL_OK) { 721 if (js->sasl_state != SASL_CONTINUE && js->sasl_state != SASL_OK) {
721 gaim_debug_error("jabber", "Error is %d : %s\n",js->sasl_state,sasl_errdetail(js->sasl)); 722 gaim_debug_error("jabber", "Error is %d : %s\n",js->sasl_state,sasl_errdetail(js->sasl));
722 gaim_connection_error(js->gc, _("SASL error")); 723 gaim_connection_error(js->gc, _("SASL error"));
723 return; 724 return;
751 #ifdef HAVE_CYRUS_SASL 752 #ifdef HAVE_CYRUS_SASL
752 /* The SASL docs say that if the client hasn't returned OK yet, we 753 /* The SASL docs say that if the client hasn't returned OK yet, we
753 * should try one more round against it 754 * should try one more round against it
754 */ 755 */
755 if (js->sasl_state != SASL_OK) { 756 if (js->sasl_state != SASL_OK) {
757 char *enc_in = xmlnode_get_data(packet);
758 unsigned char *dec_in = NULL;
756 const char *c_out; 759 const char *c_out;
757 unsigned int clen; 760 unsigned int clen;
758 js->sasl_state = sasl_client_step(js->sasl, NULL, 0, NULL, &c_out, &clen); 761 gsize declen = 0;
762
763 if(enc_in != NULL)
764 dec_in = gaim_base64_decode(enc_in, &declen);
765
766 js->sasl_state = sasl_client_step(js->sasl, (char*)dec_in, declen, NULL, &c_out, &clen);
767
768 g_free(enc_in);
769 g_free(dec_in);
770
759 if (js->sasl_state != SASL_OK) { 771 if (js->sasl_state != SASL_OK) {
760 /* This should never happen! */ 772 /* This should never happen! */
761 gaim_connection_error(js->gc, _("Invalid response from server.")); 773 gaim_connection_error(js->gc, _("Invalid response from server."));
762 } 774 }
763 } 775 }