8135114: sun/security/krb5/auto tests failed on machine with TR locale

Reviewed-by: xuelei
This commit is contained in:
Artem Kosarev 2016-07-06 09:54:07 -07:00
parent d09f7620fe
commit 90e4430c17
6 changed files with 19 additions and 17 deletions

View File

@ -246,7 +246,7 @@ public class KDC {
* @throws java.io.IOException for any socket creation error
*/
public static KDC create(String realm) throws IOException {
return create(realm, "kdc." + realm.toLowerCase(), 0, true);
return create(realm, "kdc." + realm.toLowerCase(Locale.US), 0, true);
}
public static KDC existing(String realm, String kdc, int port) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,6 +30,7 @@
* @run main/othervm -Donlyonepreauth NewSalt
*/
import java.util.Locale;
import sun.security.jgss.GSSUtil;
import sun.security.krb5.Config;
@ -51,9 +52,9 @@ public class NewSalt {
}
// Use a different case of name. KDC will return correct salt
Context c1 = Context.fromUserPass(OneKDC.USER.toUpperCase(),
Context c1 = Context.fromUserPass(OneKDC.USER.toUpperCase(Locale.US),
OneKDC.PASS, true);
Context c2 = Context.fromUserPass(OneKDC.USER2.toUpperCase(),
Context c2 = Context.fromUserPass(OneKDC.USER2.toUpperCase(Locale.US),
OneKDC.PASS2, true);
c1.startAsClient(OneKDC.USER2, GSSUtil.GSS_KRB5_MECH_OID);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.Security;
import java.util.Locale;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
@ -52,9 +53,10 @@ public class OneKDC extends KDC {
public static final String KTAB = "localkdc.ktab";
public static final String JAAS_CONF = "localkdc-jaas.conf";
public static final String REALM = "RABBIT.HOLE";
public static String SERVER = "server/host." + REALM.toLowerCase();
public static String BACKEND = "backend/host." + REALM.toLowerCase();
public static String KDCHOST = "kdc." + REALM.toLowerCase();
public static final String REALM_LOWER_CASE = REALM.toLowerCase(Locale.US);
public static String SERVER = "server/host." + REALM_LOWER_CASE;
public static String BACKEND = "backend/host." + REALM_LOWER_CASE;
public static String KDCHOST = "kdc." + REALM_LOWER_CASE;
/**
* Creates the KDC and starts it.
* @param etype Encryption type, null if not specified

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -78,7 +78,8 @@ public class SSL extends SecurityManager {
ServicePermission p = (ServicePermission)perm;
// ServicePermissions required to create GSSName are ignored
if (!p.getActions().isEmpty()) {
permChecks = permChecks + p.getActions().toUpperCase().charAt(0);
permChecks = permChecks
+ p.getActions().toUpperCase(Locale.US).charAt(0);
}
}
@ -94,7 +95,7 @@ public class SSL extends SecurityManager {
System.setSecurityManager(new SSL());
KDC kdc = KDC.create(OneKDC.REALM);
server = "host." + OneKDC.REALM.toLowerCase(Locale.US);
server = "host." + OneKDC.REALM_LOWER_CASE;
if (args.length > 2) {
sniHostname = "test." + server;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,7 +34,6 @@ import com.sun.security.jgss.InquireType;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Locale;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
@ -46,7 +45,7 @@ public class SaslBasic {
public static void main(String[] args) throws Exception {
boolean bound = args[0].equals("bound");
String name = "host." + OneKDC.REALM.toLowerCase(Locale.US);
String name = "host." + OneKDC.REALM_LOWER_CASE;
new OneKDC(null).writeJAASConf();
System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -41,7 +41,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Locale;
import java.util.logging.ConsoleHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
@ -54,7 +53,7 @@ public class SaslGSS {
public static void main(String[] args) throws Exception {
String name = "host." + OneKDC.REALM.toLowerCase(Locale.US);
String name = "host." + OneKDC.REALM_LOWER_CASE;
new OneKDC(null).writeJAASConf();
System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");