[asterisk-commits] mjordan: branch 11 r374622 - /branches/11/res/res_xmpp.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 5 22:20:59 CDT 2012


Author: mjordan
Date: Fri Oct  5 22:20:56 2012
New Revision: 374622

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=374622
Log:
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)


Modified:
    branches/11/res/res_xmpp.c

Modified: branches/11/res/res_xmpp.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/res_xmpp.c?view=diff&rev=374622&r1=374621&r2=374622
==============================================================================
--- branches/11/res/res_xmpp.c (original)
+++ branches/11/res/res_xmpp.c Fri Oct  5 22:20:56 2012
@@ -3142,8 +3142,13 @@
 		}
 
 		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") ||




More information about the asterisk-commits mailing list