src/protocols/jabber/auth.c

changeset 7981
332cd6342bab
parent 7813
b25628709267
child 8016
d75a4e86f7c3
equal deleted inserted replaced
7980:ad4544239a3e 7981:332cd6342bab
55 } 55 }
56 56
57 mechs = xmlnode_get_child(packet, "mechanisms"); 57 mechs = xmlnode_get_child(packet, "mechanisms");
58 58
59 if(!mechs) { 59 if(!mechs) {
60 gaim_connection_error(js->gc, _("Invalid response from server")); 60 gaim_connection_error(js->gc, _("Invalid response from server."));
61 return; 61 return;
62 } 62 }
63 63
64 for(mechnode = mechs->child; mechnode; mechnode = mechnode->next) 64 for(mechnode = mechs->child; mechnode; mechnode = mechnode->next)
65 { 65 {
148 gboolean digest = FALSE; 148 gboolean digest = FALSE;
149 const char *type = xmlnode_get_attrib(packet, "type"); 149 const char *type = xmlnode_get_attrib(packet, "type");
150 const char *pw = gaim_account_get_password(js->gc->account); 150 const char *pw = gaim_account_get_password(js->gc->account);
151 151
152 if(!type) { 152 if(!type) {
153 gaim_connection_error(js->gc, _("Invalid response from server")); 153 gaim_connection_error(js->gc, _("Invalid response from server."));
154 return; 154 return;
155 } else if(!strcmp(type, "error")) { 155 } else if(!strcmp(type, "error")) {
156 /* XXX: still need to handle XMPP-style errors */ 156 /* XXX: still need to handle XMPP-style errors */
157 xmlnode *error; 157 xmlnode *error;
158 char *buf, *err_txt = NULL; 158 char *buf, *err_txt = NULL;
307 char *dec_in; 307 char *dec_in;
308 char *enc_out; 308 char *enc_out;
309 GHashTable *parts; 309 GHashTable *parts;
310 310
311 if(!enc_in) { 311 if(!enc_in) {
312 gaim_connection_error(js->gc, _("Invalid response from server")); 312 gaim_connection_error(js->gc, _("Invalid response from server."));
313 return; 313 return;
314 } 314 }
315 315
316 gaim_base64_decode(enc_in, &dec_in, NULL); 316 gaim_base64_decode(enc_in, &dec_in, NULL);
317 gaim_debug(GAIM_DEBUG_MISC, "jabber", "decoded challenge (%d): %s\n", 317 gaim_debug(GAIM_DEBUG_MISC, "jabber", "decoded challenge (%d): %s\n",
407 void jabber_auth_handle_success(JabberStream *js, xmlnode *packet) 407 void jabber_auth_handle_success(JabberStream *js, xmlnode *packet)
408 { 408 {
409 const char *ns = xmlnode_get_attrib(packet, "xmlns"); 409 const char *ns = xmlnode_get_attrib(packet, "xmlns");
410 410
411 if(!ns || strcmp(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) { 411 if(!ns || strcmp(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) {
412 gaim_connection_error(js->gc, _("Invalid response from server")); 412 gaim_connection_error(js->gc, _("Invalid response from server."));
413 return; 413 return;
414 } 414 }
415 415
416 jabber_stream_set_state(js, JABBER_STREAM_REINITIALIZING); 416 jabber_stream_set_state(js, JABBER_STREAM_REINITIALIZING);
417 } 417 }
419 void jabber_auth_handle_failure(JabberStream *js, xmlnode *packet) 419 void jabber_auth_handle_failure(JabberStream *js, xmlnode *packet)
420 { 420 {
421 const char *ns = xmlnode_get_attrib(packet, "xmlns"); 421 const char *ns = xmlnode_get_attrib(packet, "xmlns");
422 422
423 if(!ns) 423 if(!ns)
424 gaim_connection_error(js->gc, _("Invalid response from server")); 424 gaim_connection_error(js->gc, _("Invalid response from server."));
425 else if(!strcmp(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) { 425 else if(!strcmp(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) {
426 if(xmlnode_get_child(packet, "bad-protocol")) { 426 if(xmlnode_get_child(packet, "bad-protocol")) {
427 gaim_connection_error(js->gc, _("Bad Protocol")); 427 gaim_connection_error(js->gc, _("Bad Protocol"));
428 } else if(xmlnode_get_child(packet, "encryption-required")) { 428 } else if(xmlnode_get_child(packet, "encryption-required")) {
429 js->gc->wants_to_die = TRUE; 429 js->gc->wants_to_die = TRUE;

mercurial