[CalendarServer-changes] [3823] CalendarServer/branches/exarkun/update-twisted-3816/lib-patches/ Twisted/twisted.web2.auth.digest.patch
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 11 15:04:15 PDT 2009
Revision: 3823
http://trac.macosforge.org/projects/calendarserver/changeset/3823
Author: exarkun at twistedmatrix.com
Date: 2009-03-11 15:04:14 -0700 (Wed, 11 Mar 2009)
Log Message:
-----------
Update digest auth patch to apply to the branch; md5 changes no longer needed
Modified Paths:
--------------
CalendarServer/branches/exarkun/update-twisted-3816/lib-patches/Twisted/twisted.web2.auth.digest.patch
Modified: CalendarServer/branches/exarkun/update-twisted-3816/lib-patches/Twisted/twisted.web2.auth.digest.patch
===================================================================
--- CalendarServer/branches/exarkun/update-twisted-3816/lib-patches/Twisted/twisted.web2.auth.digest.patch 2009-03-11 21:52:13 UTC (rev 3822)
+++ CalendarServer/branches/exarkun/update-twisted-3816/lib-patches/Twisted/twisted.web2.auth.digest.patch 2009-03-11 22:04:14 UTC (rev 3823)
@@ -1,9 +1,9 @@
Index: twisted/web2/auth/digest.py
===================================================================
---- twisted/web2/auth/digest.py (revision 19773)
+--- twisted/web2/auth/digest.py (revision 26342)
+++ twisted/web2/auth/digest.py (working copy)
-@@ -8,19 +8,28 @@
- import time
+@@ -11,9 +11,14 @@
+ import random
from twisted.cred import credentials, error
+from twisted.internet.defer import succeed
@@ -14,49 +14,19 @@
+from twisted.web2.http_headers import Token
+from twisted.web2.http_headers import split
+from twisted.web2.http_headers import parseKeyValue
+ from twisted.python.hashlib import md5, sha1
--import md5, sha
-+try:
-+ from hashlib import md5, sha1
-+except ImportError:
-+ import md5.new as md5
-+ import sha.new as sha1
- import random, sys
-
# The digest math
-
- algorithms = {
-- 'md5': md5.new,
-- 'md5-sess': md5.new,
-- 'sha': sha.new,
-+ 'md5': md5,
-+ 'md5-sess': md5,
-+ 'sha': sha1,
- }
-
- # DigestCalcHA1
-@@ -228,9 +237,9 @@
- # Now, what we do is encode the nonce, client ip and a timestamp
- # in the opaque value with a suitable digest
+@@ -231,7 +236,7 @@
key = "%s,%s,%s" % (nonce, clientip, str(int(self._getTime())))
-- digest = md5.new(key + self.privateKey).hexdigest()
-+ digest = md5(key + self.privateKey).hexdigest()
+ digest = md5(key + self.privateKey).hexdigest()
ekey = key.encode('base64')
- return "%s-%s" % (digest, ekey.strip('\n'))
+ return "%s-%s" % (digest, ekey.replace('\n', ''))
def verifyOpaque(self, opaque, nonce, clientip):
"""
-@@ -274,7 +283,7 @@
- 'Invalid response, incompatible opaque/nonce too old')
-
- # Verify the digest
-- digest = md5.new(key + self.privateKey).hexdigest()
-+ digest = md5(key + self.privateKey).hexdigest()
- if digest != opaqueParts[0]:
- raise error.LoginFailed('Invalid response, invalid opaque value')
-
-@@ -293,11 +302,12 @@
+@@ -295,11 +300,12 @@
c = self.generateNonce()
o = self.generateOpaque(c, peer.host)
@@ -74,7 +44,7 @@
def decode(self, response, request):
"""
-@@ -315,18 +325,18 @@
+@@ -317,18 +323,18 @@
@raise: L{error.LoginFailed} if the response does not contain a
username, a nonce, an opaque, or if the opaque is invalid.
"""
@@ -104,7 +74,7 @@
username = auth.get('username')
if not username:
raise error.LoginFailed('Invalid response, no username given.')
-@@ -342,7 +352,7 @@
+@@ -344,7 +350,7 @@
auth.get('nonce'),
request.remoteAddr.host):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090311/32088d5e/attachment.html>
More information about the calendarserver-changes
mailing list