From 1b00b7e8dfb4d4b0d069853493d7292d587d5cbe Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 13 Mar 2012 11:07:14 -0700 Subject: Correct handling SASL auth failures when forcing the use of a specific mechanism. --- sleekxmpp/features/feature_mechanisms/mechanisms.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sleekxmpp') diff --git a/sleekxmpp/features/feature_mechanisms/mechanisms.py b/sleekxmpp/features/feature_mechanisms/mechanisms.py index 570b7141..3818c70e 100644 --- a/sleekxmpp/features/feature_mechanisms/mechanisms.py +++ b/sleekxmpp/features/feature_mechanisms/mechanisms.py @@ -105,14 +105,17 @@ class FeatureMechanisms(BasePlugin): # server has incorrectly offered it again. return False - self.mech_list = set(features['mechanisms']) + if not self.use_mech: + self.mech_list = set(features['mechanisms']) + else: + self.mech_list = set([self.use_mech]) return self._send_auth() def _send_auth(self): mech_list = self.mech_list - self.attempted_mechs self.mech = self.sasl.choose_mechanism(mech_list) - if self.mech is not None: + if mech_list and self.mech is not None: resp = stanza.Auth(self.xmpp) resp['mechanism'] = self.mech.name try: -- cgit v1.2.3