mirror of
https://github.com/chatmail/core.git
synced 2026-05-25 01:36:31 +03:00
More small improvements
"alice@mailo.com/alice@mail.ru" was a really uninteresting file that needed a special-case in the test since for some reason, there just was no good Authentication-Results header
This commit is contained in:
@@ -516,18 +516,15 @@ Authentication-Results: box.hispanilandia.net; spf=pass smtp.mailfrom=adbenitez@
|
|||||||
|
|
||||||
let from_domain = EmailAddress::new(from).unwrap().domain;
|
let from_domain = EmailAddress::new(from).unwrap().domain;
|
||||||
let dkim_result = dkim_works(&t, &from_domain).await.unwrap();
|
let dkim_result = dkim_works(&t, &from_domain).await.unwrap();
|
||||||
|
|
||||||
// delta.blinzeln.de and gmx.de have invalid DKIM, so the DKIM check should fail
|
// delta.blinzeln.de and gmx.de have invalid DKIM, so the DKIM check should fail
|
||||||
let expected_result = (from_domain != "delta.blinzeln.de") && (from_domain != "gmx.de")
|
let expected_result = (from_domain != "delta.blinzeln.de") && (from_domain != "gmx.de")
|
||||||
// These are (fictional) forged emails where the attacker added a fake
|
// These are (fictional) forged emails where the attacker added a fake
|
||||||
// Authentication-Results before sending the email
|
// Authentication-Results before sending the email
|
||||||
&& from != "forged-authres-added@example.com"
|
&& from != "forged-authres-added@example.com"
|
||||||
// Other forged emails
|
// Other forged emails
|
||||||
&& !from.starts_with("forged")
|
&& !from.starts_with("forged");
|
||||||
&& !entry
|
|
||||||
.path()
|
|
||||||
.to_str()
|
|
||||||
.unwrap()
|
|
||||||
.ends_with("alice@mailo.com/alice@mail.ru");
|
|
||||||
if dkim_result != expected_result {
|
if dkim_result != expected_result {
|
||||||
if authres_parsing_works {
|
if authres_parsing_works {
|
||||||
println!(
|
println!(
|
||||||
@@ -554,7 +551,7 @@ Authentication-Results: box.hispanilandia.net; spf=pass smtp.mailfrom=adbenitez@
|
|||||||
|
|
||||||
// Even if the format is wrong and parsing fails, handle_authres() shouldn't
|
// Even if the format is wrong and parsing fails, handle_authres() shouldn't
|
||||||
// return an Err because this would prevent the message from being added
|
// return an Err because this would prevent the message from being added
|
||||||
// to the database and
|
// to the database and downloaded again and again
|
||||||
let bytes = b"Authentication-Results: dkim=";
|
let bytes = b"Authentication-Results: dkim=";
|
||||||
let mail = mailparse::parse_mail(bytes).unwrap();
|
let mail = mailparse::parse_mail(bytes).unwrap();
|
||||||
handle_authres(&t, &mail, "invalidfrom.com").await.unwrap();
|
handle_authres(&t, &mail, "invalidfrom.com").await.unwrap();
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
From: <alice@mail.ru>
|
|
||||||
To: <alice@mailo.com>
|
|
||||||
Authentication-Results: smtpng1.m.smailru.net; auth=pass smtp.auth=alice@mail.ru smtp.mailfrom=alice@mail.ru
|
|
||||||
Reference in New Issue
Block a user