Correct handling SASL auth failures when forcing the use of a specific mechanism.
This commit is contained in:
parent
7284ceb90c
commit
1b00b7e8df
1 changed files with 5 additions and 2 deletions
|
@ -105,14 +105,17 @@ class FeatureMechanisms(BasePlugin):
|
||||||
# server has incorrectly offered it again.
|
# server has incorrectly offered it again.
|
||||||
return False
|
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()
|
return self._send_auth()
|
||||||
|
|
||||||
def _send_auth(self):
|
def _send_auth(self):
|
||||||
mech_list = self.mech_list - self.attempted_mechs
|
mech_list = self.mech_list - self.attempted_mechs
|
||||||
self.mech = self.sasl.choose_mechanism(mech_list)
|
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 = stanza.Auth(self.xmpp)
|
||||||
resp['mechanism'] = self.mech.name
|
resp['mechanism'] = self.mech.name
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue