Mercurial > pidgin.yaz
changeset 21592:68b036c452f3
The Jabber registration process depends upon having a non-NULL cbdata->who,
which was set only from the 'from' attribute of the registration packet.
I can't find anything in XEP-0077 which discusses whether the 'from' attribute
is required, but I've run into at least one server (bgmn.net, which according to
gmn.ne/jabber is using OpenFire 3.2.4) which doesn't include it. This leads to
registration attempts crashing.
If we can't get a 'from' attribute, try to use the fully qualified domain name
instead. If that's NULL for some reason, fail the registration attempt rather
than continuing on and crashing.
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Mon, 19 Nov 2007 08:05:36 +0000 |
parents | 28824f9f8e47 |
children | b1f36f7652c2 |
files | libpurple/protocols/jabber/jabber.c |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c Mon Nov 19 06:15:29 2007 +0000 +++ b/libpurple/protocols/jabber/jabber.c Mon Nov 19 08:05:36 2007 +0000 @@ -749,7 +749,7 @@ iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); query = xmlnode_get_child(iq->node, "query"); - xmlnode_set_attrib(iq->node,"to",cbdata->who); + xmlnode_set_attrib(iq->node, "to", cbdata->who); for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { @@ -824,7 +824,7 @@ username = g_strdup_printf("%s@%s/%s", cbdata->js->user->node, cbdata->js->user->domain, cbdata->js->user->resource); purple_account_set_username(cbdata->js->gc->account, username); - g_free(username); + g_free(username); } jabber_iq_set_callback(iq, jabber_registration_result_cb, cbdata->who); @@ -866,7 +866,7 @@ { PurpleAccount *account = purple_connection_get_account(js->gc); const char *type; - const char *from = xmlnode_get_attrib(packet, "from"); + const char *from; PurpleRequestFields *fields; PurpleRequestFieldGroup *group; PurpleRequestField *field; @@ -878,6 +878,11 @@ if(!(type = xmlnode_get_attrib(packet, "type")) || strcmp(type, "result")) return; + from = xmlnode_get_attrib(packet, "from"); + if (!from) + from = js->serverFQDN; + g_return_if_fail(from != NULL); + if(js->registration) { /* get rid of the login thingy */ purple_connection_set_state(js->gc, PURPLE_CONNECTED);