]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Fix incorrect parsing in chan_gtalk when xmpp contains extra whitespaces
authorDavid Brooks <dbrooks@digium.com>
Tue, 31 Mar 2009 16:37:12 +0000 (16:37 +0000)
committerDavid Brooks <dbrooks@digium.com>
Tue, 31 Mar 2009 16:37:12 +0000 (16:37 +0000)
commita2933fefef64a962e5a94f8cf6293f921dd27646
treef7af37ecb020e945d94fdba9522d752b99b5fa8d
parentc48480f5e4d4b2e9e848c875ca61f55531178502
Fix incorrect parsing in chan_gtalk when xmpp contains extra whitespaces

To drill into the xmpp to find the capabilities between channels, chan_gtalk
calls iks_child() and iks_next(). iks_child() and iks_next() are functions in
the iksemel xml parsing library that traverse xml nodes. The bug here is that
both iks_child() and iks_next() will return the next iks_struct node
*regardless* of type. chan_gtalk expects the next node to be of type IKS_TAG,
which in most cases, it is, but in this case (a call being made from the
Empathy IM client), there exists iks_struct nodes which are not IKS_TAG data
(they are extraneous whitespaces), and chan_gtalk doesn't handle that case,
so capabilities don't match, and a call cannot be made.

iks_first_tag() and iks_next_tag(), on the other hand, will not return the
very next iks_struct, but will check to see if the next iks_struct is of
type IKS_TAG. If it isn't, it will be skipped, and the next struct of type
IKS_TAG it finds will be returned. This assures that chan_gtalk will find
the iks_struct it is looking for.

This fix simply changes all calls to iks_child() and iks_next() to become
calls to iks_first_tag() and iks_next_tag(), which resolves the capability
matching.

The following is a payload listing from Empathy, which, due to the extraneous
whitespace, will not be parsed correctly by iksemel:

<iq from='dbrooksjab@235-22-24-10/Telepathy' to='astjab@235-22-24-10/asterisk' type='set' id='542757715704'> <session xmlns='http://www.google.com/session' initiator='dbrooksjab@235-22-24-10/Telepathy' type='initiate' id='1837267342'> <description xmlns='http://www.google.com/session/phone'> <payload-type clockrate='16000' name='speex' id='96'/>
 <payload-type clockrate='8000' name='PCMA' id='8'/>
 <payload-type clockrate='8000' name='PCMU' id='0'/>
 <payload-type clockrate='90000' name='MPA' id='97'/>
 <payload-type clockrate='16000' name='SIREN' id='98'/>
 <payload-type clockrate='8000' name='telephone-event' id='99'/>
</description>
</session>
</iq>

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@185362 65c4cc65-6c06-0410-ace0-fbb531ad65f3
channels/chan_gtalk.c