# HG changeset patch # User Evan Schoenberg # Date 1195459536 0 # Node ID 68b036c452f3586f81ddccc9a347b5977f046918 # Parent 28824f9f8e470ebff44a84a82cae61a05ac5d583 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. diff -r 28824f9f8e47 -r 68b036c452f3 libpurple/protocols/jabber/jabber.c --- 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);