diff options
author | Jonathan Rose <jrose@digium.com> | 2011-08-25 19:13:23 +0000 |
---|---|---|
committer | Jonathan Rose <jrose@digium.com> | 2011-08-25 19:13:23 +0000 |
commit | ec62cb53271c04805e4dbae2d3acfc720ae9cb51 (patch) | |
tree | 70efb76edeeb83c8a70ebdc768cc51addfd3212d /res | |
parent | d1a46d2e7a71c7f69f049611e5dfeb103d41b17d (diff) |
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
........
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@333276 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r-- | res/res_jabber.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/res/res_jabber.c b/res/res_jabber.c index 838b6c342..bfbdc7d44 100644 --- a/res/res_jabber.c +++ b/res/res_jabber.c @@ -1511,7 +1511,15 @@ static int aji_send_raw(struct aji_client *client, const char *xmlstr) #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; } |