summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorBrian Beggs <macdiesel@gmail.com>2010-07-01 09:46:12 -0400
committerBrian Beggs <macdiesel@gmail.com>2010-07-01 09:46:12 -0400
commitd62a30b0f8353640928d11cdfd76ea3c7a9b5cc3 (patch)
treeed44c95f22adbf57fa283348e379e84140d7e01a /sleekxmpp
parentd763795b2cb01fd90b8d7661bfafdb80d84e13c8 (diff)
downloadslixmpp-d62a30b0f8353640928d11cdfd76ea3c7a9b5cc3.tar.gz
slixmpp-d62a30b0f8353640928d11cdfd76ea3c7a9b5cc3.tar.bz2
slixmpp-d62a30b0f8353640928d11cdfd76ea3c7a9b5cc3.tar.xz
slixmpp-d62a30b0f8353640928d11cdfd76ea3c7a9b5cc3.zip
digest-md5 authentication now works with unicode-literals import. Re-added the __future__ imports that were removed.
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/__init__.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/sleekxmpp/__init__.py b/sleekxmpp/__init__.py
index b62e35db..3379e45d 100644
--- a/sleekxmpp/__init__.py
+++ b/sleekxmpp/__init__.py
@@ -7,6 +7,7 @@
See the file license.txt for copying permission.
"""
+from __future__ import absolute_import, unicode_literals
from . basexmpp import basexmpp
from xml.etree import cElementTree as ET
from . xmlstream.xmlstream import XMLStream
@@ -255,8 +256,7 @@ class ClientXMPP(basexmpp, XMLStream):
for i in range(7):
cnonce+=hex(int(random.random()*65536*4096))[2:]
cnonce = base64.encodestring(cnonce)[0:-1]
- a1 = md5("%s:%s:%s" % (self.username, self.domain, self.password))
- a1 = "%s:%s:%s" %(a1, challenge["nonce"], cnonce )
+ a1 = b"%s:%s:%s" %(md5("%s:%s:%s" % (self.username, self.domain, self.password)), challenge["nonce"].encode("UTF-8"), cnonce.encode("UTF-8") )
a2 = "AUTHENTICATE:xmpp/%s" %self.domain
responseHash = md5digest("%s:%s:00000001:%s:auth:%s" %(md5digest(a1), challenge["nonce"], cnonce, md5digest(a2) ) )
response = '''charset=utf-8,username="%s",realm="%s",nonce="%s",nc=00000001,cnonce="%s",digest-uri="%s",response=%s,qop=%s,''' %(self.username, self.domain, challenge["nonce"], cnonce, "xmpp/%s" % self.domain, responseHash, challenge["qop"])