Opened 9 years ago

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


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/, 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 9 years ago by itamarst

  • Owner changed from exarkun to ralphm

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

comment:2 Changed 9 years ago by ralphm

  • Cc murphy_slaw ralphm itamarst added
  • Status changed from new to assigned

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 9 years ago by ralphm

  • Keywords review added
  • Milestone set to Words-0.6
  • Owner changed from ralphm to itamarst
  • Priority changed from normal to highest
  • Status changed from assigned to new

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

comment:4 Changed 9 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


comment:5 Changed 9 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 9 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 9 years ago by ralphm

  • Resolution set to fixed
  • Status changed from new to closed

(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.