Opened 10 years ago

Closed 10 years ago

#2461 defect closed fixed (fixed)

words.protocols.jabber.sasl uses base64.b64encode, which breaks compatibility with Python 2.3.x

Reported by: murphy_slaw Owned by: ralphm
Priority: highest Milestone: Words-0.6
Component: words Keywords:
Cc: murphy_slaw, ralphm, itamarst, therve Branch:
Author:

Description

Twisted 2.5.0 release notes say:

"Twisted is an event-based framework for internet applications which works on Python 2.3.x, 2.4.x, and 2.5.x."

words/protocols/jabber/sasl.py, line 101, calls base64.b64encode, which doesn't exist in Python 2.3.x.

Replacing b64encode with the base64.encodestring seems to fix the problem.

Change History (7)

comment:1 Changed 10 years ago by itamarst

Owner: changed from Jean-Paul Calderone to ralphm

Since the buildbot didn't catch this, there would appear to be a lack in test coverage as well.

comment:2 Changed 10 years ago by ralphm

Cc: murphy_slaw ralphm itamarst added
Status: newassigned

I've looked briefly into this. The encodestring from base64 behaves different in that it adds a \n to the end of the result. I suppose that can be worked around.

Started a branch to work on this with some preliminary tests: source:branches/jabber-sasl-base64-2461.

comment:3 Changed 10 years ago by ralphm

Keywords: review added
Milestone: Words-0.6
Owner: changed from ralphm to itamarst
Priority: normalhighest
Status: assignednew

Added more tests and fix in the mentioned branch. Please review.

comment:4 Changed 10 years ago by therve

Cc: therve added
Keywords: review removed
Owner: changed from itamarst to ralphm
  • Unused import sasl_mechanisms from test_jabbersasl. It probably comes from the commented implements
  • the raw 'except:' in onChallenge could probably be changed to something more specific
  • the raise should use an instance (raise SASLIncorrectEncoding(), raise SASLNoAcceptableMechanism())
  • copyright 2001-2007 in test_jabbersasl
  • some missing docstrings in test_jabbersasl
  • trailing whitespaces in test_jabbersasl

Thanks!

comment:5 Changed 10 years ago by ralphm

Keywords: review added
Owner: changed from ralphm to therve

Thanks for the comments. All addressed. Please review again.

comment:6 Changed 10 years ago by therve

Keywords: review removed
Owner: changed from therve to ralphm
  • There still undocumented parts in test_jabbersasl (eg SASLInitiatingInitializerTest)
  • setMechanism of SASLInitiatingInitializer is not tested
  • sendResponse with data is also not tested

As this branch is already a big improve on the current situation, I don't think it should block you from merging, though.

comment:7 Changed 10 years ago by ralphm

Resolution: fixed
Status: newclosed

(In [19791]) Unbreak XMPP SASL on Python 2.3.

Author: ralphm Reviewer: therve Fixes #2461.

Use the legacy interface to base64 for Python 2.3, and also implement some additional checks for inappropriate inputs before actually decoding challenges.

Note: See TracTickets for help on using tickets.