RFR: JDK-8243376: java.net.SocketPermission.implies(Permission p) spec is mismatching with implementation

Vyom Mani Tewari github.com+4410404+vyommani at openjdk.java.net
Tue Jan 5 13:04:54 UTC 2021


On Tue, 5 Jan 2021 09:48:11 GMT, Jayashree S Kumar <github.com+31532647+jaysk1 at openjdk.org> 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
>
> Apologies for the various (noise) commits for the Jcheck Whitespace error. 
> Will be more mindful and invest time in setting up local pre-commit check here-on.
> 
> The actual commits being: 
> Changes to file: src/java.base/share/classes/java/net/SocketPermission.java
> A new test case: test/jdk/java/net/SocketPermission/SocketPermissionIm.java
> A new host file: test/jdk/java/net/SocketPermission/Host.txt
> 
> Thanks!

Please find below minor comments.
1-> Please use File.separator, 
String hostsFileName = System.getProperty("test.src", ".") + File.separator + "Host.txt";
we don't need "System.exit(0);"   break will work instead.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1916


More information about the net-dev mailing list