[asterisk-dev] [svn-commits] jrose: branch 1.8 r333265 - /branches/1.8/res/res_jabber.c
Tzafrir Cohen
tzafrir.cohen at xorcom.com
Sat Aug 27 16:16:44 CDT 2011
On Thu, Aug 25, 2011 at 06:47:45PM -0000, SVN commits to the Digium repositories wrote:
> Author: jrose
> Date: Thu Aug 25 13:47:42 2011
> New Revision: 333265
>
> URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=333265
> Log:
> Segfault when publishing device states via XMPP and not connected
>
> When using publishing device state with res_jabber, Asterisk will attempt
> to send a device state using the unconnected client using iks_send_raw
> and crash. This patch checks the validity of the connection before
> attempting to send the device state.
>
> (closes issue ASTERISK-18078)
> Reported by: Michael L. Young
> Patches:
> res_jabber-segfault-pubsub-not-connected2.patch (license #5026) patch uploaded by Michael L. Young
> Tested by: Jonathan Rose
>
>
> Modified:
> branches/1.8/res/res_jabber.c
>
> Modified: branches/1.8/res/res_jabber.c
> URL: http://svnview.digium.com/svn/asterisk/branches/1.8/res/res_jabber.c?view=diff&rev=333265&r1=333264&r2=333265
> ==============================================================================
> --- branches/1.8/res/res_jabber.c (original)
> +++ branches/1.8/res/res_jabber.c Thu Aug 25 13:47:42 2011
> @@ -1465,7 +1465,15 @@
> #endif
> /* If needed, data will be sent unencrypted, and logHook will
> be called inside iks_send_raw */
> - ret = iks_send_raw(client->p, xmlstr);
> + if((client->timeout != 0 && client->status == AJI_CONNECTED) || (client->status == AJI_CONNECTING))
This breaks building in dev-mode. client->status and AJI_CONNECTING /
AJI_CONNECTED are of different types (two different enum-s). An explicit
cast will fix this. Any problem with that?
> + {
> + ret = iks_send_raw(client->p, xmlstr);
> + }
> + else {
> + ast_log(LOG_WARNING, "JABBER: Unable to send message to %s, we are not connected", client->name);
> + return -1;
> + }
> +
> if (ret != IKS_OK) {
> return ret;
> }
>
>
--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen at xorcom.com
+972-50-7952406 mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com iax:guest at local.xorcom.com/tzafrir
More information about the asterisk-dev
mailing list