mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-02 13:14:39 +00:00
Skip IP fallback if harden enabled
This commit is contained in:
parent
f939072fca
commit
157f5a5c19
1 changed files with 19 additions and 18 deletions
|
@ -1019,27 +1019,28 @@ public class EmailService implements AutoCloseable {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Fallback: check server/certificate IP address
|
// Fallback: check server/certificate IP address
|
||||||
try {
|
if (!harden)
|
||||||
InetAddress ip = InetAddress.getByName(server);
|
try {
|
||||||
for (String name : names) {
|
InetAddress ip = InetAddress.getByName(server);
|
||||||
if (name.startsWith("*."))
|
for (String name : names) {
|
||||||
name = name.substring(2);
|
if (name.startsWith("*."))
|
||||||
|
name = name.substring(2);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (InetAddress addr : InetAddress.getAllByName(name))
|
for (InetAddress addr : InetAddress.getAllByName(name))
|
||||||
if (Arrays.equals(ip.getAddress(), addr.getAddress())) {
|
if (Arrays.equals(ip.getAddress(), addr.getAddress())) {
|
||||||
Log.i("Accepted " + name + " for " + server);
|
Log.i("Accepted " + name + " for " + server);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (UnknownHostException ex) {
|
} catch (UnknownHostException ex) {
|
||||||
Log.w(ex);
|
Log.w(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (UnknownHostException ex) {
|
||||||
|
Log.w(ex);
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.e(ex);
|
||||||
}
|
}
|
||||||
} catch (UnknownHostException ex) {
|
|
||||||
Log.w(ex);
|
|
||||||
} catch (Throwable ex) {
|
|
||||||
Log.e(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
String error = server + " not in certificate: " + TextUtils.join(",", names);
|
String error = server + " not in certificate: " + TextUtils.join(",", names);
|
||||||
Log.i(error);
|
Log.i(error);
|
||||||
|
|
Loading…
Reference in a new issue