diff options
author | Barry Warsaw <barry@list.org> | 2008-11-12 23:02:29 -0500 |
---|---|---|
committer | Barry Warsaw <barry@list.org> | 2008-11-12 23:02:29 -0500 |
commit | a86be44b08fe0935fe77d90948b9baad85af3624 (patch) | |
tree | cc9b8b20530f1d54975005d19f9a17fddade945d /bin | |
parent | 392554b8de4641c8ac9c5ca1e062919a64ecd020 (diff) | |
download | mailman2-a86be44b08fe0935fe77d90948b9baad85af3624.tar.gz mailman2-a86be44b08fe0935fe77d90948b9baad85af3624.tar.xz mailman2-a86be44b08fe0935fe77d90948b9baad85af3624.zip |
Apply Heiko Rommel's patch for hashlib deprecation warnings for bug 293178.
I've modified the patch to improve some of the stylistic issues.
Diffstat (limited to '')
-rw-r--r-- | bin/change_pw | 7 | ||||
-rw-r--r-- | bin/export.py | 7 | ||||
-rwxr-xr-x | bin/newlist | 8 | ||||
-rwxr-xr-x | bin/update | 13 |
4 files changed, 16 insertions, 19 deletions
diff --git a/bin/change_pw b/bin/change_pw index 965f5e50..67d56392 100644 --- a/bin/change_pw +++ b/bin/change_pw @@ -1,6 +1,6 @@ #! @PYTHON@ # -# Copyright (C) 2001-2007 by the Free Software Foundation, Inc. +# Copyright (C) 2001-2008 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -66,7 +66,6 @@ Options: """ import sys -import sha import getopt import paths @@ -147,7 +146,7 @@ def main(): if password is not None: if not password: usage(1, _('Empty list passwords are not allowed')) - shapassword = sha.new(password).hexdigest() + shapassword = Utils.sha_new(password).hexdigest() if domains: for name in Utils.list_names(): @@ -167,7 +166,7 @@ def main(): if password is None: randompw = Utils.MakeRandomPassword( mm_cfg.ADMIN_PASSWORD_LENGTH) - shapassword = sha.new(randompw).hexdigest() + shapassword = Utils.sha_new(randompw).hexdigest() notifypassword = randompw else: notifypassword = password diff --git a/bin/export.py b/bin/export.py index c8d890eb..122ce8de 100644 --- a/bin/export.py +++ b/bin/export.py @@ -1,6 +1,6 @@ #! @PYTHON@ # -# Copyright (C) 2006-2007 by the Free Software Foundation, Inc. +# Copyright (C) 2006-2008 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -21,7 +21,6 @@ import os import sys -import sha import base64 import codecs import datetime @@ -289,13 +288,13 @@ def plaintext_password(password): def sha_password(password): - h = sha.new(password) + h = Utils.sha_new(password) return '{SHA}' + base64.b64encode(h.digest()) def ssha_password(password): salt = os.urandom(SALT_LENGTH) - h = sha.new(password) + h = Utils.sha_new(password) h.update(salt) return '{SSHA}' + base64.b64encode(h.digest() + salt) diff --git a/bin/newlist b/bin/newlist index 08b86e08..ab350c88 100755 --- a/bin/newlist +++ b/bin/newlist @@ -1,6 +1,6 @@ #! @PYTHON@ # -# Copyright (C) 1998-2005 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2008 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -14,7 +14,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Create a new, unpopulated mailing list. @@ -93,7 +94,6 @@ import sys import os import getpass import getopt -import sha import paths from Mailman import mm_cfg @@ -186,7 +186,7 @@ def main(): mlist = MailList.MailList() try: - pw = sha.new(listpasswd).hexdigest() + pw = Utils.sha_new(listpasswd).hexdigest() # Guarantee that all newly created files have the proper permission. # proper group ownership should be assured by the autoconf script # enforcing that all directories have the group sticky bit set @@ -34,7 +34,6 @@ some previous version. It knows about versions back to 1.0b4 (?). """ import os -import md5 import sys import time import errno @@ -131,7 +130,7 @@ def move_language_templates(mlist): # No global template continue - gcksum = md5.new(fp.read()).digest() + gcksum = Utils.md5_new(fp.read()).digest() fp.close() # Match against the lists/<list>/* template try: @@ -139,7 +138,7 @@ def move_language_templates(mlist): except IOError, e: if e.errno <> errno.ENOENT: raise else: - tcksum = md5.new(fp.read()).digest() + tcksum = Utils.md5_new(fp.read()).digest() fp.close() if gcksum == tcksum: os.unlink(os.path.join(mlist.fullpath(), gtemplate)) @@ -149,7 +148,7 @@ def move_language_templates(mlist): except IOError, e: if e.errno <> errno.ENOENT: raise else: - tcksum = md5.new(fp.read()).digest() + tcksum = Utils.md5_new(fp.read()).digest() fp.close() if gcksum == tcksum: os.unlink(os.path.join(mlist.fullpath(), gtemplate + '.prev')) @@ -159,7 +158,7 @@ def move_language_templates(mlist): except IOError, e: if e.errno <> errno.ENOENT: raise else: - tcksum = md5.new(fp.read()).digest() + tcksum = Utils.md5_new(fp.read()).digest() fp.close() if gcksum == tcksum: os.unlink(os.path.join(mlist.fullpath(), 'en', gtemplate)) @@ -169,7 +168,7 @@ def move_language_templates(mlist): except IOError, e: if e.errno <> errno.ENOENT: raise else: - tcksum = md5.new(fp.read()).digest() + tcksum = Utils.md5_new(fp.read()).digest() fp.close() if gcksum == tcksum: os.unlink(os.path.join(mm_cfg.TEMPLATE_DIR, gtemplate)) @@ -179,7 +178,7 @@ def move_language_templates(mlist): except IOError, e: if e.errno <> errno.ENOENT: raise else: - tcksum = md5.new(fp.read()).digest() + tcksum = Utils.md5_new(fp.read()).digest() fp.close() if gcksum == tcksum: os.unlink(os.path.join(mm_cfg.TEMPLATE_DIR, |