Set SCRAM state to just Failure if there's a server-final-message error (sasl)

This commit is contained in:
jesopo 2019-02-06 15:41:31 +00:00
parent 09eb3d3314
commit c006435fa1

View file

@ -14,7 +14,8 @@ class SCRAMState(enum.Enum):
ClientFirst = 1 ClientFirst = 1
ClientFinal = 2 ClientFinal = 2
Success = 3 Success = 3
VerifyFailed = 4 Failed = 4
VerifyFailed = 5
class SCRAMError(Exception): class SCRAMError(Exception):
pass pass
@ -78,6 +79,7 @@ class SCRAM(object):
pieces = self._get_pieces(data) pieces = self._get_pieces(data)
if b"e" in pieces: if b"e" in pieces:
self.error = pieces[b"e"].decode("utf8") self.error = pieces[b"e"].decode("utf8")
self.state = SCRAMState.Failed
return False return False
verifier = pieces[b"v"] verifier = pieces[b"v"]