summaryrefslogtreecommitdiff
path: root/sleekxmpp/features/feature_mechanisms
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/features/feature_mechanisms')
-rw-r--r--sleekxmpp/features/feature_mechanisms/mechanisms.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/sleekxmpp/features/feature_mechanisms/mechanisms.py b/sleekxmpp/features/feature_mechanisms/mechanisms.py
index a8a046e4..011010fb 100644
--- a/sleekxmpp/features/feature_mechanisms/mechanisms.py
+++ b/sleekxmpp/features/feature_mechanisms/mechanisms.py
@@ -90,6 +90,11 @@ class feature_mechanisms(base_plugin):
Arguments:
features -- The stream features stanza.
"""
+ if 'mechanisms' in self.xmpp.features:
+ # SASL authentication has already succeeded, but the
+ # server has incorrectly offered it again.
+ return False
+
for priority, mech in self._mechanism_priorities:
if mech in features['mechanisms']:
log.debug('Attempt to use SASL %s' % mech)
@@ -105,7 +110,7 @@ class feature_mechanisms(base_plugin):
def _handle_success(self, stanza):
"""SASL authentication succeeded. Restart the stream."""
self.xmpp.authenticated = True
- self.xmpp.features.append('mechanisms')
+ self.xmpp.features.add('mechanisms')
raise RestartStream()
def _handle_fail(self, stanza):