Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
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
?
Snippets
Groups
Projects
Show more breadcrumbs
misc
pymilter
Commits
a20eeda0
Commit
a20eeda0
authored
19 years ago
by
Stuart Gathman
Browse files
Options
Downloads
Patches
Plain Diff
More delayed reject token headers.
Don't require HELO pass for CBV.
parent
d50215d0
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
bms.py
+37
-22
37 additions, 22 deletions
bms.py
with
37 additions
and
22 deletions
bms.py
+
37
−
22
View file @
a20eeda0
#!/usr/bin/env python
#!/usr/bin/env python
# A simple milter that has grown quite a bit.
# A simple milter that has grown quite a bit.
# $Log$
# $Log$
# Revision 1.63 2006/05/21 03:41:44 customdesigned
# Fail dsn
#
# Revision 1.61 2006/05/17 21:28:07 customdesigned
# Revision 1.61 2006/05/17 21:28:07 customdesigned
# Create GOSSiP record only when connection will procede to DATA.
# Create GOSSiP record only when connection will procede to DATA.
#
#
...
@@ -1007,7 +1010,8 @@ class bmsMilter(Milter.Milter):
...
@@ -1007,7 +1010,8 @@ class bmsMilter(Milter.Milter):
if
hres
==
'
none
'
and
spf_best_guess
\
if
hres
==
'
none
'
and
spf_best_guess
\
and
not
dynip
(
self
.
hello_name
,
self
.
connectip
):
and
not
dynip
(
self
.
hello_name
,
self
.
connectip
):
hres
,
hcode
,
htxt
=
h
.
best_guess
()
hres
,
hcode
,
htxt
=
h
.
best_guess
()
else
:
hres
=
res
else
:
hres
,
hcode
,
htxt
=
res
,
code
,
txt
ores
=
res
ores
=
res
if
spf_best_guess
and
res
==
'
none
'
:
if
spf_best_guess
and
res
==
'
none
'
:
#self.log('SPF: no record published, guessing')
#self.log('SPF: no record published, guessing')
...
@@ -1021,6 +1025,7 @@ class bmsMilter(Milter.Milter):
...
@@ -1021,6 +1025,7 @@ class bmsMilter(Milter.Milter):
res
,
code
,
txt
=
q
.
best_guess
()
res
,
code
,
txt
=
q
.
best_guess
()
if
self
.
missing_ptr
and
ores
==
'
none
'
and
res
!=
'
pass
'
\
if
self
.
missing_ptr
and
ores
==
'
none
'
and
res
!=
'
pass
'
\
and
hres
!=
'
pass
'
:
and
hres
!=
'
pass
'
:
# this bad boy has no credentials whatsoever
policy
=
p
.
getNonePolicy
()
policy
=
p
.
getNonePolicy
()
if
policy
==
'
CBV
'
:
if
policy
==
'
CBV
'
:
if
self
.
mailfrom
!=
'
<>
'
:
if
self
.
mailfrom
!=
'
<>
'
:
...
@@ -1037,7 +1042,7 @@ class bmsMilter(Milter.Milter):
...
@@ -1037,7 +1042,7 @@ class bmsMilter(Milter.Milter):
return
Milter
.
REJECT
return
Milter
.
REJECT
if
res
in
(
'
deny
'
,
'
fail
'
):
if
res
in
(
'
deny
'
,
'
fail
'
):
policy
=
p
.
getFailPolicy
()
policy
=
p
.
getFailPolicy
()
if
hres
==
'
pass
'
and
policy
==
'
CBV
'
:
if
policy
==
'
CBV
'
:
if
self
.
mailfrom
!=
'
<>
'
:
if
self
.
mailfrom
!=
'
<>
'
:
self
.
cbv_needed
=
(
q
,
res
)
self
.
cbv_needed
=
(
q
,
res
)
elif
policy
!=
'
OK
'
:
elif
policy
!=
'
OK
'
:
...
@@ -1049,7 +1054,7 @@ class bmsMilter(Milter.Milter):
...
@@ -1049,7 +1054,7 @@ class bmsMilter(Milter.Milter):
return
Milter
.
REJECT
return
Milter
.
REJECT
if
res
==
'
softfail
'
:
if
res
==
'
softfail
'
:
policy
=
p
.
getSoftfailPolicy
()
policy
=
p
.
getSoftfailPolicy
()
if
policy
==
'
CBV
'
and
hres
==
'
pass
'
:
if
policy
==
'
CBV
'
:
if
self
.
mailfrom
!=
'
<>
'
:
if
self
.
mailfrom
!=
'
<>
'
:
self
.
cbv_needed
=
(
q
,
res
)
self
.
cbv_needed
=
(
q
,
res
)
elif
policy
!=
'
OK
'
:
elif
policy
!=
'
OK
'
:
...
@@ -1064,7 +1069,7 @@ class bmsMilter(Milter.Milter):
...
@@ -1064,7 +1069,7 @@ class bmsMilter(Milter.Milter):
return
Milter
.
REJECT
return
Milter
.
REJECT
if
res
==
'
neutral
'
:
if
res
==
'
neutral
'
:
policy
=
p
.
getNeutralPolicy
()
policy
=
p
.
getNeutralPolicy
()
if
policy
==
'
CBV
'
and
hres
==
'
pass
'
:
if
policy
==
'
CBV
'
:
if
self
.
mailfrom
!=
'
<>
'
:
if
self
.
mailfrom
!=
'
<>
'
:
self
.
cbv_needed
=
(
q
,
res
)
self
.
cbv_needed
=
(
q
,
res
)
# FIXME: this makes Received-SPF show wrong result
# FIXME: this makes Received-SPF show wrong result
...
@@ -1081,7 +1086,7 @@ class bmsMilter(Milter.Milter):
...
@@ -1081,7 +1086,7 @@ class bmsMilter(Milter.Milter):
return
Milter
.
REJECT
return
Milter
.
REJECT
if
res
in
(
'
unknown
'
,
'
permerror
'
):
if
res
in
(
'
unknown
'
,
'
permerror
'
):
policy
=
p
.
getPermErrorPolicy
()
policy
=
p
.
getPermErrorPolicy
()
if
policy
==
'
CBV
'
and
hres
==
'
pass
'
:
if
policy
==
'
CBV
'
:
if
self
.
mailfrom
!=
'
<>
'
:
if
self
.
mailfrom
!=
'
<>
'
:
self
.
cbv_needed
=
(
q
,
res
)
self
.
cbv_needed
=
(
q
,
res
)
elif
policy
!=
'
OK
'
:
elif
policy
!=
'
OK
'
:
...
@@ -1565,7 +1570,10 @@ class bmsMilter(Milter.Milter):
...
@@ -1565,7 +1570,10 @@ class bmsMilter(Milter.Milter):
if
self
.
delayed_failure
:
if
self
.
delayed_failure
:
self
.
fp
.
seek
(
0
)
self
.
fp
.
seek
(
0
)
for
ln
in
self
.
fp
:
for
ln
in
self
.
fp
:
if
ln
.
lower
().
startswith
(
'
message-id:
'
):
# FIXME: handle multi-line header field
lnl
=
ln
.
lower
()
for
k
in
(
'
message-id
'
,
'
x-mailer
'
,
'
sender
'
):
if
lnl
.
startswith
(
k
):
name
,
val
=
ln
.
split
(
None
,
1
)
name
,
val
=
ln
.
split
(
None
,
1
)
pos
=
val
.
find
(
'
<SRS
'
)
pos
=
val
.
find
(
'
<SRS
'
)
if
pos
>=
0
:
if
pos
>=
0
:
...
@@ -1738,9 +1746,16 @@ class bmsMilter(Milter.Milter):
...
@@ -1738,9 +1746,16 @@ class bmsMilter(Milter.Milter):
except
IOError
:
template
=
None
except
IOError
:
template
=
None
m
=
dsn
.
create_msg
(
q
,
self
.
recipients
,
msg
,
template
)
m
=
dsn
.
create_msg
(
q
,
self
.
recipients
,
msg
,
template
)
if
srs
:
if
srs
:
# Add SRS coded sender to various headers. When (incorrectly)
# replying to our DSN, any of these which are preserved
# allow us to track the source.
msgid
=
srs
.
forward
(
sender
,
self
.
receiver
)
msgid
=
srs
.
forward
(
sender
,
self
.
receiver
)
m
.
add_header
(
'
Message-Id
'
,
'
<%s>
'
%
msgid
)
m
.
add_header
(
'
Message-Id
'
,
'
<%s>
'
%
msgid
)
#m.add_header('Sender','"Python Milter" <%s>'%msgid)
if
'
x-mailer
'
in
m
:
m
.
replace_header
(
'
x-mailer
'
,
'"
%s
"
<%s>
'
%
(
m
[
'
x-mailer
'
],
msgid
))
else
:
m
.
add_header
(
'
X-Mailer
'
,
'"
Python Milter
"
<%s>
'
%
msgid
)
m
.
add_header
(
'
Sender
'
,
'"
Python Milter
"
<%s>
'
%
msgid
)
m
=
m
.
as_string
()
m
=
m
.
as_string
()
print
>>
open
(
template_name
+
'
.last_dsn
'
,
'
w
'
),
m
print
>>
open
(
template_name
+
'
.last_dsn
'
,
'
w
'
),
m
res
=
dsn
.
send_dsn
(
sender
,
self
.
receiver
,
m
)
res
=
dsn
.
send_dsn
(
sender
,
self
.
receiver
,
m
)
...
...
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
register
or
sign in
to comment