Fix and test case for case insensitive subdomain matching.

This commit is contained in:
Stuart D Gathman
2015-08-06 22:24:34 -04:00
parent b8722f4a66
commit 01541a3c36
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -161,7 +161,7 @@ def validate_signature_fields(sig):
# Nasty hack to support both str and bytes... check for both the # Nasty hack to support both str and bytes... check for both the
# character and integer values. # character and integer values.
if b'i' in sig and ( if b'i' in sig and (
not sig[b'i'].endswith(sig[b'd']) or not sig[b'i'].lower().endswith(sig[b'd'].lower()) or
sig[b'i'][-len(sig[b'd'])-1] not in ('@', '.', 64, 46)): sig[b'i'][-len(sig[b'd'])-1] not in ('@', '.', 64, 46)):
raise ValidationError( raise ValidationError(
"i= domain is not a subdomain of d= (i=%s d=%s)" % "i= domain is not a subdomain of d= (i=%s d=%s)" %
+1
View File
@@ -232,6 +232,7 @@ b/mPfjC0QJTocVBq6Za/PlzfV+Py92VaCak19F4WrbVTK5Gg5tW220MCAwEAAQ==
b'bh': b'n0HUwGCP28PkesXBPH82Kboy8LhNFWU9zUISIpAez7M=', b'bh': b'n0HUwGCP28PkesXBPH82Kboy8LhNFWU9zUISIpAez7M=',
b'c': b'simple/simple', b'c': b'simple/simple',
b'd': b'kitterman.com', b'd': b'kitterman.com',
b'i': b'scott@Kitterman.com',
b'h': b'From:To:Subject:Date:Cc:MIME-Version:Content-Type:\n \t Content-Transfer-Encoding:Message-Id', b'h': b'From:To:Subject:Date:Cc:MIME-Version:Content-Type:\n \t Content-Transfer-Encoding:Message-Id',
b's': b'2007-00', b's': b'2007-00',
b't': b'1299525798'} b't': b'1299525798'}