diff options
| author | Barry Warsaw | 2008-10-16 00:48:15 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2008-10-16 00:48:15 -0400 |
| commit | a56897d1c541dd9b1db7af9b3568743dd73692de (patch) | |
| tree | 746540d9f7bcc4895f366fc0d45eb1284eee2103 | |
| parent | c7340d712c640fa5992518a7cf16272f634abccc (diff) | |
| download | mailman-a56897d1c541dd9b1db7af9b3568743dd73692de.tar.gz mailman-a56897d1c541dd9b1db7af9b3568743dd73692de.tar.zst mailman-a56897d1c541dd9b1db7af9b3568743dd73692de.zip | |
Target Python 2.6. Make the test suite pass without deprecations.
Diffstat (limited to '')
| -rw-r--r-- | .bzrignore | 2 | ||||
| -rw-r--r-- | mailman/Utils.py | 1 | ||||
| -rw-r--r-- | mailman/passwords.py | 12 | ||||
| -rw-r--r-- | mailman/pipeline/scrubber.py | 4 | ||||
| -rw-r--r-- | mailman/queue/__init__.py | 6 | ||||
| -rw-r--r-- | mailman/tests/test_security_mgr.py | 2 | ||||
| -rw-r--r-- | setup.py | 4 |
7 files changed, 14 insertions, 17 deletions
diff --git a/.bzrignore b/.bzrignore index d845e73db..2763fcac6 100644 --- a/.bzrignore +++ b/.bzrignore @@ -6,7 +6,7 @@ cron/crontab.in dist/ mailman.egg-info misc/mailman -setuptools_bzr-*.egg +setuptools* staging TAGS var/ diff --git a/mailman/Utils.py b/mailman/Utils.py index b9e34d5cd..607c457d9 100644 --- a/mailman/Utils.py +++ b/mailman/Utils.py @@ -25,7 +25,6 @@ the mailing lists, and whatever else doesn't belong elsewhere. import os import re import cgi -import sha import time import errno import base64 diff --git a/mailman/passwords.py b/mailman/passwords.py index 65bf8de05..1e46cd42e 100644 --- a/mailman/passwords.py +++ b/mailman/passwords.py @@ -22,8 +22,8 @@ Represents passwords using RFC 2307 syntax (as best we can tell). import os import re -import sha import hmac +import hashlib from array import array from base64 import urlsafe_b64decode as decode @@ -93,12 +93,12 @@ class SHAPasswordScheme(PasswordScheme): @staticmethod def make_secret(password): - h = sha.new(password) + h = hashlib.sha1(password) return encode(h.digest()) @staticmethod def check_response(challenge, response): - h = sha.new(response) + h = hashlib.sha1(response) return challenge == encode(h.digest()) @@ -109,7 +109,7 @@ class SSHAPasswordScheme(PasswordScheme): @staticmethod def make_secret(password): salt = os.urandom(SALT_LENGTH) - h = sha.new(password) + h = hashlib.sha1(password) h.update(salt) return encode(h.digest() + salt) @@ -119,7 +119,7 @@ class SSHAPasswordScheme(PasswordScheme): challenge_bytes = decode(challenge) digest = challenge_bytes[:20] salt = challenge_bytes[20:] - h = sha.new(response) + h = hashlib.sha1(response) h.update(salt) return digest == h.digest() @@ -139,7 +139,7 @@ class PBKDF2PasswordScheme(PasswordScheme): and a constant block counter appended to the salt in the initial hmac update. """ - h = hmac.new(password, None, sha) + h = hmac.new(password, None, hashlib.sha1) prf = h.copy() prf.update(salt + '\x00\x00\x00\x01') T = U = array('l', prf.digest()) diff --git a/mailman/pipeline/scrubber.py b/mailman/pipeline/scrubber.py index 8e2b1503e..a513d0689 100644 --- a/mailman/pipeline/scrubber.py +++ b/mailman/pipeline/scrubber.py @@ -25,9 +25,9 @@ __all__ = ['Scrubber'] import os import re -import sha import time import errno +import hashlib import logging import binascii @@ -140,7 +140,7 @@ def calculate_attachments_dir(mlist, msg, msgdata): if msgid is None: msgid = msg['Message-ID'] = make_msgid() # We assume that the message id actually /is/ unique! - digest = sha.new(msgid).hexdigest() + digest = hashlib.sha1(msgid).hexdigest() return os.path.join('attachments', datedir, digest[:4] + digest[-4:]) diff --git a/mailman/queue/__init__.py b/mailman/queue/__init__.py index 290f53978..58e8b84d2 100644 --- a/mailman/queue/__init__.py +++ b/mailman/queue/__init__.py @@ -34,12 +34,12 @@ __all__ = [ import os -import sha import time import email import errno import pickle import cPickle +import hashlib import logging import marshal import traceback @@ -53,7 +53,7 @@ from mailman import Utils from mailman.configuration import config from mailman.interfaces import IRunner, ISwitchboard -# 20 bytes of all bits set, maximum sha.digest() value +# 20 bytes of all bits set, maximum hashlib.sha.digest() value shamax = 0xffffffffffffffffffffffffffffffffffffffffL # Small increment to add to time in case two entries have the same time. This @@ -126,7 +126,7 @@ class Switchboard: # time for this message (i.e. when it first showed up on this system) # and the sha hex digest. rcvtime = data.setdefault('received_time', now) - filebase = repr(rcvtime) + '+' + sha.new(hashfood).hexdigest() + filebase = repr(rcvtime) + '+' + hashlib.sha1(hashfood).hexdigest() filename = os.path.join(self._whichq, filebase + '.pck') tmpfile = filename + '.tmp' # Always add the metadata schema version number diff --git a/mailman/tests/test_security_mgr.py b/mailman/tests/test_security_mgr.py index 3dde9dd2a..835530496 100644 --- a/mailman/tests/test_security_mgr.py +++ b/mailman/tests/test_security_mgr.py @@ -18,8 +18,6 @@ """Unit tests for the SecurityManager module.""" import os -import md5 -import sha import errno import Cookie import unittest @@ -27,8 +27,8 @@ from setuptools import setup, find_packages -if sys.hexversion < 0x20500f0: - print 'Mailman requires at least Python 2.5' +if sys.hexversion < 0x20600f0: + print 'Mailman requires at least Python 2.6' sys.exit(1) |
