mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 18:59:41 +02:00
Fix NPE in DNSResolver.lookupSRVRecords0
in case hostAddresses was null, the isEmpty() check before the log() invocation would throw an NPE. Thanks to Ingo Bauersachs for reporting this. Fixes SMACK-788.
This commit is contained in:
parent
be4aacc71d
commit
47940ba5ad
4 changed files with 21 additions and 24 deletions
|
@ -20,6 +20,7 @@ import java.net.InetAddress;
|
|||
import java.net.UnknownHostException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.ConnectionConfiguration.DnssecMode;
|
||||
|
@ -91,6 +92,22 @@ public abstract class DNSResolver {
|
|||
return Arrays.asList(inetAddressArray);
|
||||
}
|
||||
|
||||
protected final boolean shouldContinue(CharSequence name, CharSequence hostname, List<InetAddress> hostAddresses) {
|
||||
if (hostAddresses == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 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 (" + hostname
|
||||
+ ") which has neither A or AAAA resource records. This is an indication of a broken DNS setup.");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private final void checkIfDnssecRequestedAndSupported(DnssecMode dnssecMode) {
|
||||
if (dnssecMode != DnssecMode.disabled && !supportsDnssec) {
|
||||
throw new UnsupportedOperationException("This resolver does not support DNSSEC");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue