8282293: Domain value for system property jdk.https.negotiate.cbt should be case-insensitive

Reviewed-by: weijun, rhalade
This commit is contained in:
Sibabrata Sahoo 2022-03-23 06:45:37 +00:00
parent 1443f6b919
commit 86015e15a5
2 changed files with 11 additions and 3 deletions

View File

@ -332,10 +332,11 @@ public abstract class AbstractDelegateHttpsURLConnection extends
if (prop.startsWith("domain:")) {
String[] domains = prop.substring(7).split(",");
for (String domain : domains) {
if (target.equals(domain)) {
if (target.equalsIgnoreCase(domain)) {
return true;
}
if (domain.startsWith("*.") && target.endsWith(domain.substring(1))) {
if (domain.startsWith("*.") && target.regionMatches(
true, target.length() - domain.length() + 1, domain, 1, domain.length() - 1)) {
return true;
}
}

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 8279842
* @bug 8279842 8282293
* @modules java.base/sun.security.util
* java.security.jgss/sun.security.jgss
* java.security.jgss/sun.security.jgss.krb5
@ -52,7 +52,13 @@
* @run main/othervm -Djdk.net.hosts.file=TestHosts
* -Djdk.https.negotiate.cbt=domain:host.web.domain HttpsCB true true
* @run main/othervm -Djdk.net.hosts.file=TestHosts
* -Djdk.https.negotiate.cbt=domain:HOST.WEB.DOMAIN HttpsCB true true
* @run main/othervm -Djdk.net.hosts.file=TestHosts
* -Djdk.https.negotiate.cbt=domain:*.web.domain HttpsCB true true
* @run main/othervm -Djdk.net.hosts.file=TestHosts
* -Djdk.https.negotiate.cbt=domain:*.WEB.Domain HttpsCB true true
* @run main/othervm -Djdk.net.hosts.file=TestHosts
* -Djdk.https.negotiate.cbt=domain:*.Invalid,*.WEB.Domain HttpsCB true true
*/
import com.sun.net.httpserver.Headers;
@ -198,6 +204,7 @@ public class HttpsCB {
conn.getInputStream()));
return reader.readLine().equals(CONTENT);
} catch (IOException e) {
e.printStackTrace(System.out);
return false;
}
}