mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-30 19:56:10 +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;
|
||||
|
||||
// Fallback: check server/certificate IP address
|
||||
try {
|
||||
InetAddress ip = InetAddress.getByName(server);
|
||||
for (String name : names) {
|
||||
if (name.startsWith("*."))
|
||||
name = name.substring(2);
|
||||
if (!harden)
|
||||
try {
|
||||
InetAddress ip = InetAddress.getByName(server);
|
||||
for (String name : names) {
|
||||
if (name.startsWith("*."))
|
||||
name = name.substring(2);
|
||||
|
||||
try {
|
||||
for (InetAddress addr : InetAddress.getAllByName(name))
|
||||
if (Arrays.equals(ip.getAddress(), addr.getAddress())) {
|
||||
Log.i("Accepted " + name + " for " + server);
|
||||
return;
|
||||
}
|
||||
} catch (UnknownHostException ex) {
|
||||
Log.w(ex);
|
||||
try {
|
||||
for (InetAddress addr : InetAddress.getAllByName(name))
|
||||
if (Arrays.equals(ip.getAddress(), addr.getAddress())) {
|
||||
Log.i("Accepted " + name + " for " + server);
|
||||
return;
|
||||
}
|
||||
} catch (UnknownHostException 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);
|
||||
Log.i(error);
|
||||
|
|
Loading…
Reference in a new issue