summaryrefslogtreecommitdiff
path: root/Mailman
diff options
context:
space:
mode:
authortkikuchi2007-03-03 03:19:21 +0000
committertkikuchi2007-03-03 03:19:21 +0000
commitef47275337f8a66d577489c1f0121087a713cf27 (patch)
tree2875093fbb3e524dc545053ad8a77fbd687da7cd /Mailman
parenta39a27fce459fb6fc4d0c1ee17ab571d51bf16bf (diff)
downloadmailman-ef47275337f8a66d577489c1f0121087a713cf27.tar.gz
mailman-ef47275337f8a66d577489c1f0121087a713cf27.tar.zst
mailman-ef47275337f8a66d577489c1f0121087a713cf27.zip
Some fixes for rev 8162 for mmsitepass to work.
emum.py: 'cls' is used instead of 'self' mmsitepass.py: SCHEMES -> Schemes passwords.py: make_secret is called with 'scheme' in string. decode() of challenge string fails if it is unicode.
Diffstat (limited to 'Mailman')
-rw-r--r--Mailman/bin/mmsitepass.py4
-rw-r--r--Mailman/enum.py4
-rw-r--r--Mailman/passwords.py5
3 files changed, 8 insertions, 5 deletions
diff --git a/Mailman/bin/mmsitepass.py b/Mailman/bin/mmsitepass.py
index 47f48b083..0246856bd 100644
--- a/Mailman/bin/mmsitepass.py
+++ b/Mailman/bin/mmsitepass.py
@@ -67,7 +67,7 @@ case-insensitive."""))
if len(args) > 1:
parser.error(_('Unexpected arguments'))
if opts.list_hash_schemes:
- for label in passwords.SCHEMES:
+ for label in passwords.Schemes:
print label.upper()
sys.exit(0)
return parser, opts, args
@@ -77,7 +77,7 @@ def check_password_scheme(parser, password_scheme):
# shoule be checked after config is loaded.
if password_scheme == '':
password_scheme = config.PASSWORD_SCHEME
- if password_scheme.lower() not in passwords.SCHEMES:
+ if password_scheme.lower() not in passwords.Schemes:
parser.error(_('Invalid password scheme'))
return password_scheme
diff --git a/Mailman/enum.py b/Mailman/enum.py
index fc05ff5b1..a42799f37 100644
--- a/Mailman/enum.py
+++ b/Mailman/enum.py
@@ -75,8 +75,8 @@ class EnumMetaclass(type):
return '<%s {%s}>' % (cls.__name__, COMMASPACE.join(enums))
def __iter__(cls):
- for i in sorted(self._enums):
- yield self._enums[i]
+ for i in sorted(cls._enums):
+ yield cls._enums[i]
def __getitem__(cls, i):
# i can be an integer or a string
diff --git a/Mailman/passwords.py b/Mailman/passwords.py
index e019d061e..2b7d38f2d 100644
--- a/Mailman/passwords.py
+++ b/Mailman/passwords.py
@@ -218,7 +218,7 @@ def make_secret(password, scheme=None):
# be a unicode.
if isinstance(password, unicode):
password = password.encode('utf-8')
- scheme_class = _SCHEMES_BY_ENUM.get(scheme, _DEFAULT_SCHEME)
+ scheme_class = _SCHEMES_BY_TAG.get(scheme, _DEFAULT_SCHEME)
secret = scheme_class.make_secret(password)
return '{%s}%s' % (scheme_class.TAG, secret)
@@ -236,4 +236,7 @@ def check_response(challenge, response):
scheme_parts = scheme_group.split()
scheme = scheme_parts[0].lower()
scheme_class = _SCHEMES_BY_TAG.get(scheme, _DEFAULT_SCHEME)
+ if isinstance(rest_group, unicode):
+ # decode() fails. (challenge is from database)
+ rest_group = str(rest_group)
return scheme_class.check_response(rest_group, response, *scheme_parts[1:])