comparison src/protocols/jabber/auth.c @ 7642:9008b5be4275

[gaim-migrate @ 8285] let the xmlnode stuff handle embedded NULLs (i'll need this later) committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 26 Nov 2003 17:28:13 +0000
parents 2df4d470c12a
children 4168b8881746
comparison
equal deleted inserted replaced
7641:a80010831ff8 7642:9008b5be4275
44 44
45 if((starttls = xmlnode_get_child(packet, "starttls"))) { 45 if((starttls = xmlnode_get_child(packet, "starttls"))) {
46 if(gaim_account_get_bool(js->gc->account, "use_tls", TRUE) && 46 if(gaim_account_get_bool(js->gc->account, "use_tls", TRUE) &&
47 gaim_ssl_is_supported()) { 47 gaim_ssl_is_supported()) {
48 jabber_send_raw(js, 48 jabber_send_raw(js,
49 "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"); 49 "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>", -1);
50 return; 50 return;
51 } else if(xmlnode_get_child(starttls, "required")) { 51 } else if(xmlnode_get_child(starttls, "required")) {
52 gaim_connection_error(js->gc, _("Server requires SSL for login")); 52 gaim_connection_error(js->gc, _("Server requires SSL for login"));
53 return; 53 return;
54 } 54 }
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 if(digest_md5) { 78 if(digest_md5) {
79 xmlnode_set_attrib(auth, "mechanism", "DIGEST-MD5"); 79 xmlnode_set_attrib(auth, "mechanism", "DIGEST-MD5");
80 js->auth_type = JABBER_AUTH_DIGEST_MD5; 80 js->auth_type = JABBER_AUTH_DIGEST_MD5;
81 /* 81 /*
82 } else if(plain) { 82 } else if(plain) {
83 xmlnode_set_attrib(auth, "mechanism", "PLAIN");
83 js->auth_type = JABBER_AUTH_PLAIN; 84 js->auth_type = JABBER_AUTH_PLAIN;
84 */ 85 */
85 } else { 86 } else {
86 gaim_connection_error(js->gc, 87 gaim_connection_error(js->gc,
87 _("Server does not use any supported authentication method")); 88 _("Server does not use any supported authentication method"));
295 296
296 297
297 if(rspauth && js->expected_rspauth && 298 if(rspauth && js->expected_rspauth &&
298 !strcmp(rspauth, js->expected_rspauth)) { 299 !strcmp(rspauth, js->expected_rspauth)) {
299 jabber_send_raw(js, 300 jabber_send_raw(js,
300 "<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl' />"); 301 "<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl' />",
302 -1);
301 } else { 303 } else {
302 gaim_connection_error(js->gc, _("Invalid challenge from server")); 304 gaim_connection_error(js->gc, _("Invalid challenge from server"));
303 } 305 }
304 g_free(js->expected_rspauth); 306 g_free(js->expected_rspauth);
305 } else { 307 } else {
356 358
357 gaim_debug(GAIM_DEBUG_MISC, "jabber", "decoded response (%d): %s\n", response->len, response->str); 359 gaim_debug(GAIM_DEBUG_MISC, "jabber", "decoded response (%d): %s\n", response->len, response->str);
358 360
359 buf = g_strdup_printf("<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>%s</response>", enc_out); 361 buf = g_strdup_printf("<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>%s</response>", enc_out);
360 362
361 jabber_send_raw(js, buf); 363 jabber_send_raw(js, buf, -1);
362 364
363 g_free(buf); 365 g_free(buf);
364 366
365 g_free(enc_out); 367 g_free(enc_out);
366 368