Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 283629
Collapse All | Expand All

(-)a/server/filter.py (-3 / +3 lines)
Lines 427-433 Link Here
427
# In order to detect log rotation, the hash (MD5) of the first line of the file
427
# In order to detect log rotation, the hash (MD5) of the first line of the file
428
# is computed and compared to the previous hash of this line.
428
# is computed and compared to the previous hash of this line.
429
429
430
import md5
430
import hashlib
431
431
432
class FileContainer:
432
class FileContainer:
433
	
433
	
Lines 440-446 Link Here
440
		try:
440
		try:
441
			firstLine = handler.readline()
441
			firstLine = handler.readline()
442
			# Computes the MD5 of the first line.
442
			# Computes the MD5 of the first line.
443
			self.__hash = md5.new(firstLine).digest()
443
			self.__hash = hashlib.md5(firstLine).digest()
444
			# Start at the beginning of file if tail mode is off.
444
			# Start at the beginning of file if tail mode is off.
445
			if tail:
445
			if tail:
446
				handler.seek(0, 2)
446
				handler.seek(0, 2)
Lines 457-463 Link Here
457
		self.__handler = open(self.__filename)
457
		self.__handler = open(self.__filename)
458
		firstLine = self.__handler.readline()
458
		firstLine = self.__handler.readline()
459
		# Computes the MD5 of the first line.
459
		# Computes the MD5 of the first line.
460
		myHash = md5.new(firstLine).digest()
460
		myHash = hashlib.md5(firstLine).digest()
461
		# Compare hash.
461
		# Compare hash.
462
		if not self.__hash == myHash:
462
		if not self.__hash == myHash:
463
			logSys.info("Log rotation detected for %s" % self.__filename)
463
			logSys.info("Log rotation detected for %s" % self.__filename)

Return to bug 283629