Skip to content

Commit

Permalink
be tollerant of IPv6 addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
jtnord committed Aug 6, 2024
1 parent 5b890d8 commit e7b692d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import static org.junit.Assert.assertEquals;

import java.io.IOException;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
Expand Down Expand Up @@ -96,7 +97,11 @@ public void overrideDNSServers() throws UnknownHostException {

// we also need to set the JNDI default
// see hudson.plugins.active_directory.ActiveDirectoryDomain.createDNSLookupContext()
System.setProperty(DNSUtils.OVERRIDE_DNS_PROPERTY, "dns://"+hostIP+":553");
if (hostInetAddr instanceof Inet6Address) {
System.setProperty(DNSUtils.OVERRIDE_DNS_PROPERTY, "dns://["+hostIP+"]:553");
} else {
System.setProperty(DNSUtils.OVERRIDE_DNS_PROPERTY, "dns://"+hostIP+":553");
}
}

@After
Expand Down

0 comments on commit e7b692d

Please sign in to comment.