Commit 08cb0113 authored by Andreas Jung's avatar Andreas Jung

adjusted test to ZEO.hash

parent 6e167885
...@@ -19,14 +19,14 @@ This mechanism offers *no network security at all*; the only security ...@@ -19,14 +19,14 @@ This mechanism offers *no network security at all*; the only security
is provided by not storing plaintext passwords on disk. is provided by not storing plaintext passwords on disk.
""" """
import sha from ZEO.hash import sha1
from ZEO.StorageServer import ZEOStorage from ZEO.StorageServer import ZEOStorage
from ZEO.auth import register_module from ZEO.auth import register_module
from ZEO.auth.base import Client, Database from ZEO.auth.base import Client, Database
def session_key(username, realm, password): def session_key(username, realm, password):
return sha.new("%s:%s:%s" % (username, realm, password)).hexdigest() return sha1("%s:%s:%s" % (username, realm, password)).hexdigest()
class StorageClass(ZEOStorage): class StorageClass(ZEOStorage):
...@@ -36,7 +36,7 @@ class StorageClass(ZEOStorage): ...@@ -36,7 +36,7 @@ class StorageClass(ZEOStorage):
except LookupError: except LookupError:
return 0 return 0
password_dig = sha.new(password).hexdigest() password_dig = sha1(password).hexdigest()
if dbpw == password_dig: if dbpw == password_dig:
self.connection.setSessionKey(session_key(username, self.connection.setSessionKey(session_key(username,
self.database.realm, self.database.realm,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment