Skip to main content
Homepage
Explore
Search or go to…
/
Sign in
Explore
Primary navigation
Project
P
pymilter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Collapse sidebar
Snippets
Groups
Projects
Show more breadcrumbs
misc
pymilter
Commits
23485978
Commit
23485978
authored
Jul 15, 2005
by
Stuart Gathman
Browse files
Options
Downloads
Patches
Plain Diff
Latest pyspf updates
parent
e1f4744a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
spf.py
+28
-8
28 additions, 8 deletions
spf.py
with
28 additions
and
8 deletions
spf.py
+
28
−
8
View file @
23485978
...
...
@@ -47,6 +47,12 @@ For news, bugfixes, etc. visit the home page for this implementation at
# Terrence is not responding to email.
#
# $Log$
# Revision 1.15 2005/07/15 21:17:36 customdesigned
# Recursion limit raises AssertionError in strict mode, PermError otherwise.
#
# Revision 1.14 2005/07/15 20:34:11 customdesigned
# Check whether DNS package already supports SPF before patching
#
# Revision 1.13 2005/07/15 20:01:22 customdesigned
# Allow extended results for MX limit
#
...
...
@@ -199,7 +205,8 @@ import struct # for pack() and unpack()
import
time
# for time()
import
DNS
# http://pydns.sourceforge.net
# patch in type99
if
not
hasattr
(
DNS
.
Type
,
'
SPF
'
):
# patch in type99 support
DNS
.
Type
.
SPF
=
99
DNS
.
Type
.
typemap
[
99
]
=
'
SPF
'
DNS
.
Lib
.
RRunpacker
.
getSPFdata
=
DNS
.
Lib
.
RRunpacker
.
getTXTdata
...
...
@@ -385,8 +392,16 @@ class query(object):
# spf rfc: 3.7 Processing Limits
#
if
recursion
>
MAX_RECURSION
:
self
.
prob
=
'
Too many levels of recursion
'
return
(
'
unknown
'
,
250
,
'
SPF recursion limit exceeded
'
)
# This should never happen in strict mode
# because of the other limits we check,
# so if it does, there is something wrong with
# our code. It is not a PermError because there is not
# necessarily anything wrong with the SPF record.
if
self
.
strict
:
raise
AssertionError
(
'
Too many levels of recursion
'
)
# As an extended result, however, it should be
# a PermError.
raise
PermError
(
'
Too many levels of recursion
'
)
try
:
tmp
,
self
.
d
=
self
.
d
,
domain
return
self
.
check0
(
spf
,
recursion
)
...
...
@@ -664,10 +679,12 @@ class query(object):
name. Returns None if not found, or if more than one record
is found.
"""
a
=
[
t
for
t
in
self
.
dns_99
(
domain
)
if
t
.
startswith
(
'
v=spf1
'
)]
# for performance, check for most common case of TXT first
a
=
[
t
for
t
in
self
.
dns_txt
(
domain
)
if
t
.
startswith
(
'
v=spf1
'
)]
if
len
(
a
)
==
1
:
return
a
[
0
]
a
=
[
t
for
t
in
self
.
dns_txt
(
domain
)
if
t
.
startswith
(
'
v=spf1
'
)]
# check official SPF type first when it becomes more popular
a
=
[
t
for
t
in
self
.
dns_99
(
domain
)
if
t
.
startswith
(
'
v=spf1
'
)]
if
len
(
a
)
==
1
:
return
a
[
0
]
if
DELEGATE
:
...
...
@@ -849,6 +866,9 @@ def parse_mechanism(str, d):
>>>
parse_mechanism
(
'
-exists:%{i}.%{s1}.100/86400.rate.%{d}
'
,
'
foo.com
'
)
(
'
-exists
'
,
'
%{i}.%{s1}.100/86400.rate.%{d}
'
,
32
)
>>>
parse_mechanism
(
'
mx::%%%_/.Claranet.de/27
'
,
'
foo.com
'
)
(
'
mx
'
,
'
:%%%_/.Claranet.de
'
,
27
)
"""
a
=
RE_CIDR
.
split
(
str
)
if
len
(
a
)
==
3
:
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment