[Zodb-checkins] SVN: ZODB/branches/matt-python2.6/src/ZEO/ Checkpoint
matt@zope.com
cvs-admin at zope.org
Fri Nov 14 16:32:41 EST 2008
Log message for revision 92943:
Checkpoint
Changed:
U ZODB/branches/matt-python2.6/src/ZEO/auth/auth_digest.py
U ZODB/branches/matt-python2.6/src/ZEO/auth/base.py
U ZODB/branches/matt-python2.6/src/ZEO/hash.py
U ZODB/branches/matt-python2.6/src/ZEO/tests/auth_plaintext.py
U ZODB/branches/matt-python2.6/src/ZEO/zrpc/smac.py
-=-
Modified: ZODB/branches/matt-python2.6/src/ZEO/auth/auth_digest.py
===================================================================
--- ZODB/branches/matt-python2.6/src/ZEO/auth/auth_digest.py 2008-11-14 20:28:55 UTC (rev 92942)
+++ ZODB/branches/matt-python2.6/src/ZEO/auth/auth_digest.py 2008-11-14 21:32:41 UTC (rev 92943)
@@ -56,7 +56,7 @@
return s
def hexdigest(s):
- return hash(s).hexdigest()
+ return sha1(s).hexdigest()
class DigestDatabase(Database):
def __init__(self, filename, realm=None):
@@ -76,7 +76,7 @@
# HMAC wants a 64-byte key. We don't want to use h_up
# directly because it would never change over time. Instead
# use the hash plus part of h_up.
- return hash("%s:%s" % (h_up, nonce)).digest() + h_up[:44]
+ return sha1("%s:%s" % (h_up, nonce)).digest() + h_up[:44]
class StorageClass(ZEOStorage):
def set_database(self, database):
@@ -92,7 +92,7 @@
def _get_nonce(self):
# RFC 2069 recommends a nonce of the form
# H(client-IP ":" time-stamp ":" private-key)
- dig = hash()
+ dig = sha1()
dig.update(str(self.connection.addr))
dig.update(self._get_time())
dig.update(self.noncekey)
Modified: ZODB/branches/matt-python2.6/src/ZEO/auth/base.py
===================================================================
--- ZODB/branches/matt-python2.6/src/ZEO/auth/base.py 2008-11-14 20:28:55 UTC (rev 92942)
+++ ZODB/branches/matt-python2.6/src/ZEO/auth/base.py 2008-11-14 21:32:41 UTC (rev 92943)
@@ -98,11 +98,11 @@
self.realm = line[len("realm "):]
for line in L:
- username, hash = line.strip().split(":", 1)
- self._users[username] = hash.strip()
+ username, hashvar = line.strip().split(":", 1)
+ self._users[username] = hashvar.strip()
def _store_password(self, username, password):
- self._users[username] = self.hash(password)
+ self._users[username] = self.hash_func(password)
def get_password(self, username):
"""Returns password hash for specified username.
@@ -113,8 +113,8 @@
raise LookupError("No such user: %s" % username)
return self._users[username]
- def hash(self, s):
- return hash(s).hexdigest()
+ def hash_func(self, s):
+ return sha1(s).hexdigest()
def add_user(self, username, password):
if self._users.has_key(username):
Modified: ZODB/branches/matt-python2.6/src/ZEO/hash.py
===================================================================
--- ZODB/branches/matt-python2.6/src/ZEO/hash.py 2008-11-14 20:28:55 UTC (rev 92942)
+++ ZODB/branches/matt-python2.6/src/ZEO/hash.py 2008-11-14 21:32:41 UTC (rev 92943)
@@ -1,14 +1,12 @@
##############################################################################
#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
+# This software is Copyright (c) Zope Corporation (tm) and
+# Contributors. All rights reserved.
#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# This software consists of contributions made by Zope
+# Corporation and many individuals on behalf of Zope
+# Corporation. Specific attributions are listed in the
+# accompanying credits file.
#
##############################################################################
"""In Python 2.6, the "sha" and "md5" modules have been deprecated
@@ -19,7 +17,7 @@
if sys.version_info[:2] >= (2, 6):
import hashlib
- hash = hashlib.sha1
+ sha1 = hashlib.sha1
else:
import sha
- hash = sha.new
+ sha1 = sha.new
Modified: ZODB/branches/matt-python2.6/src/ZEO/tests/auth_plaintext.py
===================================================================
--- ZODB/branches/matt-python2.6/src/ZEO/tests/auth_plaintext.py 2008-11-14 20:28:55 UTC (rev 92942)
+++ ZODB/branches/matt-python2.6/src/ZEO/tests/auth_plaintext.py 2008-11-14 21:32:41 UTC (rev 92943)
@@ -25,7 +25,7 @@
import ZEO.hash
def session_key(username, realm, password):
- return hash("%s:%s:%s" % (username, realm, password)).hexdigest()
+ return sha1("%s:%s:%s" % (username, realm, password)).hexdigest()
class StorageClass(ZEOStorage):
@@ -35,7 +35,7 @@
except LookupError:
return 0
- password_dig = hash(password).hexdigest()
+ password_dig = sha1(password).hexdigest()
if dbpw == password_dig:
self.connection.setSessionKey(session_key(username,
self.database.realm,
Modified: ZODB/branches/matt-python2.6/src/ZEO/zrpc/smac.py
===================================================================
--- ZODB/branches/matt-python2.6/src/ZEO/zrpc/smac.py 2008-11-14 20:28:55 UTC (rev 92942)
+++ ZODB/branches/matt-python2.6/src/ZEO/zrpc/smac.py 2008-11-14 21:32:41 UTC (rev 92943)
@@ -147,8 +147,8 @@
# and thus iterator, because it contains a yield statement.
def hack():
- self.__hmac_send = hmac.HMAC(sesskey, digestmod=hash)
- self.__hmac_recv = hmac.HMAC(sesskey, digestmod=hash)
+ self.__hmac_send = hmac.HMAC(sesskey, digestmod=sha1)
+ self.__hmac_recv = hmac.HMAC(sesskey, digestmod=sha1)
if False:
yield ''
More information about the Zodb-checkins
mailing list