From 41419a21613bd17f58965840340251872603a2e4 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Mon, 21 Jan 2019 01:01:59 +0100 Subject: [PATCH] Fix authenticating on a non-TLS socket. This was broken since c1562b76b273cc7aeaaa1cf8fddd3dca2c828c4d. --- slixmpp/features/feature_mechanisms/mechanisms.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/slixmpp/features/feature_mechanisms/mechanisms.py b/slixmpp/features/feature_mechanisms/mechanisms.py index 30449de0..26af1947 100644 --- a/slixmpp/features/feature_mechanisms/mechanisms.py +++ b/slixmpp/features/feature_mechanisms/mechanisms.py @@ -97,7 +97,10 @@ class FeatureMechanisms(BasePlugin): jid = self.xmpp.requested_jid.bare result[value] = creds.get('email', jid) elif value == 'channel_binding': - result[value] = self.xmpp.socket.get_channel_binding() + if isinstance(self.xmpp.socket, (ssl.SSLSocket, ssl.SSLObject)): + result[value] = self.xmpp.socket.get_channel_binding() + else: + result[value] = None elif value == 'host': result[value] = creds.get('host', self.xmpp.requested_jid.domain) elif value == 'realm':