diff options
author | Markos Chandras <hwoarang@gentoo.org> | 2011-11-18 14:32:37 -0500 |
---|---|---|
committer | Yaroslav Halchenko <debian@onerussian.com> | 2011-11-18 14:32:37 -0500 |
commit | 492d8e5ff889d55024a1403a4239649eb9fb46b9 (patch) | |
tree | 82b2064cc08f049d47f8d22ce7d6da9d405d958b | |
parent | 5812abb98715dab761db940d7a5cb2cf1b4c4a61 (diff) | |
download | fail2ban-492d8e5ff889d55024a1403a4239649eb9fb46b9.tar.gz |
BF: use hashlib instead of deprecated md5
Bugfix revision. Fixes bug 260337,283629,301139,315073,343955. Thanks to Robert Trace <bugzilla-gentoo@farcaster.org>, Harley Peters <harley@thepetersclan.com> for the patches.
Picked up from
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-analyzer/fail2ban/files/fail2ban-0.8.4-hashlib.patch\?view\=markup
-rw-r--r-- | server/filter.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/filter.py b/server/filter.py index 38151d90..d170709e 100644 --- a/server/filter.py +++ b/server/filter.py @@ -446,7 +446,7 @@ class FileFilter(Filter): # In order to detect log rotation, the hash (MD5) of the first line of the file # is computed and compared to the previous hash of this line. -import md5 +import hashlib class FileContainer: @@ -461,7 +461,7 @@ class FileContainer: try: firstLine = handler.readline() # Computes the MD5 of the first line. - self.__hash = md5.new(firstLine).digest() + self.__hash = hashlib.md5(firstLine).digest() # Start at the beginning of file if tail mode is off. if tail: handler.seek(0, 2) @@ -481,7 +481,7 @@ class FileContainer: fcntl.fcntl(fd, fcntl.F_SETFD, fd | fcntl.FD_CLOEXEC) firstLine = self.__handler.readline() # Computes the MD5 of the first line. - myHash = md5.new(firstLine).digest() + myHash = hashlib.md5(firstLine).digest() stats = os.fstat(self.__handler.fileno()) # Compare hash and inode if self.__hash != myHash or self.__ino != stats.st_ino: |