Mercurial > libervia-backend
diff sat/core/xmpp.py @ 3044:691283719bb2
core (patches): updated TLS patches:
- updated patches to handle TLS after implementation in Twisted 19.7.0. A patch is still
needed for Wokkel.
- minimum required version of Twisted is now 19.7.0
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 01 Oct 2019 22:49:10 +0200 |
parents | fee60f17ebac |
children | aa728dc7b0ce |
line wrap: on
line diff
--- a/sat/core/xmpp.py Tue Oct 01 22:49:10 2019 +0200 +++ b/sat/core/xmpp.py Tue Oct 01 22:49:10 2019 +0200 @@ -26,6 +26,7 @@ from sat.core.constants import Const as C from sat.memory import cache from twisted.internet import defer, error as internet_error +from twisted.internet import ssl from twisted.words.protocols.jabber.xmlstream import XMPPHandler from twisted.words.protocols.jabber import xmlstream from twisted.words.protocols.jabber import error @@ -715,9 +716,15 @@ self.check_certificate = host_app.memory.getParamA( "check_certificate", "Connection", profile_key=profile) + if self.check_certificate: + tls_required, configurationForTLS = True, None + else: + tls_required = False + configurationForTLS = ssl.CertificateOptions(trustRoot=None) + wokkel_client.XMPPClient.__init__( self, user_jid, password, host or None, port or C.XMPP_C2S_PORT, - # check_certificate = self.check_certificate # FIXME: currently disabled with Python 3 port + tls_required=tls_required, configurationForTLS=configurationForTLS ) SatXMPPEntity.__init__(self, host_app, profile, max_retries)