work around idn short comings in minidns

This commit is contained in:
Daniel Gultsch 2017-07-10 08:50:01 +02:00
parent 7cbef529ae
commit da00a58902
2 changed files with 3 additions and 2 deletions

View File

@ -80,7 +80,7 @@ public class Resolver {
} }
List<Result> list = new ArrayList<>(); List<Result> list = new ArrayList<>();
try { try {
ResolverResult<D> results = resolveWithFallback(srv.name,type, !authenticated); ResolverResult<D> results = resolveWithFallback(DNSName.from(srv.name.toString()),type, !authenticated);
for (D record : results.getAnswersOrEmptySet()) { for (D record : results.getAnswersOrEmptySet()) {
Result resolverResult = Result.fromRecord(srv, directTls); Result resolverResult = Result.fromRecord(srv, directTls);
resolverResult.authenticated = results.isAuthenticData() && authenticated; resolverResult.authenticated = results.isAuthenticData() && authenticated;

View File

@ -18,6 +18,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigInteger; import java.math.BigInteger;
import java.net.ConnectException; import java.net.ConnectException;
import java.net.IDN;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.Socket; import java.net.Socket;
@ -369,7 +370,7 @@ public class XmppConnection implements Runnable {
+ ": using values from dns " + result.getHostname().toString() + ": using values from dns " + result.getHostname().toString()
+ "/" + result.getIp().getHostAddress() + ":" + result.getPort() + " tls: " + features.encryptionEnabled); + "/" + result.getIp().getHostAddress() + ":" + result.getPort() + " tls: " + features.encryptionEnabled);
} else { } else {
addr = new InetSocketAddress(result.getHostname().toString(), result.getPort()); addr = new InetSocketAddress(IDN.toASCII(result.getHostname().toString()), result.getPort());
Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() Log.d(Config.LOGTAG, account.getJid().toBareJid().toString()
+ ": using values from dns " + ": using values from dns "
+ result.getHostname().toString() + ":" + result.getPort() + " tls: " + features.encryptionEnabled); + result.getHostname().toString() + ":" + result.getPort() + " tls: " + features.encryptionEnabled);