comparison src/protocols/jabber/auth.c @ 7703:e0e73a26f130

[gaim-migrate @ 8348] ladies and gentlemen, i give you PLAIN auth for SASL committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Tue, 02 Dec 2003 21:18:39 +0000
parents 28100686bde9
children 3d79f9cab273
comparison
equal deleted inserted replaced
7702:c65759bdd782 7703:e0e73a26f130
73 } 73 }
74 } 74 }
75 75
76 auth = xmlnode_new("auth"); 76 auth = xmlnode_new("auth");
77 xmlnode_set_attrib(auth, "xmlns", "urn:ietf:params:xml:ns:xmpp-sasl"); 77 xmlnode_set_attrib(auth, "xmlns", "urn:ietf:params:xml:ns:xmpp-sasl");
78
78 if(digest_md5) { 79 if(digest_md5) {
79 xmlnode_set_attrib(auth, "mechanism", "DIGEST-MD5"); 80 xmlnode_set_attrib(auth, "mechanism", "DIGEST-MD5");
80 js->auth_type = JABBER_AUTH_DIGEST_MD5; 81 js->auth_type = JABBER_AUTH_DIGEST_MD5;
81 /*
82 } else if(plain) { 82 } else if(plain) {
83 GString *response = g_string_new("");
84 char *enc_out;
85
86 response = g_string_append_len(response, "\0", 1);
87 response = g_string_append(response, js->user->node);
88 response = g_string_append_len(response, "\0", 1);
89 response = g_string_append(response,
90 gaim_account_get_password(js->gc->account));
91
92 enc_out = gaim_base64_encode(response->str, response->len);
93
83 xmlnode_set_attrib(auth, "mechanism", "PLAIN"); 94 xmlnode_set_attrib(auth, "mechanism", "PLAIN");
84 xmlnode_insert_data(auth, "\0", 1); 95 xmlnode_insert_data(auth, enc_out, -1);
85 xmlnode_insert_data(auth, js->user->node, -1); 96 g_free(enc_out);
86 xmlnode_insert_data(auth, "\0", 1); 97
87 xmlnode_insert_data(auth, gaim_account_get_password(js->gc->account),
88 -1);
89 js->auth_type = JABBER_AUTH_PLAIN; 98 js->auth_type = JABBER_AUTH_PLAIN;
90 */
91 } else { 99 } else {
92 gaim_connection_error(js->gc, 100 gaim_connection_error(js->gc,
93 _("Server does not use any supported authentication method")); 101 _("Server does not use any supported authentication method"));
94 xmlnode_free(auth); 102 xmlnode_free(auth);
95 return; 103 return;
96 } 104 }
105
97 jabber_send(js, auth); 106 jabber_send(js, auth);
98 xmlnode_free(auth); 107 xmlnode_free(auth);
99 } 108 }
100 109
101 static void auth_old_result_cb(JabberStream *js, xmlnode *packet, gpointer data) 110 static void auth_old_result_cb(JabberStream *js, xmlnode *packet, gpointer data)
287 296
288 void 297 void
289 jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet) 298 jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet)
290 { 299 {
291 300
292 if(js->auth_type == JABBER_AUTH_PLAIN) { 301 if(js->auth_type == JABBER_AUTH_DIGEST_MD5) {
293 /* XXX: implement me! */
294 } else if(js->auth_type == JABBER_AUTH_DIGEST_MD5) {
295 char *enc_in = xmlnode_get_data(packet); 302 char *enc_in = xmlnode_get_data(packet);
296 char *dec_in; 303 char *dec_in;
297 char *enc_out; 304 char *enc_out;
298 GHashTable *parts; 305 GHashTable *parts;
299 306