Wichert,
> Can you either email me that patch, or point me to a URL for it?
>
Sure, please find it attached.

Cheers,
Jeremy
diff -Nur -x '*.orig' -x '*~' pyrad-1.1/pyrad/packet.py pyrad-1.1.new/pyrad/packet.py
--- pyrad-1.1/pyrad/packet.py	2007-09-30 12:03:48.000000000 +0200
+++ pyrad-1.1.new/pyrad/packet.py	2009-06-12 08:01:05.911534696 +0200
@@ -11,7 +11,7 @@
 
 __docformat__	= "epytext en"
 
-import md5, struct, types, random, UserDict
+import hashlib, struct, types, random, UserDict
 from pyrad import tools
 
 # Packet codes
@@ -249,7 +249,7 @@
 		attr=self._PktEncodeAttributes()
 		header=struct.pack("!BBH", self.code, self.id, (20+len(attr)))
 
-		authenticator=md5.new(header[0:4] + self.authenticator
+		authenticator=hashlib.md5(header[0:4] + self.authenticator
 			+ attr + self.secret).digest()
 
 		return header + authenticator + attr
@@ -262,7 +262,7 @@
 		if rawreply is None:
 			rawreply=reply.ReplyPacket()
 		
-		hash=md5.new(rawreply[0:4] + self.authenticator + 
+		hash=hashlib.md5(rawreply[0:4] + self.authenticator + 
 			rawreply[20:] + self.secret).digest()
 
                 if hash!=rawreply[4:20]:
@@ -413,7 +413,7 @@
 
 		last=self.authenticator
 		while buf:
-			hash=md5.new(self.secret+last).digest()
+			hash=hashlib.md5(self.secret+last).digest()
 			for i in range(16):
 				pw+=chr(ord(hash[i]) ^ ord(buf[i]))
 
@@ -447,12 +447,12 @@
 		if len(password)%16!=0:
 			buf+="\x00" * (16-(len(password)%16))
 
-		hash=md5.new(self.secret+self.authenticator).digest()
+		hash=hashlib.md5(self.secret+self.authenticator).digest()
 		result=""
 
 		last=self.authenticator
 		while buf:
-			hash=md5.new(self.secret+last).digest()
+			hash=hashlib.md5(self.secret+last).digest()
 			for i in range(16):
 				result+=chr(ord(hash[i]) ^ ord(buf[i]))
 
@@ -494,7 +494,7 @@
                 @rtype: boolean
                 """
                 assert(self.raw_packet)
-                hash=md5.new(self.raw_packet[0:4] + 16*"\x00" + 
+                hash=hashlib.md5(self.raw_packet[0:4] + 16*"\x00" + 
                                 self.raw_packet[20:] + self.secret).digest()
 
                 return hash==self.authenticator
@@ -517,7 +517,7 @@
 
 		header=struct.pack("!BBH", self.code, self.id, (20+len(attr)))
 
-		self.authenticator=md5.new(header[0:4] + 16 * "\x00" + attr
+		self.authenticator=hashlib.md5(header[0:4] + 16 * "\x00" + attr
 			+ self.secret).digest()
 
 		return header + self.authenticator + attr

Reply via email to