mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 00:59:39 +02:00
DNS: Correctly handle broken SRV records
where the SRV RR points to a target DNS name with no associated A or AAAA RRs. Fixes SMACK-781.
This commit is contained in:
parent
122bf06ccc
commit
01aa6d9c18
4 changed files with 37 additions and 3 deletions
|
@ -19,6 +19,7 @@ package org.jivesoftware.smack.util.dns.dnsjava;
|
|||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.jivesoftware.smack.ConnectionConfiguration.DnssecMode;
|
||||
import org.jivesoftware.smack.initializer.SmackInitializer;
|
||||
|
@ -73,7 +74,13 @@ public class DNSJavaResolver extends DNSResolver implements SmackInitializer {
|
|||
int weight = srvRecord.getWeight();
|
||||
|
||||
List<InetAddress> hostAddresses = lookupHostAddress0(host, failedAddresses, dnssecMode);
|
||||
if (hostAddresses == null) {
|
||||
if (hostAddresses == null || hostAddresses.isEmpty()) {
|
||||
// If hostAddresses is not null but empty, then the DNS resolution was successful but the domain did not
|
||||
// have any A or AAAA resource records.
|
||||
if (hostAddresses.isEmpty()) {
|
||||
LOGGER.log(Level.INFO, "The DNS name " + name + ", points to a hostname (" + host
|
||||
+ ") which has neither A or AAAA resource records. This is an indication of a broken DNS setup.");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue