# HG changeset patch # User Nathan Walp # Date 1070399919 0 # Node ID e0e73a26f1306ea35cee49a72183ab302412b0cf # Parent c65759bdd782ee70de71d557525037cafeb59e8a [gaim-migrate @ 8348] ladies and gentlemen, i give you PLAIN auth for SASL committer: Tailor Script diff -r c65759bdd782 -r e0e73a26f130 ChangeLog --- a/ChangeLog Tue Dec 02 17:27:30 2003 +0000 +++ b/ChangeLog Tue Dec 02 21:18:39 2003 +0000 @@ -3,6 +3,7 @@ version 0.75cvs : * Yahoo! file transfer (Tim Ringenbach) * Improved i18n support for MSN email notification (Felipe Contreras) + * Jabber SASL PLAIN support * Chinese (Simplified) translation updated (Funda Wang) * Chinese (Traditional) translation updated (Ambrose C. Li) * Italian translation updated (Claudio Satriano) diff -r c65759bdd782 -r e0e73a26f130 src/protocols/jabber/auth.c --- a/src/protocols/jabber/auth.c Tue Dec 02 17:27:30 2003 +0000 +++ b/src/protocols/jabber/auth.c Tue Dec 02 21:18:39 2003 +0000 @@ -75,25 +75,34 @@ auth = xmlnode_new("auth"); xmlnode_set_attrib(auth, "xmlns", "urn:ietf:params:xml:ns:xmpp-sasl"); + if(digest_md5) { xmlnode_set_attrib(auth, "mechanism", "DIGEST-MD5"); js->auth_type = JABBER_AUTH_DIGEST_MD5; - /* } else if(plain) { + GString *response = g_string_new(""); + char *enc_out; + + response = g_string_append_len(response, "\0", 1); + response = g_string_append(response, js->user->node); + response = g_string_append_len(response, "\0", 1); + response = g_string_append(response, + gaim_account_get_password(js->gc->account)); + + enc_out = gaim_base64_encode(response->str, response->len); + xmlnode_set_attrib(auth, "mechanism", "PLAIN"); - xmlnode_insert_data(auth, "\0", 1); - xmlnode_insert_data(auth, js->user->node, -1); - xmlnode_insert_data(auth, "\0", 1); - xmlnode_insert_data(auth, gaim_account_get_password(js->gc->account), - -1); + xmlnode_insert_data(auth, enc_out, -1); + g_free(enc_out); + js->auth_type = JABBER_AUTH_PLAIN; - */ } else { gaim_connection_error(js->gc, _("Server does not use any supported authentication method")); xmlnode_free(auth); return; } + jabber_send(js, auth); xmlnode_free(auth); } @@ -289,9 +298,7 @@ jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet) { - if(js->auth_type == JABBER_AUTH_PLAIN) { - /* XXX: implement me! */ - } else if(js->auth_type == JABBER_AUTH_DIGEST_MD5) { + if(js->auth_type == JABBER_AUTH_DIGEST_MD5) { char *enc_in = xmlnode_get_data(packet); char *dec_in; char *enc_out;