Opened 9 years ago

Closed 9 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:


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/", line 780, in _onEndElement
	  File "/usr/lib/python2.5/site-packages/twisted/words/xish/", line 106, in onElement
	  File "/usr/lib/python2.5/site-packages/twisted/words/xish/", line 316, in dispatch
	--- <exception caught here> ---
	  File "/usr/lib/python2.5/site-packages/twisted/words/xish/", line 106, in callback
	    methodwrapper(*args, **kwargs)
	  File "/usr/lib/python2.5/site-packages/twisted/words/xish/", line 27, in __call__
	    self.method(*nargs, **nkwargs)
	  File "/usr/lib/python2.5/site-packages/twisted/words/protocols/jabber/", line 193, in onChallenge
	  File "/usr/lib/python2.5/site-packages/twisted/words/protocols/jabber/", line 100, in getResponse
	  File "/usr/lib/python2.5/site-packages/twisted/words/protocols/jabber/", line 220, in _gen_response
	    return self._unparse(directives)
	  File "/usr/lib/python2.5/site-packages/twisted/words/protocols/jabber/", 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 9 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 9 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"é"), secret)

comment:3 Changed 9 years ago by ralphm

Status: newassigned

comment:4 Changed 9 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 9 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 8 years ago by <automation>

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