[asterisk-commits] jrose: trunk r333276 - in /trunk: ./ res/res_jabber.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 25 14:13:27 CDT 2011


Author: jrose
Date: Thu Aug 25 14:13:23 2011
New Revision: 333276

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=333276
Log:
Merged revisions 333266 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r333266 | jrose | 2011-08-25 14:00:05 -0500 (Thu, 25 Aug 2011) | 20 lines
  
  Merged revisions 333265 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r333265 | jrose | 2011-08-25 13:47:42 -0500 (Thu, 25 Aug 2011) | 14 lines
    
    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:
    trunk/   (props changed)
    trunk/res/res_jabber.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/res/res_jabber.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_jabber.c?view=diff&rev=333276&r1=333275&r2=333276
==============================================================================
--- trunk/res/res_jabber.c (original)
+++ trunk/res/res_jabber.c Thu Aug 25 14:13:23 2011
@@ -1511,7 +1511,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))
+	{
+	    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;
 	}




More information about the asterisk-commits mailing list