summaryrefslogtreecommitdiff
path: root/res/res_xmpp.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2012-10-06 03:22:37 +0000
committerMatthew Jordan <mjordan@digium.com>2012-10-06 03:22:37 +0000
commitbd36827e98b79615c8ff7daa435e3a4c207ffce6 (patch)
treeae0df595b86d5838f081c00604cc3b56f95eebe7 /res/res_xmpp.c
parent15b35972ff82e52864edd7b280c45c678e491002 (diff)
Handle capability stanzas that fail to provide node or version information
While XEP-0115 states that the node and ver attributes are both required, some devices fail to provide either field. Prior to this patch, failure to provide the node or ver attribute would cause a crash in res_xmpp. While failing to provide the node or ver attribute is technically invalid, since this information is not utilized by Asterisk except for reporting purposes, for interoperability reasons, we continue to process the capability stanza anyways. (closes issue ASTERISK-20495) Reported by: Martin W Tested by: Martin W patches: 20495.patch uploaded by Martin W (license #6434) ........ Merged revisions 374622 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_xmpp.c')
-rw-r--r--res/res_xmpp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/res/res_xmpp.c b/res/res_xmpp.c
index 3a2ad13c9..13c07c29b 100644
--- a/res/res_xmpp.c
+++ b/res/res_xmpp.c
@@ -3157,8 +3157,13 @@ static int xmpp_pak_presence(struct ast_xmpp_client *client, struct ast_xmpp_cli
}
if ((node && strcmp(resource->caps.node, node)) || (ver && strcmp(resource->caps.version, ver))) {
- ast_copy_string(resource->caps.node, node, sizeof(resource->caps.node));
- ast_copy_string(resource->caps.version, ver, sizeof(resource->caps.version));
+ /* For interoperability reasons, proceed even if the resource fails to provide node or version */
+ if (node) {
+ ast_copy_string(resource->caps.node, node, sizeof(resource->caps.node));
+ }
+ if (ver) {
+ ast_copy_string(resource->caps.version, ver, sizeof(resource->caps.version));
+ }
/* Google Talk places the capabilities information directly in presence, so see if it is there */
if (iks_find_with_attrib(pak->x, "c", "node", "http://www.google.com/xmpp/client/caps") ||