Fix authenticating on a non-TLS socket.

This was broken since c1562b76b2.
This commit is contained in:
Emmanuel Gil Peyrot 2019-01-21 01:01:59 +01:00
parent 7cd73b594e
commit 41419a2161

View file

@ -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':