Mercurial > pidgin.yaz
diff libpurple/protocols/jabber/auth.c @ 31449:1c660ba17ba1
propagate from branch 'im.pidgin.pidgin' (head 6f879669a6513a5c40335bbaefe842389a92b39e)
to branch 'im.pidgin.cpw.qulogic.cairo' (head 4ab0199887f74442673fd46dcbb662bc7f070bc4)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Sun, 21 Nov 2010 20:30:12 +0000 |
parents | cea7e713ef07 |
children | a5b556ac1de5 |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/auth.c Sat Aug 21 06:04:13 2010 +0000 +++ b/libpurple/protocols/jabber/auth.c Sun Nov 21 20:30:12 2010 +0000 @@ -123,7 +123,7 @@ if (!PURPLE_CONNECTION_IS_VALID(gc)) return; - /* Disable the account as the user has canceled connecting */ + /* Disable the account as the user has cancelled connecting */ purple_account_set_enabled(purple_connection_get_account(gc), purple_core_get_ui(), FALSE); } #endif @@ -251,7 +251,8 @@ g_free(msg); } else if (type == JABBER_IQ_RESULT) { query = xmlnode_get_child(packet, "query"); - if(js->stream_id && xmlnode_get_child(query, "digest")) { + if (js->stream_id && *js->stream_id && + xmlnode_get_child(query, "digest")) { char *s, *hash; iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); @@ -269,8 +270,10 @@ g_free(s); jabber_iq_set_callback(iq, auth_old_result_cb, NULL); jabber_iq_send(iq); - - } else if(js->stream_id && (x = xmlnode_get_child(query, "crammd5"))) { + } else if ((x = xmlnode_get_child(query, "crammd5"))) { + /* For future reference, this appears to be a custom OS X extension + * to non-SASL authentication. + */ const char *challenge; gchar digest[33]; PurpleCipherContext *hmac; @@ -340,7 +343,8 @@ * is requiring SSL/TLS, we need to enforce it. */ if (!jabber_stream_is_ssl(js) && - purple_account_get_bool(account, "require_tls", JABBER_DEFAULT_REQUIRE_TLS)) { + g_str_equal("require_tls", + purple_account_get_string(account, "connection_security", JABBER_DEFAULT_REQUIRE_TLS))) { purple_connection_error_reason(js->gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, _("You require encryption, but it is not available on this server.")); @@ -498,20 +502,30 @@ return 0; } +void jabber_auth_add_mech(JabberSaslMech *mech) +{ + auth_mechs = g_slist_insert_sorted(auth_mechs, mech, compare_mech); +} + +void jabber_auth_remove_mech(JabberSaslMech *mech) +{ + auth_mechs = g_slist_remove(auth_mechs, mech); +} + void jabber_auth_init(void) { JabberSaslMech **tmp; gint count, i; - auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_plain_mech(), compare_mech); - auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_digest_md5_mech(), compare_mech); + jabber_auth_add_mech(jabber_auth_get_plain_mech()); + jabber_auth_add_mech(jabber_auth_get_digest_md5_mech()); #ifdef HAVE_CYRUS_SASL - auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_cyrus_mech(), compare_mech); + jabber_auth_add_mech(jabber_auth_get_cyrus_mech()); #endif tmp = jabber_auth_get_scram_mechs(&count); for (i = 0; i < count; ++i) - auth_mechs = g_slist_insert_sorted(auth_mechs, tmp[i], compare_mech); + jabber_auth_add_mech(tmp[i]); } void jabber_auth_uninit(void)