mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-30 19:56:10 +00:00
Check for qmail / Postfix in first added received header only
This commit is contained in:
parent
c2a56ab69b
commit
3a7af8a57c
3 changed files with 10 additions and 9 deletions
4
FAQ.md
4
FAQ.md
|
@ -4479,8 +4479,8 @@ To show shields, the option *Show authentication status indicator* in the displa
|
|||
A message will be consired safely transported if *every* [Received](https://datatracker.ietf.org/doc/html/rfc2821#section-4.4) header:
|
||||
|
||||
* contains the phrase 'using TLS', 'via HTTP', 'version=TLS'
|
||||
* contains the phrase '(qmail <nnn> invoked by uid <nnn>)'
|
||||
* contains the phrase '(Postfix, from userid nnn)'
|
||||
* contains the phrase '(qmail <nnn> invoked by uid <nnn>)' in the first added header
|
||||
* contains the phrase '(Postfix, from userid nnn)' in the first added header
|
||||
* has a *by* with a local address
|
||||
* has a *by* xxx.google.com
|
||||
* has a *from* with a local address
|
||||
|
|
|
@ -2471,7 +2471,7 @@ public class HtmlHelper {
|
|||
j++;
|
||||
}
|
||||
|
||||
Boolean tls = MessageHelper.isTLS(h);
|
||||
Boolean tls = MessageHelper.isTLS(h, i == received.length - 1);
|
||||
ssb.append(" TLS=");
|
||||
int t = ssb.length();
|
||||
ssb.append(tls == null ? "?" : Boolean.toString(tls));
|
||||
|
|
|
@ -2076,10 +2076,10 @@ public class MessageHelper {
|
|||
|
||||
// First header is last added header
|
||||
Log.i("=======");
|
||||
for (String r : received) {
|
||||
String header = MimeUtility.unfold(r);
|
||||
for (int i = 0; i < received.length; i++) {
|
||||
String header = MimeUtility.unfold(received[i]);
|
||||
Log.i("--- header=" + header);
|
||||
Boolean tls = isTLS(header);
|
||||
Boolean tls = isTLS(header, i == received.length - 1);
|
||||
if (!Boolean.TRUE.equals(tls))
|
||||
return tls;
|
||||
}
|
||||
|
@ -2087,7 +2087,7 @@ public class MessageHelper {
|
|||
return true;
|
||||
}
|
||||
|
||||
static Boolean isTLS(String header) {
|
||||
static Boolean isTLS(String header, boolean first) {
|
||||
// Strip date
|
||||
int semi = header.lastIndexOf(';');
|
||||
if (semi > 0)
|
||||
|
@ -2102,8 +2102,9 @@ public class MessageHelper {
|
|||
|
||||
// (qmail nnn invoked by uid nnn); 1 Jan 2022 00:00:00 -0000
|
||||
// by <host name> (Postfix, from userid nnn)
|
||||
if (header.matches(".*\\(qmail \\d+ invoked by uid \\d+\\).*") ||
|
||||
header.matches(".*\\(Postfix, from userid \\d+\\).*")) {
|
||||
if (first &&
|
||||
(header.matches(".*\\(qmail \\d+ invoked by uid \\d+\\).*") ||
|
||||
header.matches(".*\\(Postfix, from userid \\d+\\).*"))) {
|
||||
Log.i("--- phrase");
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue