Mercurial > pidgin.yaz
changeset 2814:f4f9e5a01890
[gaim-migrate @ 2827]
jabber can do digest authentication now. isn't that spectacular.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 29 Nov 2001 10:42:12 +0000 |
parents | bda5b89ba2f9 |
children | d121344193d6 |
files | ChangeLog src/protocols/jabber/jabber.c |
diffstat | 2 files changed, 55 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Nov 29 08:39:55 2001 +0000 +++ b/ChangeLog Thu Nov 29 10:42:12 2001 +0000 @@ -7,6 +7,8 @@ * Updated Korean translation (thanks Ho-seok Lee, also for resized ICQ icons) * Updated Dutch translation (thanks Floris Eshuis) + * Yahoo updates (thanks Brian Macke) + * Jabber updates * Zephyr updates (thanks Arun A Tharuvai) * Gadu-Gadu updates (thanks Arkadiusz Miskiewicz) * Option to show aliases in conversation tabs
--- a/src/protocols/jabber/jabber.c Thu Nov 29 08:39:55 2001 +0000 +++ b/src/protocols/jabber/jabber.c Thu Nov 29 10:42:12 2001 +0000 @@ -284,6 +284,29 @@ xmlnode_free(x); } +static void gjab_reqauth(gjconn j) +{ + xmlnode x, y, z; + char *user; + + if (!j) + return; + + x = jutil_iqnew(JPACKET__GET, NS_AUTH); + xmlnode_put_attrib(x, "id", IQID_AUTH); + y = xmlnode_get_tag(x, "query"); + + user = j->user->user; + + if (user) { + z = xmlnode_insert_tag(y, "username"); + xmlnode_insert_cdata(z, user, -1); + } + + gjab_send(j, x); + xmlnode_free(x); +} + static void gjab_auth(gjconn j) { xmlnode x, y, z; @@ -307,6 +330,7 @@ xmlnode_insert_cdata(z, j->user->resource, -1); if (j->sid) { + debug_printf("digest authentication (sid %s)\n", j->sid); z = xmlnode_insert_tag(y, "digest"); hash = pmalloc(x->p, strlen(j->sid) + strlen(j->pass) + 1); strcpy(hash, j->sid); @@ -361,7 +385,7 @@ if (strcmp(name, "stream:stream") == 0) { /* special case: name == stream:stream */ /* id attrib of stream is stored for digest auth */ - j->sid = xmlnode_get_attrib(x, "id"); + j->sid = g_strdup(xmlnode_get_attrib(x, "id")); /* STATE_EVT(JCONN_STATE_AUTH) */ xmlnode_free(x); } else { @@ -929,7 +953,8 @@ xmlnode_free(x); } -static void jabber_handlevcard(gjconn j, xmlnode querynode, char *from) { +static void jabber_handlevcard(gjconn j, xmlnode querynode, char *from) +{ struct gaim_connection *gc = GJ_GC(j); char buf[1024]; char *fn, *url, *email, *nickname, *status, *desc; @@ -972,17 +997,27 @@ static void jabber_handleauthresp(gjconn j, jpacket p) { if (jpacket_subtype(p) == JPACKET__RESULT) { - debug_printf("auth success\n"); - - account_online(GJ_GC(j)); - serv_finish_login(GJ_GC(j)); + if (xmlnode_has_children(p->x)) { + xmlnode query = xmlnode_get_tag(p->x, "query"); + set_login_progress(GJ_GC(j), 4, "Authenticating"); + if (!xmlnode_get_tag(query, "digest")) { + g_free(j->sid); + j->sid = NULL; + } + gjab_auth(j); + } else { + debug_printf("auth success\n"); - if (bud_list_cache_exists(GJ_GC(j))) - do_import(GJ_GC(j), NULL); + account_online(GJ_GC(j)); + serv_finish_login(GJ_GC(j)); - ((struct jabber_data *)GJ_GC(j)->proto_data)->did_import = TRUE; + if (bud_list_cache_exists(GJ_GC(j))) + do_import(GJ_GC(j), NULL); - gjab_reqroster(j); + ((struct jabber_data *)GJ_GC(j)->proto_data)->did_import = TRUE; + + gjab_reqroster(j); + } } else { xmlnode xerr; char *errmsg = NULL; @@ -1088,6 +1123,7 @@ static void jabber_handlepacket(gjconn j, jpacket p) { + char *id; switch (p->type) { case JPACKET_MESSAGE: jabber_handlemessage(j, p); @@ -1098,16 +1134,16 @@ case JPACKET_IQ: debug_printf("jpacket_subtype: %d\n", jpacket_subtype(p)); - if (xmlnode_get_attrib(p->x, "id") && (strcmp(xmlnode_get_attrib(p->x, "id"), IQID_AUTH) == 0)) { + if (((id = xmlnode_get_attrib(p->x, "id")) != NULL) && !strcmp(id, IQID_AUTH)) { jabber_handleauthresp(j, p); - break; /* I'm not sure if you like this style, Eric. */ + break; } if (jpacket_subtype(p) == JPACKET__SET) { } else if (jpacket_subtype(p) == JPACKET__GET) { xmlnode querynode; querynode = xmlnode_get_tag(p->x, "query"); - if(NSCHECK(querynode, NS_VERSION)) { + if (NSCHECK(querynode, NS_VERSION)) { jabber_handleversion(j, p->x); } else if (NSCHECK(querynode, NS_TIME)) { jabber_handletime(j, p->x); @@ -1176,11 +1212,11 @@ signoff(GJ_GC(j)); break; case JCONN_STATE_CONNECTED: - set_login_progress(GJ_GC(j), 3, "Connected"); + set_login_progress(GJ_GC(j), 2, "Connected"); break; case JCONN_STATE_ON: - set_login_progress(GJ_GC(j), 5, "Logging in..."); - gjab_auth(j); + set_login_progress(GJ_GC(j), 3, "Requesting Authentication Method"); + gjab_reqauth(j); break; default: debug_printf("state change: %d\n", state); @@ -1234,6 +1270,7 @@ close(jd->jc->fd); g_timeout_add(50, jabber_free, jd->jc); xmlnode_free(jd->jc->current); + g_free(jd->jc->sid); jd->jc = NULL; g_free(jd); gc->proto_data = NULL;