summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2012-07-16 19:14:29 +0000
committerJoshua Colp <jcolp@digium.com>2012-07-16 19:14:29 +0000
commitfdd39eae5850e699aac2609d5baf41e0945929a0 (patch)
tree9bdf1cd9e6c08b4f5a61b6f19a32f53c3b1bf161 /res
parent3b59ab1c77bc3c8beee5441917007d38b6a416f7 (diff)
Fix an issue where a service discovery request could crash Asterisk.
A server sending a service discovery request to us may or may not put a from attribute in the message. If the from attribute is present use it in the to attribute for the result. If the from attribute is not present do not add a to attribute. (issue ASTERISK-16203) Reported by: wubbla git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370126 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/res_xmpp.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/res/res_xmpp.c b/res/res_xmpp.c
index 546243c7b..91be7afbd 100644
--- a/res/res_xmpp.c
+++ b/res/res_xmpp.c
@@ -2211,7 +2211,11 @@ static int xmpp_client_service_discovery_get_hook(void *data, ikspak *pak)
}
iks_insert_attrib(iq, "from", client->jid->full);
- iks_insert_attrib(iq, "to", pak->from->full);
+
+ if (pak->from) {
+ iks_insert_attrib(iq, "to", pak->from->full);
+ }
+
iks_insert_attrib(iq, "type", "result");
iks_insert_attrib(iq, "id", pak->id);
iks_insert_attrib(query, "xmlns", "http://jabber.org/protocol/disco#info");
@@ -3037,8 +3041,11 @@ static int xmpp_pak_presence(struct ast_xmpp_client *client, struct ast_xmpp_cli
}
if (!(buddy = ao2_find(client->buddies, pak->from->partial, OBJ_KEY))) {
- ast_log(LOG_WARNING, "Received presence information about '%s' despite not having them in roster on client '%s'\n",
- pak->from->partial, client->name);
+ /* Only output the message if it is not about us */
+ if (strcmp(client->jid->partial, pak->from->partial)) {
+ ast_log(LOG_WARNING, "Received presence information about '%s' despite not having them in roster on client '%s'\n",
+ pak->from->partial, client->name);
+ }
return 0;
}