Browse Source

HADOOP-6913. Circular initialization between UserGroupInformation and KerberosName

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@991038 13f79535-47bb-0310-9956-ffa450edef68
Boris Shkolnik 15 years ago
parent
commit
5c8d9aecf7
2 changed files with 19 additions and 8 deletions
  1. 3 0
      CHANGES.txt
  2. 16 8
      src/java/org/apache/hadoop/security/UserGroupInformation.java

+ 3 - 0
CHANGES.txt

@@ -223,6 +223,9 @@ Trunk (unreleased changes)
     HADOOP-6932.  Namenode start (init) fails because of invalid kerberos 
     HADOOP-6932.  Namenode start (init) fails because of invalid kerberos 
     key, even when security set to "simple" (boryas)
     key, even when security set to "simple" (boryas)
 
 
+    HADOOP-6913. Circular initialization between UserGroupInformation and 
+    KerberosName (Kan Zhang via boryas)
+
 Release 0.21.0 - Unreleased
 Release 0.21.0 - Unreleased
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

+ 16 - 8
src/java/org/apache/hadoop/security/UserGroupInformation.java

@@ -209,10 +209,25 @@ public class UserGroupInformation {
   }
   }
 
 
   /**
   /**
-   * Set the configuration values for UGI.
+   * Initialize UGI and related classes.
    * @param conf the configuration to use
    * @param conf the configuration to use
    */
    */
   private static synchronized void initialize(Configuration conf) {
   private static synchronized void initialize(Configuration conf) {
+    initUGI(conf);
+    // give the configuration on how to translate Kerberos names
+    try {
+      KerberosName.setConfiguration(conf);
+    } catch (IOException ioe) {
+      throw new RuntimeException("Problem with Kerberos auth_to_local name " +
+          "configuration", ioe);
+    }
+  }
+  
+  /**
+   * Set the configuration values for UGI.
+   * @param conf the configuration to use
+   */
+  private static synchronized void initUGI(Configuration conf) {
     String value = conf.get(HADOOP_SECURITY_AUTHENTICATION);
     String value = conf.get(HADOOP_SECURITY_AUTHENTICATION);
     if (value == null || "simple".equals(value)) {
     if (value == null || "simple".equals(value)) {
       useKerberos = false;
       useKerberos = false;
@@ -233,13 +248,6 @@ public class UserGroupInformation {
     javax.security.auth.login.Configuration.setConfiguration
     javax.security.auth.login.Configuration.setConfiguration
         (new HadoopConfiguration());
         (new HadoopConfiguration());
     
     
-    // give the configuration on how to translate Kerberos names
-    try {
-      KerberosName.setConfiguration(conf);
-    } catch (IOException ioe) {
-      throw new RuntimeException("Problem with Kerberos auth_to_local name " +
-          "configuration", ioe);
-    }
     isInitialized = true;
     isInitialized = true;
     UserGroupInformation.conf = conf;
     UserGroupInformation.conf = conf;
   }
   }