[Python-modules-commits] r8786 - in packages/pyrad/trunk/debian/patches (1 file)
sharky at users.alioth.debian.org
sharky at users.alioth.debian.org
Fri Jun 12 15:12:37 UTC 2009
Date: Friday, June 12, 2009 @ 15:12:28
Author: sharky
Revision: 8786
improve patch
Modified:
packages/pyrad/trunk/debian/patches/01-python26_deprecation_warnings.patch
Modified: packages/pyrad/trunk/debian/patches/01-python26_deprecation_warnings.patch
===================================================================
--- packages/pyrad/trunk/debian/patches/01-python26_deprecation_warnings.patch 2009-06-12 14:48:50 UTC (rev 8785)
+++ packages/pyrad/trunk/debian/patches/01-python26_deprecation_warnings.patch 2009-06-12 15:12:28 UTC (rev 8786)
@@ -1,72 +1,78 @@
-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 @@
+diff -urN pyrad-1.1.orig/pyrad/packet.py pyrad-1.1/pyrad/packet.py
+--- pyrad-1.1.orig/pyrad/packet.py 2007-09-30 12:03:48.000000000 +0200
++++ pyrad-1.1/pyrad/packet.py 2009-06-12 17:06:56.000000000 +0200
+@@ -11,7 +11,13 @@
__docformat__ = "epytext en"
-import md5, struct, types, random, UserDict
-+import hashlib, struct, types, random, UserDict
++import struct, types, random, UserDict
++try:
++ import hashlib
++ md5_constructor = hashlib.md5
++except ImportError:
++ import md5
++ md5_constructor = md5.new
from pyrad import tools
# Packet codes
-@@ -249,7 +249,7 @@
+@@ -249,7 +255,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
++ authenticator=md5_constructor(header[0:4] + self.authenticator
+ attr + self.secret).digest()
return header + authenticator + attr
-@@ -262,7 +262,7 @@
+@@ -262,7 +268,7 @@
if rawreply is None:
rawreply=reply.ReplyPacket()
- hash=md5.new(rawreply[0:4] + self.authenticator +
-+ hash=hashlib.md5(rawreply[0:4] + self.authenticator +
++ hash=md5_constructor(rawreply[0:4] + self.authenticator +
rawreply[20:] + self.secret).digest()
if hash!=rawreply[4:20]:
-@@ -413,7 +413,7 @@
+@@ -413,7 +419,7 @@
last=self.authenticator
while buf:
- hash=md5.new(self.secret+last).digest()
-+ hash=hashlib.md5(self.secret+last).digest()
++ hash=md5_constructor(self.secret+last).digest()
for i in range(16):
pw+=chr(ord(hash[i]) ^ ord(buf[i]))
-@@ -447,12 +447,12 @@
+@@ -447,12 +453,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()
++ hash=md5_constructor(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()
++ hash=md5_constructor(self.secret+last).digest()
for i in range(16):
result+=chr(ord(hash[i]) ^ ord(buf[i]))
-@@ -494,7 +494,7 @@
+@@ -494,7 +500,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" +
++ hash=md5_constructor(self.raw_packet[0:4] + 16*"\x00" +
self.raw_packet[20:] + self.secret).digest()
return hash==self.authenticator
-@@ -517,7 +517,7 @@
+@@ -517,7 +523,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.authenticator=md5_constructor(header[0:4] + 16 * "\x00" + attr
+ self.secret).digest()
return header + self.authenticator + attr
More information about the Python-modules-commits
mailing list