| 394 enc_out = purple_base64_encode((unsigned char*)clientout, coutlen); |
394 enc_out = purple_base64_encode((unsigned char*)clientout, coutlen); |
| 395 xmlnode_insert_data(auth, enc_out, -1); |
395 xmlnode_insert_data(auth, enc_out, -1); |
| 396 g_free(enc_out); |
396 g_free(enc_out); |
| 397 } |
397 } |
| 398 } |
398 } |
| 399 |
|
| 400 if (mech && (strcmp(mech, "DIGEST-MD5") == 0)) { |
|
| 401 /* CYRUS-SASL's DIGEST-MD5 and Java's DIGEST-MD5 are mutually incompatible because of different interpretations of RFC2831. |
|
| 402 * This means that if we are using SASL and connecting to a Java-based server such as OpenFire, we will receive an authentication |
|
| 403 * failure if that server offers DIGEST-MD5 in such a way that SASL chooses it as the best mechanism for us. |
|
| 404 * |
|
| 405 * However, we implement our own DIGEST-MD5 for use when we're compiled without SASL support, and that implementation |
|
| 406 * works correctly. Therefore, if SASL chooses DIGEST-MD5, we switch over to our own implementation. |
|
| 407 * jabber_auth_handle_challenge() will note the auth_type and take it from there. |
|
| 408 * |
|
| 409 * SASL would change state to SASL_OK after when handling the challenge; we do so immediately to avoid an error later. |
|
| 410 */ |
|
| 411 js->auth_type = JABBER_AUTH_DIGEST_MD5; |
|
| 412 js->sasl_state = SASL_OK; |
|
| 413 sasl_dispose(&js->sasl); |
|
| 414 js->sasl = NULL; |
|
| 415 } |
|
| 416 |
|
| 417 jabber_send(js, auth); |
399 jabber_send(js, auth); |
| 418 xmlnode_free(auth); |
400 xmlnode_free(auth); |
| 419 } else { |
401 } else { |
| 420 purple_connection_error_reason (js->gc, |
402 purple_connection_error_reason (js->gc, |
| 421 PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, |
403 PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, |