[Home]

Summary:ASTERISK-09454: [patch] jabber username typo results in asterisk crash
Reporter:julien reveret (osiatis)Labels:
Date Opened:2007-05-16 05:04:47Date Closed:2007-06-04 10:53:04
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Resources/res_jabber
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) branch-1.4-bug_9739-1.diff
( 1) bt.txt
( 2) bt-full.txt
Description:Here is the configuration from /etc/asterisk/jabber.conf that makes asterisk crash :
[asterisk]
type=client
serverhost=192.168.1.184
username=test
secret=************
port=5222
usetls=yes
usesasl=yes
buddy=jreveret@osiatis.com              
statusmessage="I am available"
timeout=100

When started with this config, I get this in the console :

JABBER: asterisk INCOMING: <stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features><proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>

JABBER: asterisk OUTGOING: <?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' to='test' version='1.0'>

JABBER: asterisk INCOMING: <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="srv-comunifiee" id="60d4e590" xml:lang="en" version="1.0"><stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features>

JABBER: asterisk OUTGOING: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'/>

JABBER: asterisk INCOMING: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09InNydi1jb211bmlmaWVlIixub25jZT0iTzBlK0YycmFEQkZuVDFXOEtiQ2FRSHpobDlNN1JWM05PUmZ3Tm02OCIscW9wPSJhdXRoIixjaGFyc2V0PXV0Zi04LGFsZ29yaXRobT1tZDUtc2Vzcw==</challenge>
*** glibc detected *** malloc(): memory corruption: 0x0825d990 ***
Aborted

Modifying username from "username=test" to "username=test@192.168.1.184" fixes the crash but I get an authentication error:
JABBER: asterisk INCOMING: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
[May 16 12:02:05] ERROR[22492]: res_jabber.c:580 aji_act_hook: JABBER: encryption failure. possible bad password.

Comments:By: Jason Parker (jparker) 2007-05-16 10:41:18

What is the typo?

By: phsultan (phsultan) 2007-05-16 11:07:35

Can you try the following please :
- check the TLS crash fix from here : http://bugs.digium.com/view.php?id=7672
- disable TLS (if you Jabber server allows it), and see what happens
- authenticate with sasl_PLAIN rather than sasl_DIGEST-MD5?

A small note regarding the username format : your Jabber server won't process it as a user value if you don't append a domain to it, check http://tools.ietf.org/html/rfc4622#section-2.2

A backtrace of the crash will be helpful too, please provide one. Thanks!

By: Joshua C. Colp (jcolp) 2007-05-17 08:52:29

Please provide a backtrace, thanks!

By: julien reveret (osiatis) 2007-05-21 03:28:46

Even with the patch from bugs ASTERISK-7473 asterisk still crashes.
I know usernames have to be represented as : user@domain, nevertheless I think Asterisk shouldn't crash when given a badly written username. I've uploaded a backtrace and full bracktrace.

By: phsultan (phsultan) 2007-06-02 05:23:08

The attached patch prevents Asterisk from connecting as a user with a malformed jid, thus following RFC 4622. Component connection is allowed though.

-- edit
Disclaimer sent.



By: Tilghman Lesher (tilghman) 2007-06-04 10:53:04

Fixed in 67021.  Merged to trunk in 67023.