[Dave Cridland] try to encode username, realm and password in iso-8859-1 when doing DIGEST-MD5 before computing the hash. Fixes #5512
This commit is contained in:
parent
9072ff18c1
commit
4b07509d5e
|
@ -351,8 +351,17 @@ class SASL(PlugIn):
|
||||||
else:
|
else:
|
||||||
self.password = password
|
self.password = password
|
||||||
if self.mechanism == 'DIGEST-MD5':
|
if self.mechanism == 'DIGEST-MD5':
|
||||||
A1 = C([H(C([self.resp['username'], self.resp['realm'],
|
def convert_to_iso88591(string):
|
||||||
self.password])), self.resp['nonce'], self.resp['cnonce']])
|
try:
|
||||||
|
string = string.decode('utf-8').encode('iso-8859-1')
|
||||||
|
except UnicodeEncodeError:
|
||||||
|
pass
|
||||||
|
return string
|
||||||
|
hash_username = convert_to_iso88591(self.resp['username'])
|
||||||
|
hash_realm = convert_to_iso88591(self.resp['realm'])
|
||||||
|
hash_password = convert_to_iso88591(self.password)
|
||||||
|
A1 = C([H(C([hash_username, hash_realm, hash_password])),
|
||||||
|
self.resp['nonce'], self.resp['cnonce']])
|
||||||
A2 = C(['AUTHENTICATE', self.resp['digest-uri']])
|
A2 = C(['AUTHENTICATE', self.resp['digest-uri']])
|
||||||
response= HH(C([HH(A1), self.resp['nonce'], self.resp['nc'],
|
response= HH(C([HH(A1), self.resp['nonce'], self.resp['nc'],
|
||||||
self.resp['cnonce'], self.resp['qop'], HH(A2)]))
|
self.resp['cnonce'], self.resp['qop'], HH(A2)]))
|
||||||
|
|
Loading…
Reference in New Issue