mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 22:56:33 +02:00
TLS local
This commit is contained in:
@@ -509,7 +509,9 @@ public class ConnectionHelper {
|
||||
static boolean isLocalAddress(String host) {
|
||||
try {
|
||||
InetAddress addr = ConnectionHelper.from6to4(InetAddress.getByName(host));
|
||||
return (addr.isSiteLocalAddress() || addr.isLinkLocalAddress());
|
||||
return (addr.isLoopbackAddress() ||
|
||||
addr.isSiteLocalAddress() ||
|
||||
addr.isLinkLocalAddress());
|
||||
} catch (UnknownHostException ex) {
|
||||
Log.e(ex);
|
||||
return false;
|
||||
|
||||
@@ -2202,18 +2202,26 @@ public class MessageHelper {
|
||||
|
||||
private static boolean isLocal(String value) {
|
||||
if (value.contains("localhost") ||
|
||||
value.contains("[127.0.0.1]") ||
|
||||
value.contains("127.0.0.1") ||
|
||||
value.contains("[::1]"))
|
||||
return true;
|
||||
|
||||
int s = value.indexOf('[');
|
||||
int e = value.indexOf(']', s + 1);
|
||||
if (s >= 0 && e > 0) {
|
||||
String ip = value.substring(s + 1, e);
|
||||
if (ConnectionHelper.isNumericAddress(ip) &&
|
||||
ConnectionHelper.isLocalAddress(ip))
|
||||
return true;
|
||||
}
|
||||
|
||||
int f = value.indexOf(' ');
|
||||
String host = (f < 0 ? value : value.substring(0, f));
|
||||
if (ConnectionHelper.isNumericAddress(host)) {
|
||||
if (ConnectionHelper.isLocalAddress(host))
|
||||
return true;
|
||||
} else {
|
||||
if (!PatternsCompat.DOMAIN_NAME.matcher(host).matches())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user