rpms/python-beaker/devel beaker-hmac2.4.patch, NONE, 1.1 python-beaker.spec, 1.10, 1.11
Toshio くらとみ
toshio at fedoraproject.org
Sat Jun 20 19:33:29 UTC 2009
- Previous message (by thread): rpms/pinentry/EL-5 pinentry.spec,1.14,1.15
- Next message (by thread): rpms/kernel/devel patch-2.6.30-git15.bz2.sign, NONE, 1.1 sched-introduce-SCHED_RESET_ON_FORK-scheduling-policy-flag.patch, NONE, 1.1 .cvsignore, 1.1081, 1.1082 config-generic, 1.290, 1.291 config-powerpc-generic, 1.45, 1.46 config-powerpc32-generic, 1.32, 1.33 kernel.spec, 1.1578, 1.1579 sources, 1.1039, 1.1040 upstream, 1.953, 1.954 patch-2.6.30-git14.bz2.sign, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: toshio
Update of /cvs/pkgs/rpms/python-beaker/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17839
Modified Files:
python-beaker.spec
Added Files:
beaker-hmac2.4.patch
Log Message:
* Sat Jun 20 2009 Toshio Kuratomi <toshio at fedoraproject.org> - 1.3.1-3
- Different hmac patch suitable for upstream inclusion.
beaker-hmac2.4.patch:
--- NEW FILE beaker-hmac2.4.patch ---
diff -up Beaker-1.3.1/beaker/crypto/pbkdf2.py.hmac Beaker-1.3.1/beaker/crypto/pbkdf2.py
--- Beaker-1.3.1/beaker/crypto/pbkdf2.py.hmac 2008-09-19 16:49:24.000000000 -0700
+++ Beaker-1.3.1/beaker/crypto/pbkdf2.py 2009-06-20 12:05:47.994184824 -0700
@@ -79,12 +79,16 @@ try:
except ImportError:
# PyCrypto not available. Use the Python standard library.
import hmac as HMAC
- try:
- from hashlib import sha1 as SHA1
- except ImportError:
+ import sys
+ # When using the stdlib, we have to make sure the hmac version and sha
+ # version are compatible
+ if sys.version_info[0:2] <= (2,4):
+ # hmac in python2.4 or less require the sha module
+ import sha as SHA1
+ else:
# NOTE: We have to use the callable with hashlib (hashlib.sha1),
# otherwise hmac only accepts the sha module object itself
- import sha as SHA1
+ from hashlib import sha1 as SHA1
def strxor(a, b):
return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a, b)])
diff -up Beaker-1.3.1/beaker/session.py.hmac Beaker-1.3.1/beaker/session.py
--- Beaker-1.3.1/beaker/session.py.hmac 2009-05-05 09:58:19.000000000 -0700
+++ Beaker-1.3.1/beaker/session.py 2009-06-20 12:04:36.435934313 -0700
@@ -6,12 +6,26 @@ import random
import time
from datetime import datetime, timedelta
try:
- from hashlib import md5, sha1
+ from hashlib import md5
except ImportError:
from md5 import md5
- # NOTE: We have to use the callable with hashlib (hashlib.sha1),
- # otherwise hmac only accepts the sha module object itself
- import sha as sha1
+try:
+ # Use PyCrypto (if available)
+ from Crypto.Hash import HMAC, SHA as SHA1
+
+except ImportError:
+ # PyCrypto not available. Use the Python standard library.
+ import hmac as HMAC
+ import sys
+ # When using the stdlib, we have to make sure the hmac version and sha
+ # version are compatible
+ if sys.version_info[0:2] <= (2,4):
+ # hmac in python2.4 or less require the sha module
+ import sha as SHA1
+ else:
+ # NOTE: We have to use the callable with hashlib (hashlib.sha1),
+ # otherwise hmac only accepts the sha module object itself
+ from hashlib import sha1 as SHA1
# Check for pycryptopp encryption for AES
try:
@@ -37,14 +51,14 @@ class SignedCookie(Cookie.BaseCookie):
def value_decode(self, val):
val = val.strip('"')
- sig = hmac.new(self.secret, val[40:], sha1).hexdigest()
+ sig = HMAC.new(self.secret, val[40:], SHA1).hexdigest()
if sig != val[:40]:
return None, val
else:
return val[40:], val
def value_encode(self, val):
- sig = hmac.new(self.secret, val, sha1).hexdigest()
+ sig = HMAC.new(self.secret, val, SHA1).hexdigest()
return str(val), ("%s%s" % (sig, val))
Index: python-beaker.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python-beaker/devel/python-beaker.spec,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -p -r1.10 -r1.11
--- python-beaker.spec 5 Jun 2009 13:50:01 -0000 1.10
+++ python-beaker.spec 20 Jun 2009 19:32:56 -0000 1.11
@@ -2,7 +2,7 @@
Name: python-beaker
Version: 1.3.1
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: WSGI middleware layer to provide sessions
Group: Development/Languages
@@ -12,7 +12,7 @@ Source0: http://pypi.python.org/packages
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python-setuptools-devel
-Patch0: %{name}-py2.4-hashlib.patch
+Patch0: beaker-hmac2.4.patch
%description
Beaker is a caching library that includes Session and Cache objects built on
@@ -22,9 +22,7 @@ manage Session objects and signed cookie
%prep
%setup -q -n Beaker-%{version}
-%if 0%{?fedora} <= 6
-%patch0 -p0 -b .hashlib
-%endif
+%patch0 -p1 -b .hashlib
%build
@@ -48,6 +46,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Sat Jun 20 2009 Toshio Kuratomi <toshio at fedoraproject.org> - 1.3.1-3
+- Different hmac patch suitable for upstream inclusion.
+
* Tue Jun 02 2009 Luke Macken <lmacken at redhat.com> - 1.3.1-2
- Add a patch to remove Beaker's use of hashlib on Python2.4,
due to incompatiblities with Python's hmac module (#503772)
- Previous message (by thread): rpms/pinentry/EL-5 pinentry.spec,1.14,1.15
- Next message (by thread): rpms/kernel/devel patch-2.6.30-git15.bz2.sign, NONE, 1.1 sched-introduce-SCHED_RESET_ON_FORK-scheduling-policy-flag.patch, NONE, 1.1 .cvsignore, 1.1081, 1.1082 config-generic, 1.290, 1.291 config-powerpc-generic, 1.45, 1.46 config-powerpc32-generic, 1.32, 1.33 kernel.spec, 1.1578, 1.1579 sources, 1.1039, 1.1040 upstream, 1.953, 1.954 patch-2.6.30-git14.bz2.sign, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list