|
|
|
@ -2055,7 +2055,15 @@ public class MessageHelper {
|
|
|
|
|
for (String r : received) {
|
|
|
|
|
String header = MimeUtility.unfold(r);
|
|
|
|
|
Log.i("--- header=" + header);
|
|
|
|
|
Boolean tls = isTLS(header);
|
|
|
|
|
if (!Boolean.TRUE.equals(tls))
|
|
|
|
|
return tls;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Boolean isTLS(String header) {
|
|
|
|
|
// Strip date
|
|
|
|
|
int semi = header.lastIndexOf(';');
|
|
|
|
|
if (semi > 0)
|
|
|
|
@ -2064,13 +2072,13 @@ public class MessageHelper {
|
|
|
|
|
if (header.contains("using TLS") ||
|
|
|
|
|
header.contains("version=TLS")) {
|
|
|
|
|
Log.i("--- found TLS");
|
|
|
|
|
continue;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (qmail nnn invoked by uid nnn); 1 Jan 2022 00:00:00 -0000
|
|
|
|
|
if (header.contains("qmail") && header.contains("invoked by uid")) {
|
|
|
|
|
Log.i("--- found qmail");
|
|
|
|
|
continue;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get key/values
|
|
|
|
@ -2100,7 +2108,7 @@ public class MessageHelper {
|
|
|
|
|
String by = kv.get("by").toString();
|
|
|
|
|
if (isLocal(by)) {
|
|
|
|
|
Log.i("--- local by=" + by);
|
|
|
|
|
continue;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2109,7 +2117,7 @@ public class MessageHelper {
|
|
|
|
|
String from = kv.get("from").toString();
|
|
|
|
|
if (isLocal(from)) {
|
|
|
|
|
Log.i("--- local from=" + from);
|
|
|
|
|
continue;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2119,7 +2127,7 @@ public class MessageHelper {
|
|
|
|
|
String via = kv.get("via").toString();
|
|
|
|
|
if ("Frontend Transport".equals(via)) {
|
|
|
|
|
Log.i("--- frontend via=" + via);
|
|
|
|
|
continue;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2138,20 +2146,20 @@ public class MessageHelper {
|
|
|
|
|
if ("local".equals(protocol)) {
|
|
|
|
|
// Exim
|
|
|
|
|
Log.i("--- local with=" + with);
|
|
|
|
|
continue;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ("mapi".equals(protocol)) {
|
|
|
|
|
// https://en.wikipedia.org/wiki/MAPI
|
|
|
|
|
Log.i("--- mapi with=" + with);
|
|
|
|
|
continue;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ("http".equals(protocol) ||
|
|
|
|
|
"httprest".equals(protocol)) {
|
|
|
|
|
// httprest by gmailapi.google.com
|
|
|
|
|
Log.i("--- http with=" + with);
|
|
|
|
|
continue;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!protocol.contains("mtp")) {
|
|
|
|
@ -2159,17 +2167,15 @@ public class MessageHelper {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!protocol.contains("mtps" /* STARTTLS */) &&
|
|
|
|
|
!protocol.contains("_mtpa" /* AUTH */)) {
|
|
|
|
|
if (protocol.contains("mtps")) {
|
|
|
|
|
Log.i("--- insecure with=" + with);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean isLocal(String value) {
|
|
|
|
|
private static boolean isLocal(String value) {
|
|
|
|
|
if (value.contains("localhost") ||
|
|
|
|
|
value.contains("[127.0.0.1]") ||
|
|
|
|
|
value.contains("[::1]"))
|
|
|
|
|