From 1f63fea82e59ac99e363fcff33ce4461173d101a Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 25 Jun 2024 20:41:43 +0200 Subject: [PATCH] Refactoring --- app/src/main/java/eu/faircode/email/DnsHelper.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/DnsHelper.java b/app/src/main/java/eu/faircode/email/DnsHelper.java index 24d12c2f1f..d0dcd86c3b 100644 --- a/app/src/main/java/eu/faircode/email/DnsHelper.java +++ b/app/src/main/java/eu/faircode/email/DnsHelper.java @@ -42,6 +42,7 @@ import org.minidns.dnsqueryresult.DnsQueryResult; import org.minidns.dnsqueryresult.StandardDnsQueryResult; import org.minidns.dnssec.DnssecClient; import org.minidns.dnssec.DnssecResultNotAuthenticException; +import org.minidns.dnssec.DnssecUnverifiedReason; import org.minidns.dnssec.DnssecValidationFailedException; import org.minidns.dnsserverlookup.AbstractDnsServerLookupMechanism; import org.minidns.hla.DnssecResolverApi; @@ -76,6 +77,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Locale; +import java.util.Set; import java.util.concurrent.Executor; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; @@ -216,9 +218,10 @@ public class DnsHelper { throw ex; } - boolean secure = (data.getUnverifiedReasons() != null); + Set unverifiedReasons = data.getUnverifiedReasons(); + boolean secure = (unverifiedReasons == null || unverifiedReasons.isEmpty()); Log.i("DNS secure=" + secure + " dnssec=" + dnssec); - if (secure && dnssec) { + if (!secure && dnssec) { DnssecResultNotAuthenticException ex = data.getDnssecResultNotAuthenticException(); if (ex != null) throw ex;