Opened 8 years ago

Closed 8 years ago

#4161 defect closed duplicate (duplicate)

sasl fails when using unicode jids

Reported by: sciasbat Owned by:
Priority: normal Milestone:
Component: words Keywords: sasl
Cc: Branch:
Author:

Description

here is a full stack trace:

	Traceback (most recent call last):
	  File "/home/packages/python/2.5/python2.5-2.5.2/Modules/pyexpat.c", line 656, in EndElement
	    
	  File "/usr/lib/python2.5/site-packages/twisted/words/xish/domish.py", line 780, in _onEndElement
	    self.ElementEvent(self.currElem)
	  File "/usr/lib/python2.5/site-packages/twisted/words/xish/xmlstream.py", line 106, in onElement
	    self.dispatch(element)
	  File "/usr/lib/python2.5/site-packages/twisted/words/xish/utility.py", line 316, in dispatch
	    callbacklist.callback(obj)
	--- <exception caught here> ---
	  File "/usr/lib/python2.5/site-packages/twisted/words/xish/utility.py", line 106, in callback
	    methodwrapper(*args, **kwargs)
	  File "/usr/lib/python2.5/site-packages/twisted/words/xish/utility.py", line 27, in __call__
	    self.method(*nargs, **nkwargs)
	  File "/usr/lib/python2.5/site-packages/twisted/words/protocols/jabber/sasl.py", line 193, in onChallenge
	    self.sendResponse(self.mechanism.getResponse(challenge))
	  File "/usr/lib/python2.5/site-packages/twisted/words/protocols/jabber/sasl_mechanisms.py", line 100, in getResponse
	    directives['nonce'])
	  File "/usr/lib/python2.5/site-packages/twisted/words/protocols/jabber/sasl_mechanisms.py", line 220, in _gen_response
	    return self._unparse(directives)
	  File "/usr/lib/python2.5/site-packages/twisted/words/protocols/jabber/sasl_mechanisms.py", line 168, in _unparse
	    return ','.join(directive_list)
	exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 13: ordinal not in range(128)

In my working copy this fix in _unparse works:

  for name, value in directives.iteritems():
            if isinstance(name, unicode): name = name.encode("utf8")
            if isinstance(value, unicode): value = value.encode("utf8")

Change History (6)

comment:1 Changed 8 years ago by Jean-Paul Calderone

An example of how this can be reproduced would also be useful.

comment:2 in reply to:  1 Changed 8 years ago by sciasbat

Replying to exarkun:

An example of how this can be reproduced would also be useful.

just try logging in with something like this

client.XMPPClientFactory(JID(u"élite@example.org"), secret)

comment:3 Changed 8 years ago by ralphm

Status: newassigned

comment:4 Changed 8 years ago by ralphm

As you can see in _gen_response, the username is already encoded there. The problem lies in the digest_uri, which is not encoded, causing the join to fail. I'll create a proper test for this, along with a corresponding fix.

comment:5 Changed 8 years ago by ralphm

Resolution: duplicate
Status: assignedclosed

Oh, and you already added a bug for this two years ago. Closing this as a duplicate of #2756.

comment:6 Changed 7 years ago by <automation>

Owner: ralphm deleted
Note: See TracTickets for help on using tickets.