From b28b1dd154fe672f7f2996ea3ef7c56c787e1e84 Mon Sep 17 00:00:00 2001 From: genofire Date: Tue, 18 Feb 2020 22:56:03 +0100 Subject: [PATCH] happy eyeball: fix dnssec for plain ip an srv-cname --- .../java/eu/siacs/conversations/utils/Resolver.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/utils/Resolver.java b/src/main/java/eu/siacs/conversations/utils/Resolver.java index 592d8b4a0..4f91c130a 100644 --- a/src/main/java/eu/siacs/conversations/utils/Resolver.java +++ b/src/main/java/eu/siacs/conversations/utils/Resolver.java @@ -165,6 +165,7 @@ public class Resolver { Result result = new Result(); result.ip = InetAddress.getByName(domain); result.port = port; + result.authenticated = true; return result; } catch (UnknownHostException e) { return null; @@ -197,18 +198,20 @@ public class Resolver { })); fallbackThreads.add(new Thread(() -> { try { - for (CNAME cname : resolveWithFallback(record.name, CNAME.class, result.isAuthenticData()).getAnswersOrEmptySet()) { - final List ipv6s = resolveIp(record, cname.name, AAAA.class, result.isAuthenticData(), directTls); + ResolverResult cnames = resolveWithFallback(record.name, CNAME.class, result.isAuthenticData()); + for (CNAME cname : cnames.getAnswersOrEmptySet()) { + final List ipv6s = resolveIp(record, cname.name, AAAA.class, cnames.isAuthenticData(), directTls); synchronized (fallbackResults) { fallbackResults.addAll(ipv6s); } - final List ipv4s = resolveIp(record, cname.name, A.class, result.isAuthenticData(), directTls); + final List ipv4s = resolveIp(record, cname.name, A.class, cnames.isAuthenticData(), directTls); synchronized (results) { fallbackResults.addAll(ipv4s); } } + Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + "cname in srv (agains RFC2782) - run slow fallback"); } catch (Throwable throwable) { - Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + "error resolving srv cname-fallback records", throwable); + Log.i(Config.LOGTAG, Resolver.class.getSimpleName() + "error resolving srv cname-fallback records", throwable); } })); }