Fix NO_SPACE_IN_FROM spam tag detection logic (fixes #2372)
This commit is contained in:
@@ -179,7 +179,12 @@ impl SpamFilterAnalyzeFrom for Server {
|
|||||||
// Validate space in FROM
|
// Validate space in FROM
|
||||||
if !from_name.is_empty()
|
if !from_name.is_empty()
|
||||||
&& !from_addr.address.is_empty()
|
&& !from_addr.address.is_empty()
|
||||||
&& !from_raw_utf8.contains(" <")
|
&& from_raw_utf8
|
||||||
|
.as_bytes()
|
||||||
|
.iter()
|
||||||
|
.position(|&b| b == b'<')
|
||||||
|
.and_then(|v| from_raw_utf8.as_bytes().get(v - 1))
|
||||||
|
.is_none_or(|v| !v.is_ascii_whitespace())
|
||||||
{
|
{
|
||||||
ctx.result.add_tag("NO_SPACE_IN_FROM");
|
ctx.result.add_tag("NO_SPACE_IN_FROM");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,6 +132,14 @@ expect NO_SPACE_IN_FROM FROM_EQ_ENV_FROM FROM_HAS_DN
|
|||||||
|
|
||||||
From: "Hello"<hello@domain.org>
|
From: "Hello"<hello@domain.org>
|
||||||
|
|
||||||
|
Test
|
||||||
|
<!-- NEXT TEST -->
|
||||||
|
envelope_from hello@domain.org
|
||||||
|
expect FROM_EQ_ENV_FROM FROM_HAS_DN
|
||||||
|
|
||||||
|
From: "Hello"
|
||||||
|
<hello@domain.org>
|
||||||
|
|
||||||
Test
|
Test
|
||||||
<!-- NEXT TEST -->
|
<!-- NEXT TEST -->
|
||||||
envelope_from hello@domain.org
|
envelope_from hello@domain.org
|
||||||
|
|||||||
@@ -78,8 +78,9 @@ category = 0
|
|||||||
confidence = 1
|
confidence = 1
|
||||||
explanation = 2
|
explanation = 2
|
||||||
|
|
||||||
[spam-filter.reputation]
|
[spam-filter.classifier.samples]
|
||||||
enable = true
|
min-ham = 10
|
||||||
|
min-spam = 10
|
||||||
|
|
||||||
[session.rcpt]
|
[session.rcpt]
|
||||||
relay = true
|
relay = true
|
||||||
|
|||||||
Reference in New Issue
Block a user