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
053734d4
Commit
053734d4
authored
20 years ago
by
Stuart Gathman
Browse files
Options
Downloads
Patches
Plain Diff
Record timestamp in send_dsn.log
parent
56f1f58b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bms.py
+19
-4
19 additions, 4 deletions
bms.py
with
19 additions
and
4 deletions
bms.py
+
19
−
4
View file @
053734d4
#!/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.2 2005/06/02 01:00:36 customdesigned
# Support configurable templates for DSNs.
#
#
#
# Revision 1.134 2005/05/25 15:36:43 stuart
# Revision 1.134 2005/05/25 15:36:43 stuart
# Use dynip module.
# Use dynip module.
...
@@ -254,11 +257,20 @@ spf_accept_softfail = ()
...
@@ -254,11 +257,20 @@ spf_accept_softfail = ()
spf_best_guess
=
False
spf_best_guess
=
False
spf_reject_noptr
=
False
spf_reject_noptr
=
False
multiple_bounce_recipients
=
True
multiple_bounce_recipients
=
True
time_format
=
'
%Y%b%d %H:%M:%S %Z
'
timeout
=
600
timeout
=
600
cbv_cache
=
{}
cbv_cache
=
{}
try
:
try
:
for
rcpt
in
open
(
'
send_dsn.log
'
):
too_old
=
time
.
time
()
-
30
*
24
*
60
*
60
# 30 days
cbv_cache
[
rcpt
.
strip
()]
=
None
for
ln
in
open
(
'
send_dsn.log
'
):
try
:
rcpt
,
ts
=
ln
.
strip
().
split
(
None
,
1
)
l
=
time
.
strptime
(
ts
,
time_format
)
t
=
time
.
mktime
(
l
)
if
t
>
too_old
:
cbv_cache
[
rcpt
]
=
None
except
:
cbv_cache
[
ln
.
strip
()]
=
None
except
IOError
:
pass
except
IOError
:
pass
class
MilterConfigParser
(
ConfigParser
.
ConfigParser
):
class
MilterConfigParser
(
ConfigParser
.
ConfigParser
):
...
@@ -677,7 +689,8 @@ class bmsMilter(Milter.Milter):
...
@@ -677,7 +689,8 @@ class bmsMilter(Milter.Milter):
if
res
==
'
error
'
:
if
res
==
'
error
'
:
if
code
>=
500
:
if
code
>=
500
:
self
.
log
(
'
REJECT: SPF %s %i %s
'
%
(
res
,
code
,
txt
))
self
.
log
(
'
REJECT: SPF %s %i %s
'
%
(
res
,
code
,
txt
))
self
.
setreply
(
str
(
code
),
'
5.7.1
'
,
txt
)
# latest SPF draft recommends 5.5.2 instead of 5.7.1
self
.
setreply
(
str
(
code
),
'
5.5.2
'
,
txt
)
return
Milter
.
REJECT
return
Milter
.
REJECT
self
.
log
(
'
TEMPFAIL: SPF %s %i %s
'
%
(
res
,
code
,
txt
))
self
.
log
(
'
TEMPFAIL: SPF %s %i %s
'
%
(
res
,
code
,
txt
))
self
.
setreply
(
str
(
code
),
'
4.3.0
'
,
txt
)
self
.
setreply
(
str
(
code
),
'
4.3.0
'
,
txt
)
...
@@ -1077,13 +1090,15 @@ class bmsMilter(Milter.Milter):
...
@@ -1077,13 +1090,15 @@ class bmsMilter(Milter.Milter):
self
.
log
(
'
TEMPFAIL:
'
,
desc
)
self
.
log
(
'
TEMPFAIL:
'
,
desc
)
self
.
setreply
(
'
450
'
,
'
4.2.0
'
,
*
desc
.
splitlines
())
self
.
setreply
(
'
450
'
,
'
4.2.0
'
,
*
desc
.
splitlines
())
return
Milter
.
TEMPFAIL
return
Milter
.
TEMPFAIL
if
len
(
res
)
<
3
:
res
+=
time
.
time
(),
cbv_cache
[
sender
]
=
res
cbv_cache
[
sender
]
=
res
self
.
log
(
'
REJECT:
'
,
desc
)
self
.
log
(
'
REJECT:
'
,
desc
)
self
.
setreply
(
'
550
'
,
'
5.7.1
'
,
*
desc
.
splitlines
())
self
.
setreply
(
'
550
'
,
'
5.7.1
'
,
*
desc
.
splitlines
())
return
Milter
.
REJECT
return
Milter
.
REJECT
cbv_cache
[
sender
]
=
res
cbv_cache
[
sender
]
=
res
if
not
cached
:
if
not
cached
:
print
>>
open
(
'
send_dsn.log
'
,
'
a
'
),
sender
# log who we sent DSNs to
s
=
time
.
strftime
(
time_format
,
time
.
localtime
())
print
>>
open
(
'
send_dsn.log
'
,
'
a
'
),
sender
,
s
# log who we sent DSNs to
self
.
cbv_needed
=
None
self
.
cbv_needed
=
None
if
not
defanged
and
not
spam_checked
:
if
not
defanged
and
not
spam_checked
:
...
...
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