Commit 282e2b19 authored by 's avatar

Made a change to allow zpasswd to accept lower case encoding names.

parent b3273ad2
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
############################################################################## ##############################################################################
"""Zope password change system""" """Zope password change system"""
__version__='$Revision: 1.6 $ '[11:-2] __version__='$Revision: 1.7 $ '[11:-2]
import sys, string, sha, binascii, whrandom, getopt, getpass, os import sys, string, sha, binascii, whrandom, getopt, getpass, os
...@@ -102,6 +102,7 @@ def generate_salt(): ...@@ -102,6 +102,7 @@ def generate_salt():
return whrandom.choice(salt_choices) return whrandom.choice(salt_choices)
def generate_passwd(password, encoding): def generate_passwd(password, encoding):
encoding=string.upper(encoding)
if encoding == 'SHA': if encoding == 'SHA':
pw = '{SHA}' + binascii.b2a_base64(sha.new(password).digest())[:-1] pw = '{SHA}' + binascii.b2a_base64(sha.new(password).digest())[:-1]
elif encoding == 'CRYPT': elif encoding == 'CRYPT':
......
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