[Zope-Checkins] CVS: ZODB3/ZEO/auth - __init__.py:1.2.8.1 auth_digest.py:1.3.8.1 base.py:1.2.8.1
Tim Peters
tim.one@comcast.net
Tue, 1 Jul 2003 16:57:42 -0400
Update of /cvs-repository/ZODB3/ZEO/auth
In directory cvs.zope.org:/tmp/cvs-serv9924/ZEO/auth
Modified Files:
Tag: zodb33-devel-branch
__init__.py auth_digest.py base.py
Log Message:
Whitespace normalization.
=== ZODB3/ZEO/auth/__init__.py 1.2 => 1.2.8.1 ===
--- ZODB3/ZEO/auth/__init__.py:1.2 Fri May 30 15:20:57 2003
+++ ZODB3/ZEO/auth/__init__.py Tue Jul 1 16:57:10 2003
@@ -28,4 +28,3 @@
if _auth_modules.has_key(name):
raise TypeError, "%s is already registred" % name
_auth_modules[name] = storage_class, client, db
-
=== ZODB3/ZEO/auth/auth_digest.py 1.3 => 1.3.8.1 ===
--- ZODB3/ZEO/auth/auth_digest.py:1.3 Fri May 30 15:26:42 2003
+++ ZODB3/ZEO/auth/auth_digest.py Tue Jul 1 16:57:10 2003
@@ -61,7 +61,7 @@
class DigestDatabase(Database):
def __init__(self, filename, realm=None):
Database.__init__(self, filename, realm)
-
+
# Initialize a key used to build the nonce for a challenge.
# We need one key for the lifetime of the server, so it
# is convenient to store in on the database.
@@ -134,7 +134,7 @@
raise AuthError("expected realm %r, got realm %r"
% (_realm, realm))
h_up = hexdigest("%s:%s:%s" % (username, realm, password))
-
+
resp_dig = hexdigest("%s:%s" % (h_up, challenge))
result = self.stub.auth_response((username, challenge, resp_dig))
if result:
=== ZODB3/ZEO/auth/base.py 1.2 => 1.2.8.1 ===
--- ZODB3/ZEO/auth/base.py:1.2 Fri May 30 15:20:57 2003
+++ ZODB3/ZEO/auth/base.py Tue Jul 1 16:57:10 2003
@@ -34,19 +34,19 @@
"""Sort a list in-place and return it."""
L.sort()
return L
-
+
class Database:
"""Abstracts a password database.
This class is used both in the authentication process (via
get_password()) and by client scripts that manage the password
- database file.
+ database file.
The password file is a simple, colon-separated text file mapping
usernames to password hashes. The hashes are SHA hex digests
produced from the password string.
"""
-
+
def __init__(self, filename, realm=None):
"""Creates a new Database
@@ -61,7 +61,7 @@
self.filename = filename
self.realm = realm
self.load()
-
+
def save(self, fd=None):
filename = self.filename
@@ -72,7 +72,7 @@
for username in sort(self._users.keys()):
print >> fd, "%s: %s" % (username, self._users[username])
-
+
def load(self):
filename = self.filename
if not filename:
@@ -80,13 +80,13 @@
if not os.path.exists(filename):
return
-
+
fd = open(filename)
L = fd.readlines()
if L[0].startswith("realm "):
line = L.pop(0).strip()
self.realm = line[len("realm "):]
-
+
for line in L:
username, hash = line.strip().split(":", 1)
self._users[username] = hash.strip()
@@ -99,10 +99,10 @@
Callers must check for LookupError, which is raised in
the case of a non-existent user specified."""
- if not self._users.has_key(username):
+ if not self._users.has_key(username):
raise LookupError, "No such user: %s" % username
return self._users[username]
-
+
def hash(self, s):
return sha.new(s).hexdigest()
@@ -112,7 +112,7 @@
self._store_password(username, password)
def del_user(self, username):
- if not self._users.has_key(username):
+ if not self._users.has_key(username):
raise LookupError, "No such user: %s" % username
del self._users[username]