python-xmpp broken in Jessie which breaks otr-bot
All the Chatting with some friend over XMPP and with OTR*
scenarios
are broken when the test suite is run in a Jessie environment, resulting
in this error from features/scripts/otr-bot.py
:
Traceback (most recent call last):
File "/tails-share/features/scripts/otr-bot.py", line 197, in <module>
otr_bot.serve_forever()
File "/usr/lib/python2.7/dist-packages/jabberbot.py", line 715, in serve_forever
conn = self.connect()
File "/tails-share/features/scripts/otr-bot.py", line 82, in connect
conres = conn.connect((conn_server, int(conn_port)))
File "/usr/lib/python2.7/dist-packages/xmpp/client.py", line 205, in connect
while not self.TLS.starttls and self.Process(1): pass
File "/usr/lib/python2.7/dist-packages/xmpp/dispatcher.py", line 303, in dispatch
handler['func'](session,stanza)
File "/usr/lib/python2.7/dist-packages/xmpp/transports.py", line 330, in StartTLSHandler
self._startSSL()
File "/usr/lib/python2.7/dist-packages/xmpp/transports.py", line 309, in _startSSL
tcpsock._sslIssuer = tcpsock._sslObj.issuer()
AttributeError: '_ssl._SSLSocket' object has no attribute 'issuer'
Apparently, xmpppy, i.e. the python-xmpp
package in Debian, is
abandoned, and is experiencing bit rot vs newer versions python. There’s
a fork which fixes a number
of issues, including a fix for the above
bug:
--- xmpp/transports.py.orig 2010-04-06 21:05:04.000000000 +0800
+++ xmpp/transports.py 2010-04-06 21:05:20.000000000 +0800
@@ -27,7 +27,7 @@ Transports are stackable so you - f.e. T
Also exception 'error' is defined to allow capture of this module specific exceptions.
"""
-import socket,select,base64,dispatcher,sys
+import socket,ssl,select,base64,dispatcher,sys
from simplexml import ustr
from client import PlugIn
from protocol import *
@@ -312,9 +312,9 @@ class TLS(PlugIn):
""" Immidiatedly switch socket to TLS mode. Used internally."""
""" Here we should switch pending_data to hint mode."""
tcpsock=self._owner.Connection
- tcpsock._sslObj = socket.ssl(tcpsock._sock, None, None)
- tcpsock._sslIssuer = tcpsock._sslObj.issuer()
- tcpsock._sslServer = tcpsock._sslObj.server()
+ tcpsock._sslObj = ssl.wrap_socket(tcpsock._sock, None, None)
+ tcpsock._sslIssuer = tcpsock._sslObj.getpeercert().get('issuer')
+ tcpsock._sslServer = tcpsock._sslObj.getpeercert().get('server')
tcpsock._recv = tcpsock._sslObj.read
tcpsock._send = tcpsock._sslObj.write
I have verified that this patch fixes the issue for us.
Already reported as Debian bug #766475
Related issues
- Blocks #8165 (closed)
Original created by @anonym on 9074 (Redmine)