1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 02:07:12 +00:00

Revert "Added support for cname records on looking op srv records"

This reverts commit 80a2b032bc.
This commit is contained in:
M66B 2020-09-01 16:00:40 +02:00
parent 9600395011
commit 0e5b00dac9

View file

@ -28,7 +28,6 @@ import android.os.Build;
import androidx.annotation.NonNull;
import org.xbill.DNS.CNAMERecord;
import org.xbill.DNS.Lookup;
import org.xbill.DNS.MXRecord;
import org.xbill.DNS.Record;
@ -103,11 +102,6 @@ public class DnsHelper {
@NonNull
static DnsRecord[] lookup(Context context, String name, String type) throws UnknownHostException {
return _lookup(context, name, type, 0);
}
@NonNull
static DnsRecord[] _lookup(Context context, String name, String type, int redirects) throws UnknownHostException {
int rtype;
switch (type) {
case "mx":
@ -145,11 +139,6 @@ public class DnsHelper {
} else if (record instanceof SRVRecord) {
SRVRecord srv = (SRVRecord) record;
result.add(new DnsRecord(srv.getTarget().toString(true), srv.getPort()));
} else if (record instanceof CNAMERecord) {
if (++redirects > 3)
throw new UnknownHostException("Too many cname records");
CNAMERecord cname = (CNAMERecord) record;
return _lookup(context, cname.getTarget().toString(true), type, redirects);
} else
throw new IllegalArgumentException(record.getClass().getName());
}