mirror of
https://github.com/chatmail/relay.git
synced 2026-05-20 12:58:04 +00:00
filtermail: address hpk's comments
This commit is contained in:
@@ -34,7 +34,7 @@ def check_encrypted(message):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def check_passthrough(recipient):
|
def is_passthrough_recipient(recipient):
|
||||||
"""Check whether a recipient is configured as passthrough."""
|
"""Check whether a recipient is configured as passthrough."""
|
||||||
passthroughlist = ["privacy@testrun.org"]
|
passthroughlist = ["privacy@testrun.org"]
|
||||||
if recipient in passthroughlist:
|
if recipient in passthroughlist:
|
||||||
@@ -126,8 +126,8 @@ def check_DATA(envelope):
|
|||||||
if envelope.mail_from == recipient:
|
if envelope.mail_from == recipient:
|
||||||
# Always allow sending emails to self.
|
# Always allow sending emails to self.
|
||||||
continue
|
continue
|
||||||
if check_passthrough(recipient):
|
if is_passthrough_recipient(recipient):
|
||||||
# Always allow recipients marked as passthrough in chatmail.ini
|
# Always allow recipients marked as passthrough
|
||||||
continue
|
continue
|
||||||
res = recipient.split("@")
|
res = recipient.split("@")
|
||||||
if len(res) != 2:
|
if len(res) != 2:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from chatmaild.filtermail import check_encrypted, check_DATA, SendRateLimiter, check_mdn, check_passthrough
|
from chatmaild.filtermail import check_encrypted, check_DATA, SendRateLimiter, check_mdn, is_passthrough_recipient
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ def test_excempt_privacy(maildata, gencreds):
|
|||||||
to_addr = "privacy@testrun.org"
|
to_addr = "privacy@testrun.org"
|
||||||
false_to = "privacy@tstrn.org"
|
false_to = "privacy@tstrn.org"
|
||||||
false_to2 = "prvcy@testrun.org"
|
false_to2 = "prvcy@testrun.org"
|
||||||
assert check_passthrough(to_addr)
|
assert is_passthrough_recipient(to_addr)
|
||||||
|
|
||||||
msg = maildata("plain.eml", from_addr, to_addr)
|
msg = maildata("plain.eml", from_addr, to_addr)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user