mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-27 22:50:42 +00:00
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/branches/1.8@333265 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1465,7 +1465,15 @@ static int aji_send_raw(struct aji_client *client, const char *xmlstr)
|
|||||||
#endif
|
#endif
|
||||||
/* If needed, data will be sent unencrypted, and logHook will
|
/* If needed, data will be sent unencrypted, and logHook will
|
||||||
be called inside iks_send_raw */
|
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) {
|
if (ret != IKS_OK) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user