Allow x= with no t= (it is legal)
This commit is contained in:
+16
-4
@@ -171,14 +171,26 @@ def validate_signature_fields(sig):
|
|||||||
"l= value is not a decimal integer (%s)" % sig[b'l'])
|
"l= value is not a decimal integer (%s)" % sig[b'l'])
|
||||||
if b'q' in sig and sig[b'q'] != b"dns/txt":
|
if b'q' in sig and sig[b'q'] != b"dns/txt":
|
||||||
raise ValidationError("q= value is not dns/txt (%s)" % sig[b'q'])
|
raise ValidationError("q= value is not dns/txt (%s)" % sig[b'q'])
|
||||||
if b't' in sig and re.match(br"\d+$", sig[b't']) is None:
|
now = int(time.time())
|
||||||
raise ValidationError(
|
slop = 36000 # 10H leeway for mailers with inaccurate clocks
|
||||||
"t= value is not a decimal integer (%s)" % sig[b't'])
|
t_sign = 0
|
||||||
|
if b't' in sig
|
||||||
|
if re.match(br"\d+$", sig[b't']) is None:
|
||||||
|
raise ValidationError(
|
||||||
|
"t= value is not a decimal integer (%s)" % sig[b't'])
|
||||||
|
t_sign = int(sig[b't'])
|
||||||
|
if t_sign > now + slop:
|
||||||
|
raise ValidationError(
|
||||||
|
"t= value is in the future (%s)" % sig[b't'])
|
||||||
if b'x' in sig:
|
if b'x' in sig:
|
||||||
if re.match(br"\d+$", sig[b'x']) is None:
|
if re.match(br"\d+$", sig[b'x']) is None:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
"x= value is not a decimal integer (%s)" % sig[b'x'])
|
"x= value is not a decimal integer (%s)" % sig[b'x'])
|
||||||
if int(sig[b'x']) < int(sig[b't']):
|
x_sign = int(sig[b'x'])
|
||||||
|
if x_sign < now - slop:
|
||||||
|
raise ValidationError(
|
||||||
|
"x= value is past (%s)" % sig[b'x'])
|
||||||
|
if x_sign < t_sign:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
"x= value is less than t= value (x=%s t=%s)" %
|
"x= value is less than t= value (x=%s t=%s)" %
|
||||||
(sig[b'x'], sig[b't']))
|
(sig[b'x'], sig[b't']))
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
%define __python python2.6
|
%define __python python2.6
|
||||||
%define pythonbase python26
|
%define pythonbase python
|
||||||
|
|
||||||
Summary: Python DKIM library
|
Summary: Python DKIM library
|
||||||
Name: %{pythonbase}-pydkim
|
Name: %{pythonbase}-pydkim
|
||||||
Version: 0.5.3
|
Version: 0.5.4
|
||||||
Release: 1
|
Release: 1
|
||||||
Source0: http://hewgill.com/pydkim/pydkim-%{version}.tar.bz2
|
Source0: http://hewgill.com/pydkim/pydkim-%{version}.tar.bz2
|
||||||
|
Patch: pydkim.patch
|
||||||
License: BSD-like
|
License: BSD-like
|
||||||
Group: Development/Libraries
|
Group: Development/Libraries
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
|
||||||
@@ -27,9 +28,10 @@ Python DKIM library
|
|||||||
%{__python} setup.py build
|
%{__python} setup.py build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
%{__python} setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
|
%{__python} setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
|
||||||
sed -i -e'/man1/d' INSTALLED_FILES
|
sed -i -e'/man1/d' INSTALLED_FILES
|
||||||
#grep '\.pyc$' INSTALLED_FILE | sed -e's/c$/o/' >>INSTALLED_FILES
|
#grep '\.pyc$' INSTALLED_FILES | sed -e's/c$/o/' >>INSTALLED_FILES
|
||||||
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man1
|
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man1
|
||||||
cp -p man/*.1 ${RPM_BUILD_ROOT}%{_mandir}/man1
|
cp -p man/*.1 ${RPM_BUILD_ROOT}%{_mandir}/man1
|
||||||
|
|
||||||
@@ -41,7 +43,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%doc ChangeLog README LICENSE TODO
|
%doc ChangeLog README LICENSE TODO
|
||||||
%{_mandir}/man1/dkimsign.1.gz
|
%{_mandir}/man1/dkimsign.1.gz
|
||||||
%{_mandir}/man1/dkimverify.1.gz
|
%{_mandir}/man1/dkimverify.1.gz
|
||||||
/usr/lib/%{__python}/site-packages/dkim/__main__.pyo
|
#/usr/lib/%{__python}/site-packages/dkim/__main__.pyo
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Sat Apr 21 2012 Stuart Gathman <stuart@bmsi.com> 0.5.3-1
|
* Sat Apr 21 2012 Stuart Gathman <stuart@bmsi.com> 0.5.3-1
|
||||||
|
|||||||
Reference in New Issue
Block a user