Ticket #2461 defect closed fixed

Opened 6 years ago

Last modified 6 years ago

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: Launchpad Bug:

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

1

Changed 6 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.

2

Changed 6 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.

3

Changed 6 years ago by ralphm

  • status changed from assigned to new
  • keywords review added
  • milestone set to Words-0.6
  • owner changed from ralphm to itamarst
  • priority changed from normal to highest

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

4

Changed 6 years ago by therve

  • keywords review removed
  • owner changed from itamarst to ralphm
  • cc therve added
  • 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!

5

Changed 6 years ago by ralphm

  • keywords review added
  • owner changed from ralphm to therve

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

6

Changed 6 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.

7

Changed 6 years ago by ralphm

  • status changed from new to closed
  • resolution set to fixed

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