changeset 11298:c108ee479759

8071313: krb5.conf not read if SCDynamicStore krb5 config is empty Reviewed-by: mullan
author weijun
date Fri, 23 Jan 2015 09:22:14 +0800
parents 6cad4bc527c6
children 41b3e91dc2b2
files src/java.security.jgss/share/classes/sun/security/krb5/SCDynamicStoreConfig.java
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.security.jgss/share/classes/sun/security/krb5/SCDynamicStoreConfig.java	Thu Jan 22 13:49:53 2015 -0800
+++ b/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;