8071313: krb5.conf not read if SCDynamicStore krb5 config is empty
authorweijun
Fri, 23 Jan 2015 09:22:14 +0800
changeset 28564 be13305854f5
parent 28563 d16b33a7c03a
child 28565 48712ca501c1
8071313: krb5.conf not read if SCDynamicStore krb5 config is empty Reviewed-by: mullan
jdk/src/java.security.jgss/share/classes/sun/security/krb5/SCDynamicStoreConfig.java
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/SCDynamicStoreConfig.java	Thu Jan 22 13:49:53 2015 -0800
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/SCDynamicStoreConfig.java	Fri Jan 23 09:22:14 2015 +0800
@@ -113,15 +113,17 @@
 
     @SuppressWarnings("unchecked")
     private static Hashtable<String, Object> convertNativeConfig(
-            Hashtable<String, Object> stanzaTable) {
+            Hashtable<String, Object> stanzaTable) throws IOException {
         // convert SCDynamicStore realm structure to Java realm structure
         Hashtable<String, ?> realms =
                 (Hashtable<String, ?>) stanzaTable.get("realms");
-        if (realms != null) {
-            stanzaTable.remove("realms");
-            Hashtable<String, Object> realmsTable = convertRealmConfigs(realms);
-            stanzaTable.put("realms", realmsTable);
+        if (realms == null || realms.isEmpty()) {
+            throw new IOException(
+                    "SCDynamicStore contains an empty Kerberos setting");
         }
+        stanzaTable.remove("realms");
+        Hashtable<String, Object> realmsTable = convertRealmConfigs(realms);
+        stanzaTable.put("realms", realmsTable);
         WrapAllStringInVector(stanzaTable);
         if (DEBUG) System.out.println("stanzaTable : " + stanzaTable);
         return stanzaTable;