Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
e48d4edf
Commit
e48d4edf
authored
Mar 30, 2009
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using ZEO.hash
parent
d66ad74a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
6 deletions
+33
-6
src/ZEO/hash.py
src/ZEO/hash.py
+29
-0
src/ZEO/tests/auth_plaintext.py
src/ZEO/tests/auth_plaintext.py
+4
-6
No files found.
src/ZEO/hash.py
0 → 100644
View file @
e48d4edf
##############################################################################
#
# Copyright (c) 2008 Zope Corporation 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.
#
##############################################################################
"""In Python 2.6, the "sha" and "md5" modules have been deprecated
in favor of using hashlib for both. This class allows for compatibility
between versions."""
import
sys
if
sys
.
version_info
[:
2
]
>=
(
2
,
6
):
import
hashlib
sha1
=
hashlib
.
sha1
new
=
sha1
else
:
import
sha
sha1
=
sha
.
new
new
=
sha1
digest_size
=
sha
.
digest_size
src/ZEO/tests/auth_plaintext.py
View file @
e48d4edf
...
@@ -19,17 +19,15 @@ This mechanism offers *no network security at all*; the only security
...
@@ -19,17 +19,15 @@ 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.
"""
"""
try
:
from
hashlib
import
sha1
as
sha
except
ImportError
:
import
sha
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
from
ZEO.hash
import
sha1
def
session_key
(
username
,
realm
,
password
):
def
session_key
(
username
,
realm
,
password
):
return
sha
.
new
(
"%s:%s:%s"
%
(
username
,
realm
,
password
)).
hexdigest
()
return
sha
1
.
new
(
"%s:%s:%s"
%
(
username
,
realm
,
password
)).
hexdigest
()
class
StorageClass
(
ZEOStorage
):
class
StorageClass
(
ZEOStorage
):
...
@@ -39,7 +37,7 @@ class StorageClass(ZEOStorage):
...
@@ -39,7 +37,7 @@ class StorageClass(ZEOStorage):
except
LookupError
:
except
LookupError
:
return
0
return
0
password_dig
=
sha
.
new
(
password
).
hexdigest
()
password_dig
=
sha
1
.
new
(
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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment