fritzy / SleekXMPP

Python 2.6+/3.1+ XMPP Library
http://groups.google.com/group/sleekxmpp-discussion
Other
1.1k stars 299 forks source link

Problem after upgrading pyasn1 from 0.3.6 => 0.4.2 and pyasn1-modules from 0.1.5 => 0.2.1 #477

Open iegubkin opened 6 years ago

iegubkin commented 6 years ago

sleekxmpp 1.3.2 An upgrade of pyasn1 from 0.3.6 => 0.4.2 and pyasn1-modules from 0.1.5 => 0.2.1 on Arch Linux seems to break sleekxmpp with the following error.

ERROR    Connection error.
ERROR    <TagSet object at 0x7f021a4c6eb8 tags 0:32:16> not in asn1Spec: <OctetString schema object at 0x7f0218c678d0 tagSet <TagSet object at 0x7f021a845dd8 tags 0:0:4> encoding iso-8859-1>
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1492, in _process
    if not self.__read_xml():
  File "/usr/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1564, in __read_xml
    self.__spawn_event(xml)
  File "/usr/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1632, in __spawn_event
    handler.prerun(stanza_copy)
  File "/usr/lib/python3.6/site-packages/sleekxmpp/xmlstream/handler/callback.py", line 64, in prerun
    self.run(payload, True)
  File "/usr/lib/python3.6/site-packages/sleekxmpp/xmlstream/handler/callback.py", line 76, in run
    self._pointer(payload)
  File "/usr/lib/python3.6/site-packages/sleekxmpp/features/feature_starttls/starttls.py", line 64, in _handle_starttls_proceed
    if self.xmpp.start_tls():
  File "/usr/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 889, in start_tls
    cert.verify(self._expected_server_name, self._der_cert)
  File "/usr/lib/python3.6/site-packages/sleekxmpp/xmlstream/cert.py", line 142, in verify
    cert_names = extract_names(raw_cert)
  File "/usr/lib/python3.6/site-packages/sleekxmpp/xmlstream/cert.py", line 73, in extract_names
    asn1Spec=OctetString())[0]
  File "/usr/lib/python3.6/site-packages/pyasn1/codec/ber/decoder.py", line 1318, in __call__
    '%s not in asn1Spec: %r' % (tagSet, asn1Spec)
pyasn1.error.PyAsn1Error: <TagSet object at 0x7f021a4c6eb8 tags 0:32:16> not in asn1Spec: <OctetString schema object at 0x7f0218c678d0 tagSet <TagSet object at 0x7f021a845dd8 tags 0:0:4> encoding iso-8859-1>
DEBUG    reconnecting...

After downgrading back to pyasn1 0.3.6 and pyasn1-modules 0.1.5 sleekxmpp works fine.

fabaff commented 6 years ago

https://github.com/etingof/pyasn1/issues/112

fenchu commented 6 years ago

Thanks

pyasn1==0.3.6
pyasn1-modules==0.1.5
sleekxmpp==1.3.3
immanuelfodor commented 5 years ago

The above version fix workaround doesn't work for me with a valid Let's Encrypt certificate:

DEBUG:sleekxmpp.features.feature_starttls.starttls:Starting TLS
INFO:sleekxmpp.xmlstream.xmlstream:Negotiating TLS
INFO:sleekxmpp.xmlstream.xmlstream:Using SSL version: TLSv1_2
DEBUG:sleekxmpp.xmlstream.xmlstream:CERT: -----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----

DEBUG:sleekxmpp.xmlstream.xmlstream:Event triggered: ssl_cert
ERROR:sleekxmpp.xmlstream.xmlstream:Certificate has expired.
DEBUG:sleekxmpp.xmlstream.xmlstream:Event triggered: session_end
DEBUG:sleekxmpp.xmlstream.xmlstream:Event triggered: disconnected
DEBUG:sleekxmpp.thirdparty.statemachine: ==== TRANSITION connected -> disconnected