libpurple/protocols/jabber/auth.c

changeset 27379
eb193d927190
parent 27261
4abec3f2e24f
child 27632
0da289638ff4
equal deleted inserted replaced
27374:75171196ad08 27379:eb193d927190
988 } else { 988 } else {
989 response = xmlnode_new("response"); 989 response = xmlnode_new("response");
990 xmlnode_set_namespace(response, "urn:ietf:params:xml:ns:xmpp-sasl"); 990 xmlnode_set_namespace(response, "urn:ietf:params:xml:ns:xmpp-sasl");
991 if (clen > 0) { 991 if (clen > 0) {
992 /* Cyrus SASL 2.1.22 appears to contain code to add the charset 992 /* Cyrus SASL 2.1.22 appears to contain code to add the charset
993 * to the response but there is no possibility it will be executed. 993 * to the response for DIGEST-MD5 but there is no possibility
994 * it will be executed.
995 *
994 * My reading of the digestmd5 plugin indicates the username and 996 * My reading of the digestmd5 plugin indicates the username and
995 * realm are always encoded in UTF-8 (they seem to be the values 997 * realm are always encoded in UTF-8 (they seem to be the values
996 * we pass in), so we need to ensure charset=utf-8 is set. 998 * we pass in), so we need to ensure charset=utf-8 is set.
997 */ 999 */
998 if (strstr(c_out, ",charset=")) 1000 if (!js->current_mech || !g_str_equal(js->current_mech, "DIGEST-MD5") ||
1001 strstr(c_out, ",charset="))
1002 /* If we're not using DIGEST-MD5 or Cyrus SASL is fixed */
999 enc_out = purple_base64_encode((unsigned char*)c_out, clen); 1003 enc_out = purple_base64_encode((unsigned char*)c_out, clen);
1000 else { 1004 else {
1001 char *tmp = g_strdup_printf("%s,charset=utf-8", c_out); 1005 char *tmp = g_strdup_printf("%s,charset=utf-8", c_out);
1002 enc_out = purple_base64_encode((unsigned char*)tmp, clen + 14); 1006 enc_out = purple_base64_encode((unsigned char*)tmp, clen + 14);
1003 g_free(tmp); 1007 g_free(tmp);

mercurial