On Wed, 10 Mar 2021 17:32:30 GMT, Jayashree S Kumar <d...@openjdk.java.net> wrote:
>> Issue >> >> https://bugs.openjdk.java.net/browse/JDK-8243376 >> >> Problem >> >> The scenario is: >> - Some specified target hostname resolves to two IP addresses (always the >> same address pair). >> - The DNS resolved order of the two ip addresses changes (a usual >> LoadBalancer type behavior). >> - The CNAME of the two ip addresses differ. >> >> In SocketPermission class(void getIP() method), it internally resolves and >> saves only the first IP address resolved, not all the IP addresses resolved. >> - Depending on when the implier/implied SocketPermission hostname is >> resolved, the resolved addresses order differs, and the internally saved IP >> address mismatches, resulting on SocketPermission#implies() false. >> >> >> Michael McMahon kindly reviewed and suggested changes: >> https://mail.openjdk.java.net/pipermail/net-dev/2020-May/014001.html > > Jayashree S Kumar has updated the pull request incrementally with one > additional commit since the last revision: > > Jcheck Review: Corrected the tab error @jaysk1 Thanks for this PR! I've left some questions inline. src/java.base/share/classes/java/net/SocketPermission.java line 1090: > 1088: > 1089: if (this.cnames != null) { > 1090: return this.cnames[0].equalsIgnoreCase(that.cnames[0]); @jaysk1 Can this comparison fail for SocketPermission objects that have multiple cname entries in different orders? src/java.base/share/classes/java/net/SocketPermission.java line 1123: > 1121: return this.getName().hashCode(); > 1122: else > 1123: return this.cnames[0].hashCode(); @jaysk1 Can this cause "equal" `SocketPermission` objects with the identical, multiple cname entries, but in a different order, to have unequal hash codes? test/jdk/java/net/SocketPermission/SocketPermissionIm.java line 26: > 24: break; > 25: } > 26: addIpToHostsFile(hostname, "1.2.3."+testPass, > hostsFileName); nit: Looks like these needs an indentation correction. test/jdk/java/net/SocketPermission/SocketPermissionIm.java line 34: > 32: private static void addIpToHostsFile(String host, String addr, > String hostsFileName) > 33: > throws Exception { > 34: String mapping = addr + " " + host; nit: indentation? ------------- Changes requested by pushka...@github.com (no known OpenJDK username). PR: https://git.openjdk.java.net/jdk/pull/1916