--- a/src/java.security.jgss/share/classes/sun/security/krb5/Config.java Tue Aug 14 14:28:23 2018 +0200
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/Config.java Tue Aug 14 22:39:34 2018 +0800
@@ -45,6 +45,7 @@
import java.util.regex.Pattern;
import sun.net.dns.ResolverConfiguration;
+import sun.security.action.GetPropertyAction;
import sun.security.krb5.internal.crypto.EType;
import sun.security.krb5.internal.Krb5;
@@ -122,12 +123,12 @@
private static boolean isMacosLionOrBetter() {
// split the "10.x.y" version number
- String osname = getProperty("os.name");
+ String osname = GetPropertyAction.privilegedGetProperty("os.name");
if (!osname.contains("OS X")) {
return false;
}
- String osVersion = getProperty("os.version");
+ String osVersion = GetPropertyAction.privilegedGetProperty("os.version");
String[] fragments = osVersion.split("\\.");
// sanity check the "10." part of the version
@@ -152,14 +153,16 @@
/*
* If either one system property is specified, we throw exception.
*/
- String tmp = getProperty("java.security.krb5.kdc");
+ String tmp = GetPropertyAction
+ .privilegedGetProperty("java.security.krb5.kdc");
if (tmp != null) {
// The user can specify a list of kdc hosts separated by ":"
defaultKDC = tmp.replace(':', ' ');
} else {
defaultKDC = null;
}
- defaultRealm = getProperty("java.security.krb5.realm");
+ defaultRealm = GetPropertyAction
+ .privilegedGetProperty("java.security.krb5.realm");
if ((defaultKDC == null && defaultRealm != null) ||
(defaultRealm == null && defaultKDC != null)) {
throw new KrbException
@@ -818,11 +821,12 @@
* The method returns null if it cannot find a Java config file.
*/
private String getJavaFileName() {
- String name = getProperty("java.security.krb5.conf");
+ String name = GetPropertyAction
+ .privilegedGetProperty("java.security.krb5.conf");
if (name == null) {
- name = getProperty("java.home") + File.separator +
- "conf" + File.separator + "security" +
- File.separator + "krb5.conf";
+ name = GetPropertyAction.privilegedGetProperty("java.home")
+ + File.separator + "conf" + File.separator + "security"
+ + File.separator + "krb5.conf";
if (!fileExists(name)) {
name = null;
}
@@ -852,7 +856,7 @@
*/
private String getNativeFileName() {
String name = null;
- String osname = getProperty("os.name");
+ String osname = GetPropertyAction.privilegedGetProperty("os.name");
if (osname.startsWith("Windows")) {
try {
Credentials.ensureLoaded();
@@ -899,13 +903,8 @@
return name;
}
- private static String getProperty(String property) {
- return java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction(property));
- }
-
private String findMacosConfigFile() {
- String userHome = getProperty("user.home");
+ String userHome = GetPropertyAction.privilegedGetProperty("user.home");
final String PREF_FILE = "/Library/Preferences/edu.mit.Kerberos";
String userPrefs = userHome + PREF_FILE;