summaryrefslogtreecommitdiff
path: root/libpurple/protocols/jabber/auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'libpurple/protocols/jabber/auth.c')
-rw-r--r--libpurple/protocols/jabber/auth.c50
1 files changed, 15 insertions, 35 deletions
diff --git a/libpurple/protocols/jabber/auth.c b/libpurple/protocols/jabber/auth.c
index 1dae3aed98..4ecbe55608 100644
--- a/libpurple/protocols/jabber/auth.c
+++ b/libpurple/protocols/jabber/auth.c
@@ -45,35 +45,6 @@ static void auth_old_result_cb(JabberStream *js, const char *from,
JabberIqType type, const char *id,
xmlnode *packet, gpointer data);
-gboolean
-jabber_process_starttls(JabberStream *js, xmlnode *packet)
-{
- PurpleAccount *account;
- xmlnode *starttls;
-
- account = purple_connection_get_account(js->gc);
-
- if((starttls = xmlnode_get_child(packet, "starttls"))) {
- if(purple_ssl_is_supported()) {
- jabber_send_raw(js,
- "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>", -1);
- return TRUE;
- } else if(xmlnode_get_child(starttls, "required")) {
- purple_connection_error_reason(js->gc,
- PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
- _("Server requires TLS/SSL, but no TLS/SSL support was found."));
- return TRUE;
- } else if(purple_account_get_bool(account, "require_tls", JABBER_DEFAULT_REQUIRE_TLS)) {
- purple_connection_error_reason(js->gc,
- PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
- _("You require encryption, but no TLS/SSL support was found."));
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
static void finish_plaintext_authentication(JabberStream *js)
{
JabberIq *iq;
@@ -152,7 +123,7 @@ auth_no_pass_cb(PurpleConnection *gc, PurpleRequestFields *fields)
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
@@ -187,7 +158,7 @@ jabber_auth_start(JabberStream *js, xmlnode *packet)
if (mech_name && *mech_name)
mechanisms = g_slist_prepend(mechanisms, mech_name);
- else if (mech_name)
+ else
g_free(mech_name);
}
@@ -208,6 +179,11 @@ jabber_auth_start(JabberStream *js, xmlnode *packet)
}
}
+ while (mechanisms) {
+ g_free(mechanisms->data);
+ mechanisms = g_slist_delete_link(mechanisms, mechanisms);
+ }
+
if (js->auth_mech == NULL) {
/* Found no good mechanisms... */
purple_connection_error_reason(js->gc,
@@ -275,7 +251,8 @@ static void auth_old_cb(JabberStream *js, const char *from,
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");
@@ -293,8 +270,10 @@ static void auth_old_cb(JabberStream *js, const char *from,
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;
@@ -364,7 +343,8 @@ void jabber_auth_start_old(JabberStream *js)
* 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."));