Allow x= with no t= (it is legal)

This commit is contained in:
Stuart D. Gathman
2013-07-09 16:51:53 -04:00
parent 1e76d331fe
commit ed6a7f5454
2 changed files with 22 additions and 8 deletions
+16 -4
View File
@@ -171,14 +171,26 @@ def validate_signature_fields(sig):
"l= value is not a decimal integer (%s)" % sig[b'l'])
if b'q' in sig and sig[b'q'] != b"dns/txt":
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:
raise ValidationError(
"t= value is not a decimal integer (%s)" % sig[b't'])
now = int(time.time())
slop = 36000 # 10H leeway for mailers with inaccurate clocks
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 re.match(br"\d+$", sig[b'x']) is None:
raise ValidationError(
"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(
"x= value is less than t= value (x=%s t=%s)" %
(sig[b'x'], sig[b't']))
+6 -4
View File
@@ -1,11 +1,12 @@
%define __python python2.6
%define pythonbase python26
%define pythonbase python
Summary: Python DKIM library
Name: %{pythonbase}-pydkim
Version: 0.5.3
Version: 0.5.4
Release: 1
Source0: http://hewgill.com/pydkim/pydkim-%{version}.tar.bz2
Patch: pydkim.patch
License: BSD-like
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
@@ -27,9 +28,10 @@ Python DKIM library
%{__python} setup.py build
%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install --root=$RPM_BUILD_ROOT --record=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
cp -p man/*.1 ${RPM_BUILD_ROOT}%{_mandir}/man1
@@ -41,7 +43,7 @@ rm -rf $RPM_BUILD_ROOT
%doc ChangeLog README LICENSE TODO
%{_mandir}/man1/dkimsign.1.gz
%{_mandir}/man1/dkimverify.1.gz
/usr/lib/%{__python}/site-packages/dkim/__main__.pyo
#/usr/lib/%{__python}/site-packages/dkim/__main__.pyo
%changelog
* Sat Apr 21 2012 Stuart Gathman <stuart@bmsi.com> 0.5.3-1